Isso não é bem ao certo um tutorial, você me pegou de surpresa. :9
Vou ver em qual sessão melhor se encaixa e logo o moverei.
Muito obrigado por sua contribuição!
info
Grupo: Conde
Registrado: 06/11/06
Posts: 850
Reputação: +6
Char no Tibia: Xearius Thor

Isso não é bem ao certo um tutorial, você me pegou de surpresa. :9
Vou ver em qual sessão melhor se encaixa e logo o moverei.
Muito obrigado por sua contribuição!
#RedZL
A área correta é:
XTibia - A sua comunidade de Tibia e OTserv > OTServ > Tutoriais - OTserv > Tutoriais de Scripting
info
Grupo: Campones
Registrado: 30/12/08
Posts: 9
Reputação: 0
Char no Tibia: Radamanthys
bem eu n quero fazer scripts que ja me cansei muito fazendo os meus pra aprender cada vez mais. Vou soh corrigir os erros:
erro 1
function onUse(cid, item, frompos, item2, topos)
sorte = math.random(1,6)
pos = getPlayerPosition(cid)
if item.itemid == 6567 then
doSendMagicEffect(pos,22)
if sorte == 1 then
doPlayerSay(cid,'Ho ho ho!',16)
elseif sorte == 2 then
doPlayerSay(cid,'Jingle bells, jingle bells..',180)
elseif sorte == 3 then
doPlayerSay(cid,'Have you been naughty?',180)
elseif sorte == 4 then
doPlayerSay(cid,'Have you been nice?',180)
elseif sorte == 5 then
doPlayerSay(cid,'Merry Christmas!',180)
elseif sorte == 6 then
doPlayerSay(cid,'Can you stop squeezing me now... I m starting to feel a little sick.',16)
end
end
return 1
end
ta ai, agora o 2:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.itemid == 2782 then
doTransformItem(itemEx.uid, 2781)
doDecayItem(itemEx.uid)
return TRUE
end
return destroyItem(cid, itemEx, toPosition)
end
O 2 ta ai, agora o 3:
Eu sei o erro mas n sei corrigir o animatedtext soh vai aparecer a frase no quadrado em que o player está então deveria trocar para doCreatureSay porque esse aparece todos. No animatedtext ele pede a posição e está lah para aparecer soh no quadrado que o player está n espero um certo que n corrigi mas pelo menos tentei ![]()
agora vou mostrar o 4 esse eu n tenho certeza se o script vai estar certo ![]()
Bem tae4, eu vi o erro e está no primeiro if eu vou botar da maneira certa ![]()
function onUse(cid, item, fromPosition, itemEx, toPosition)
newnPosition = {x=1904, y=1006, z=8}
if item.uid == 32194 and item.itemid == x then
if getPlayerStorageValue(cid,15005) == -1 then
doTeleportThing(cid,newnposition)
doSendMagicEffect(newnposition,10)
else
return 0
end
return 1
end
Bem aonde ta o x eh o id do item que irá usar ![]()
Bem o 5 eh muito grande e n estou com vontade de analisar ele mas sei que consigo tanto que fiz mentalmente os erros se algum dia eu estiver com disposição eu fasso outro post que fale dele
Hail!!
info
Grupo: Conde
Registrado: 06/11/06
Posts: 850
Reputação: +6
Char no Tibia: Xearius Thor

#RedZL
A área correta é:
XTibia - A sua comunidade de Tibia e OTserv > OTServ > Tutoriais - OTserv > Tutoriais de Scripting
Agora me diga, desde quando uma prova é um tutorial? Até onde sei uma prova é para testar seus conhecimentos e um tutorial é para ensinar você sobre determinado assunto.
info
Grupo: Conde
Registrado: 18/12/05
Posts: 912
Reputação: +86
Gênero: Masculino
Char no Tibia: Kohzete

@up
Redzl tem uns exercicios em scripting.
Vc pode colocar aonde melhor entender eu coloquei lá porque tinha um ![]()
Qualquer caso tem o link dele na pasta enciclopedia...
@randamanthis
hehe eu entendo
Logo mais colocarei as respostas
info
Grupo: Conde
Registrado: 06/11/06
Posts: 850
Reputação: +6
Char no Tibia: Xearius Thor

Estarei movendo para sessão de tutoriais de scripting.
Movido para Tutoriais - OTServ > Tutoriais de Scripting.
Editado Janeiro 24 por RedZL
info
Grupo: Campones
Registrado: 11/11/07
Posts: 61
Reputação: 0
Char no Tibia: Paladinhozinho

hmm muito legal essa ideia, estou fazendo os meus scripts e quando termina posto aqui
info
Grupo: Visconde
Registrado: 12/08/07
Posts: 345
Reputação: +7
Char no Tibia: Lokeded
Eu queria tanto participa do concurso, mas eu n tenho o programinha q cria action,
Tpw eu n sei colokas as palavras certas, ex:
doPlayerAddMana(n sei se existe isso, mas eh um exemplo)
Algm me indica algum programinha pra facilitar a criação de action
info
Grupo: Campones
Registrado: 11/11/07
Posts: 61
Reputação: 0
Char no Tibia: Paladinhozinho

antes de mais nada queria deixar claro que todos os scripts(exeto a fishing rod que só a modifiquei) são de minha autoria, portanto creditos 100% meu,
ai vai os meus scripts:
SCRIPTS
1 - fiz tudo certinho, testei com uma copia exata do mapa da foto, e tomei a liberdade de de botar uma pequena função que joga todas as criaturas e itens que estao na ponte pra fora dela quando a mesma esta fechando, e tudo funcionando 100%
-------------Script made by Tozao(for ta4e competition)----------------------------Created for version 8.4-------------------
function limparPonte(pontearea)
for pontex = 1024,1027 do
for pontestackpos = 2,255 do
pontearea = {x=pontex, y=1021, z=7, stackpos=pontestackpos}
newpos = {x=1028, y=1021, z=7}
itemponte = getThingFromPos(pontearea)
if itemponte.itemid > 0 then
doTeleportThing(itemponte.uid,newpos)
end
end
end
end
-------------retirando a ponte--------------
function onUse(cid, item, fromPosition, itemEx, toPosition)
pos1 = {x=1027, y=1021, z=7}
pos2 = {x=1026, y=1021, z=7}
pos3 = {x=1025, y=1021, z=7}
pos4 = {x=1024, y=1021, z=7}
pontearea3 = {x=1025, y=1021, z=7, stackpos=1}
pontearea5 = {x=1027, y=1021, z=7, stackpos=1}
pontearea4 = {x=1026, y=1021, z=7, stackpos=1}
getitempont2 = getThingFromPos(pontearea3)
getitempont3 = getThingFromPos(pontearea4)
getitempont4 = getThingFromPos(pontearea5)
if item.actionid == 20005 and item.itemid == 1945 then
doTransformItem(item.uid,item.itemid+1)
limparPonte(pontearea)
doCreateItem(493,1,pos1)
doCreateItem(4676,1,pos1)
doCreateItem(493,1,pos2)
doCreateItem(4672,1,pos2)
doCreateItem(493,1,pos3)
doCreateItem(4670,1,pos3)
doCreateItem(103,1,pos4)
-------------criando a ponte------------
elseif item.actionid == 20005 and item.itemid == 1946 then
doRemoveItem(getitempont2.uid,1)
doRemoveItem(getitempont4.uid,1)
doRemoveItem(getitempont3.uid,1)
doCreateItem(5770,1,pos1)
doCreateItem(5770,1,pos2)
doCreateItem(5770,1,pos3)
doCreateItem(5770,1,pos4)
doTransformItem(item.uid,item.itemid-1)
end
return TRUE
end
2- acho que esta perfeito tambem igual ao primeiro, funciona 100%
-------------Script made by Tozao(for ta4e competition)----------------------------Created for version 8.4-------------------
function onUse(cid, item, frompos, item2, topos)
-----------------chest1---------------
if item.uid == 20005 then
if getPlayerStorageValue(cid,5555) == -1 then
if getPlayerFreeCap(cid) >= 80 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Demon Armor.")
doPlayerAddItem(cid,2494,1)
setPlayerStorageValue(cid,5555,1)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have found a demon armor. Weighing 80.00 oz it is too heavy.")
end
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"It is empty.")
end
-----------------chest2---------------
elseif item.uid == 20006 then
if getPlayerStorageValue(cid,5555) == -1 then
if getPlayerFreeCap(cid) >= 42 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Magic Sword.")
doPlayerAddItem(cid,2400,1)
setPlayerStorageValue(cid,5555,1)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have found a magic sword. Weighing 42.00 oz it is too heavy.")
end
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"It is empty.")
end
-----------------chest3---------------
elseif item.uid == 20007 then
if getPlayerStorageValue(cid,5555) == -1 then
if getPlayerFreeCap(cid) >= 99 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Stonecutter's Axe.")
doPlayerAddItem(cid,2431,1)
setPlayerStorageValue(cid,5555,1)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have found a stonecutter axe. Weighing 99.00 oz it is too heavy.")
end
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"It is empty.")
end
-----------------chest4---------------
elseif item.uid == 20008 then
if getPlayerStorageValue(cid,5555) == -1 then
if getPlayerFreeCap(cid) >= 43 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Annihilator Bear.")
doPlayerAddItem(cid,2326,1)
setPlayerStorageValue(cid,5555,1)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have found a annihilator bear. Weighing 43.00 oz it is too heavy.")
end
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"It is empty.")
end
-----------------porta da sala pequena---------------
elseif item.uid == 20009 and item.itemid == 5114 then
if getPlayerStorageValue(cid, 5555) == 1 then
if getPlayerVocation(cid) > 4 then
doTransformItem(item.uid, item.itemid+1)
doTeleportThing(cid,frompos)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only promoted players may enter here.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don\'t complete the quest.")
end
-----------------chest da sala pequena---------------
elseif item.uid == 20010 then
if getPlayerStorageValue(cid,5556) == -1 then
if getPlayerFreeCap(cid) >= 18.40 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a bag.")
container = doPlayerAddItem(cid,1991,1)
doAddContainerItem(container,2160,100)
doAddContainerItem(container,2123,1)
setPlayerStorageValue(cid,5556,1)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have found a bag. Weighing 18.40 oz it is too heavy.")
end
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"It is empty.")
end
return TRUE
end
end
3- fiz um script que do meu ponto de vista esta sem erros de sintaxe, mas nao importa oq eu faça mesmo a pessoa tendo o amulet ele nao deixa entrar(se puder diser aonde eu errei ficarei grato)
-------------Script made by Tozao(for ta4e competition)----------------------------Created for version 8.4-------------------
function onUse(cid, item, frompos, item2, topos)
-----------------porta das mulheres------------------
if item.uid == 20015 and item.itemid == 5114 then
if getPlayerSex(cid) == 0 then
if(isInArray(2130, getPlayerSlotItem(cid,2)) == TRUE) then
doTransformItem(item.uid, item.itemid+1)
doTeleportThing(cid,frompos)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don\'t have the golden amulet.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Aqui não entra homen.")
return TRUE
end
-----------------porta dos homens------------------
elseif item.uid == 20016 and item.itemid == 5114 then
if getPlayerSex(cid) == 1 then
if(isInArray(2142, getPlayerSlotItem(cid,2)) == TRUE) then
doTransformItem(item.uid, item.itemid+1)
doTeleportThing(cid,frompos)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don\'t have the ancient amulet.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Desculpe, aqui é uma boate gay, não aceitamos mulheres.")
end
end
end
4- tambem do meu ponto de vista perfeito :smile_positivo:
-------------Script made by Tozao(for ta4e competition)----------------------------Created for version 8.4-------------------
function onUse(cid, item, fromPosition, itemEx, toPosition)
coalbasin1 = {x=1027, y=1021, z=7, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}
coalbasin2 = {x=1026, y=1022, z=7, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}
coalbasin3 = {x=1027, y=1023, z=7, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}
coalbasin4 = {x=1028, y=1022, z=7, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}
food1 = getThingFromPos(coalbasin1)
food2 = getThingFromPos(coalbasin2)
food3 = getThingFromPos(coalbasin3)
food4 = getThingFromPos(coalbasin4)
if item.actionid == 20020 and item.itemid == 1945 then
if getPlayerLevel(cid) >= 50 then
if food1.itemid == 2787 and food2.itemid == 2789 and food3.itemid == 2792 and food4.itemid == 2796 then
doRemoveItem(food1.uid)
doRemoveItem(food2.uid)
doRemoveItem(food3.uid)
doRemoveItem(food4.uid)
setPlayerStorageValue(cid,2479,1)
doPlayerSendTextMessage(cid,25, "Congratulations, now you may pass on the magic door.")
doTransformItem(item.uid,item.itemid+1)
else
doPlayerSendTextMessage(cid,26, "Sorry, you don\'t have all foods, you need a white, brown, dark and green mushrooms.")
end
else
doPlayerSendTextMessage(cid,26, "Sorry, you need get level 50.")
end
elseif item.actionid == 20020 and item.itemid == 1946 then
doTransformItem(item.uid,item.itemid-1)
end
return TRUE
end
5- esse foi o que mais me deixou com raiva, depois de ter feito um script que eu achava um dos melhores que eu tinha feito, ele só clica na chest e ela abri como se tivesse sem actionid...se me diser onde eu errei nesse tambem ficarei grato
-------------Script made by Tozao(for ta4e competition)----------------------------Created for version 8.4--------------------
local prizes = {[{2,6}] = 2182, [{3,7}] = 2456, [{1,5}] = 2190, [{4,8}] = 2409}
function onUse(cid, item, frompos, item2, topos)
local vocation = getPlayerVocation(cid)
local itemweight = getItemWeightById(prizes[vocation],1)
local itemname = getItemNameById(prizes[vocation],1)
pos = getCreaturePosition(cid)
health = getCreatureHealth(cid)
if item.uniqueid == 20025 then
if getPlayerLevel(cid) >= 9 then
if vocation >= 1 then
if getPlayerStorageValue(cid,7777) == -1 then
if getPlayerFreeCap(cid) >= itemweigth then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. itemname .. ".")
doPlayerAddItem(cid,prizes[vocation],1)
setPlayerStorageValue(cid,7777,1)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have found a demon helmet. Weighing " .. itemweight .. " oz it is too heavy.")
end
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You already made this quest.")
doPlayerAddHealth(cid, health -1)
doSendMagicEffect(pos,12)
end
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Sorry, you need a vocation.")
end
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Sorry, you need get level 9.")
end
return TRUE
end
end
6- acredito ter feito exatamente o que vc pedio(testei e funciona 100%)
local waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625}function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getCreaturePosition(cid)
if isInArray(waterIds, itemEx.itemid) == TRUE then
if itemEx.itemid ~= 493 then
if math.random(1, (100 + (getPlayerSkill(cid, SKILL_FISHING) / 10))) <= getPlayerSkill(cid, SKILL_FISHING) then
if getPlayerItemCount(cid, ITEM_FISH) > 0 then
doPlayerRemoveItem(cid, ITEM_FISH, 1)
doSummonCreature("Crocodile", {x=pos.x+1, y=pos.y, z=pos.z})
end
elseif getPlayerItemCount(cid, ITEM_WORM) > 0 then
doPlayerRemoveItem(cid, ITEM_WORM, 1)
doPlayerAddItem(cid, ITEM_FISH, 1)
elseif getPlayerItemCount(cid, ITEM_WORM) == 0 then
if math.random(1,10) == 1 then
doPlayerAddItem(cid, 2238, 1)
end
end
doPlayerAddSkillTry(cid, SKILL_FISHING, 1)
end
doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
return TRUE
end
return FALSE
end
CORREÇÃO DE ERROS
1- corrigi sem problemas
function onUse(cid, item, frompos, item2, topos)
sorte = math.random(1,6)
pos = getPlayerPosition(cid)
if item.itemid == 6567 then
doSendMagicEffect(pos,22)
if sorte == 1 then
doPlayerSay(cid,'Ho ho ho!',TALKTYPE_ORANGE_1)
elseif sorte == 2 then
doPlayerSay(cid,'Jingle bells, jingle bells..',TALKTYPE_ORANGE_1)
elseif sorte == 3 then
doPlayerSay(cid,'Have you been naughty?',TALKTYPE_ORANGE_1)
elseif sorte == 4 then
doPlayerSay(cid,'Have you been nice?',TALKTYPE_ORANGE_1)
elseif sorte == 5 then
doPlayerSay(cid,'Merry Christmas!',TALKTYPE_ORANGE_1)
elseif sorte == 6 then
doPlayerSay(cid,'Can you stop squeezing me now... I m starting to feel a little sick.',TALKTYPE_ORANGE_1)
end
end
end
2- tambem foi facil
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.itemid == 2782 then
doTransformItem(itemEx.uid, 2781)
doDecayItem(itemEx.uid)
return TRUE
end
return destroyItem(cid, itemEx, toPosition)
end
3- tambem sem problemas
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 2148 and item.type == 100 then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, ITEM_PLATINUM_COIN, 1)
doSendAnimatedText(fromPosition, "You don\'t have money", TEXTCOLOR_PLATINUMBLUE)
end
end
4- ainda sem nenhum problema...
function onUse(cid, item, frompos, item2, topos)
if item.uid == 32194 then
if getPlayerStorageValue(cid, 15005) == 8 then
doTeleportThing(cid, {x=1904, y=1006, z=8})
doSendMagicEffect({x=1904, y=1006, z=8} ,10)
else
end
return TRUE
end
end
5 e 6- foi o mais trabalhoso(nao testei o script pra valer, só chequei se estava sem erros de sintaxe)
--Function by Ta4e for Tibia 8.22--
--Uses grounds of RIkezinho action--
--Halloween,Cake and Bread systems like in tibia
local cakes = {[1] = 2693, [6] = 6277}
local mill = {1381, 1382, 1383, 1384}
local bucket = {2005, 1775}
local ovenId = {1786, 1788, 1790, 1792, 6358, 6360, 6362, 6356}
function onUse(cid, item, frompos, item2, topos)
topos = {x=topos.x,y=topos.y,z=topos.z}
--Bread and cakes--
if item.itemid == 2694 and (isInArray(mill, item2.itemid) == TRUE) then
doRemoveItem(item.uid,1)
doPlayerAddItem(cid,2692,1)
elseif item.itemid == 2692 and (isInArray(bucket, item2.itemid) == TRUE) then
if cakes[item2.type] ~= nil then
doChangeTypeItem(item2.uid,0)
doTransformItem(item.uid, cakes[item2.type])
return TRUE
end
elseif item.itemid == 2693 and (isInArray(ovenId, item2.itemid) == TRUE) then
doTransformItem(item.uid,2689)
if item.itemid == 6277 and (isInArray(ovenId, item2.itemid) == TRUE) then
doRemoveItem(item.uid,1)
doCreateItem(6278,1,topos)
elseif item2.itemid == 6574 then
doTransformItem(item.uid,8846)
doRemoveItem(item2.uid,1)
end
elseif item.itemid == 8846 and (isInArray(ovenId, item2.itemid) == TRUE) then
doTransformItem(item.uid,8847)
elseif item.itemid == 6280 then
doTransformItem(item.uid,6279)
doSendMagicEffect(topos,2)
name = getPlayerName(cid)
doCreatureSay (cid, name ..' blew out the candle.', TALKTYPE_ORANGE_1)
--Pumpkins--
if item.itemid == 2566 and item2.itemid == 2683 then
doTransformItem(item2.uid,2096)
end
if item.itemid == 2096 and item2.itemid == 2048 then
doTransformItem(item.uid,2097)
doRemoveItem(item2.uid,1)
end
end
return 1
end
Fim :smile_positivo:
Editado Abril 4 por Tozao
info
Grupo: Marquês
Registrado: 01/03/06
Posts: 1k
Reputação: +38
Gênero: Masculino

Eu queria tanto participa do concurso, mas eu n tenho o programinha q cria action,
Tpw eu n sei colokas as palavras certas, ex:
doPlayerAddMana(n sei se existe isso, mas eh um exemplo)
Algm me indica algum programinha pra facilitar a criação de action
bloco de notas for all ![]()
todas linguagens de programação, até as que têm compiladores você pode usar bloco de notas, eu prefiro bloco de notas para as seguintes linguagens: html (não é muito uma linguagem), php, asp, lua, c, c++
info
Grupo: Conde
Registrado: 18/12/05
Posts: 912
Reputação: +86
Gênero: Masculino
Char no Tibia: Kohzete

@up
Eu uso notepad ++ rlz...
Eu vou postar as respostas...
Até esqueci disso
hehe
info
Grupo: Campones
Registrado: 11/11/07
Posts: 61
Reputação: 0
Char no Tibia: Paladinhozinho

nao eh por nada nao mais quando virão as respostas?
info
Grupo: Conde
Registrado: 18/12/05
Posts: 912
Reputação: +86
Gênero: Masculino
Char no Tibia: Kohzete

semana q vem ![]()
mal mesmo essa semana foi prova na ETEC e se eu estudasse mais eu ficaria cego
Pelo menos as notas foram boas (8,5 a menor!!)
Eu vou arrumar elas hoje e quando tiver acesso posto
Mais pelo que vi a suas estão certas...
Editado Abril 3 por tibiaa4e
info
Grupo: Campones
Registrado: 11/11/07
Posts: 61
Reputação: 0
Char no Tibia: Paladinhozinho

aee :positive:
info
Grupo: Conde
Registrado: 18/12/05
Posts: 912
Reputação: +86
Gênero: Masculino
Char no Tibia: Kohzete
Pasta Enciclopedia com todos os links de outros tutoriais !
http://www.xtibia.com/forum/Pasta-Data-Enc...r-E-t99746.html
Prova I
São exercicios mais "legais" do que você ve na internet. A ideia base dessa dezena de tutoriais é vc virar um scripter
LUA não programador
Ela terá 12 questões sendo seis de criação de scripts em actions e seis de correção de erros. A ideia é tentar aprender com erros comuns, por isso não peço para enviarem por PM. Já que ficarei chato!
Dicas :
1 - Mesmo que não consiga tente fazer todo o tutorial.
2 - Leia todos meus tutoriais e se possivel outros. O importante é você aprender e não sua nota
3 - Faça com calma e não copie de ninguem.
Regras para quem for fazer :
1 - Poste todos os exercicios em spoiler de uma vez. Topicos editados não serão considerado como validos.
2 - Eu avaliarei o seu script através de sua "logica", erros pequenos serão tolerados.
3 - Se você achar minha correção errada (já que não sou perfeito) poderá reclamar via PM (não me xingue xD).
4 - Puxa saquismo não vale nota (quem sabe um deposito)
5 - A nota não valerá nada, apenas uma maneira de você saber como está indo em direção a programação.
6 - Peço que não copiem de outros usuarios ou a minha resposta. EM tese confiarei em todos. Não se faça de esperto
que depois poderá se dar mal.
7- As respostas só serão postadas futuramente. (haha!)
Usarei também scripts que normalmente me pedem via msn ou PM.
Criação de Scripts
1- Crie uma alavanca que faça essa ponte de 4 sqm abrir e fechar.
2- Essa quest é dividida em duas partes. Na primeira parte abrange a parte maior, ela deverá dar 4 itens diferentes (a sua escolha)
e o player poderá pegar apenas uma. Na sala menor, o player só poderá abrir a porta se for promotion e ter feito a primeira quest.
O item da segunda parte deverá ser uma bag com 100 crystal coin e um ring of the sky dentro. Todos os baus de quest devem checar se há capacidade no player.
3- Clube Dos sexos (sexos não sexo seu tarado!). Criar 2 salas. Na da esquerda apenas mulheres com o colar golden amulet (id 2130) no pescoço poderá entrar.
No direito apenas homens com o colar ancient amulet (id 2142) poderão entrar. Caso contrario não tem colar deverá mandar uma mensagem.
Caso não haja o sexo deverá aparecer uma frase de erro a gosto e do modo desejado.
4- Macumba do Pharao. Nesse script você deverá fazer o player colocar 4 frutas (uma em cada coal basin) e depois aperta a alavanca.
Se elas tiverem certas você habilita ele para abrir a porta de permissão. Para a alavanca funcionar, ele tem que ter level acima de 50.
No caso não prescisa fazer script da porta de permissão, já que há uma maneira de usa-la sem criar script que deverá ser explicada.
5 - Quest do inicio. Faça um bau :
6 - Modifique a fishing rod para pescar crocodilos com fish (qualquer 1), ele deverá ser sumonado na frente do player (a leste dele)
E um peixe deve ser removido. Caso isso aconteça ele não pescará junto um peixe normal.
Caso ele não tenha minhoca nem peixe ele pescará botas "podres" (não toda hora)
Parte II - Correçao de erros
Essa parte terá uma duvida o script e você terá que corrigir.
1 - Debug no tibia 8.4
Brincadeira xD. Normalmente é essas porcaria que postam nas sessão de duvida.
2 - Problema ao usar machete.
script
3 - Frase não é exibida inteira. O servidor exibe apenas you don't. Por que ?
4 - Para mim a sintaxe está certa, porém o servidor não teleporta o player. Mesmo ele tendo o storage
function onUse(cid, item, fromPosition, itemEx, toPosition) newnPosition = {x=1904, y=1006, z=8} if item.uid == 32194 and getPlayerStorageValue(cid,15005) == 8 then doTeleportThing(cid,newnposition) doSendMagicEffect(newnposition,10) else return 0 end return 1 end5 -
Script
--Function by Ta4e for Tibia 8.22-- --Uses grounds of RIkezinho action-- --Halloween,Cake and Bread systems like in tibia function onUse(cid, item, frompos, item2, topos) topos = {x=topos.x,y=topos.y,z=topos.z} --Bread and cakes-- if item.itemid == 2694 then if item2.itemid == 1381 or item2.itemid == 1382 or item2.itemid == 1383 or item2.itemid == 1384 then doRemoveItem(item.uid,1) doPlayerAddItem(cid,2692,1) elseif item.itemid == 2692 then if item2.itemid == 1775 or item2.itemid == 2005 then if item2.type == 1 then doChangeTypeItem(item2.uid,0) doTransformItem(item.uid,2693) elseif item2.type == 6 then doChangeTypeItem(item2.uid,0) doTransformItem(item.uid,6277) end end elseif item.itemid == 2693 then if item2.itemid == 1786 or item2.itemid == 1788 or item2.itemid == 1790 or item2.itemid == 1792 or item2.itemid == 6356 or item2.itemid == 6538 or item2.itemid == 6360 or item2.itemid == 6362 then doTransformItem(item.uid,2689) end elseif item.itemid == 6277 then if item2.itemid == 1786 or item2.itemid == 1788 or item2.itemid == 1790 or item2.itemid == 1792 or item2.itemid == 6356 or item2.itemid == 6338 or item2.itemid == 6360 or item2.itemid == 6362 then doRemoveItem(item.uid,1) doCreateItem(6278,1,topos) elseif item2.itemid == 6574 then doTransformItem(item.uid,8846) doRemoveItem(item2.uid,1) end elseif item.itemid == 8846 then if item2.itemid == 1786 or item2.itemid == 1788 or item2.itemid == 1790 or item2.itemid == 1792 or item2.itemid == 6356 or item2.itemid == 6538 or item2.itemid == 6360 or item2.itemid == 6362 then doTransformItem(item.uid,8847) end elseif item.itemid == 6280 then doTransformItem(item.uid,6279) doSendMagicEffect(topos,2) name = getPlayerName(cid) doCreatureSay (cid, name ..' blew out the candle.', TALKTYPE_ORANGE_1) --Pumpkins-- elseif item.itemid == 2566 then if item2.itemid == 2683 then doTransformItem(item2.uid,2096) end elseif item.itemid == 2096 then if item2.itemid == 2048 then doTransformItem(item.uid,2097) doRemoveItem(item2.uid,1) end end return 1 end6 - Corrigido o script acima remova funções duplicadas (aquelas que podem ser tiradas da condicional e do else)
Use arrays se possivel e melhore-o se possivel
Esse script tem a chamada notal pessoal e praticamente não tem certo e errado.
BOA SORTE!
Respostas serão postadas em no minimo 1 semana.
Editado Outubro 4 por tibiaa4e