Postado Janeiro 8, 2015 10 anos Me ajudem a revisar está script, tirar errors e tals.. colocar funfando.. ERROR ; [08/01/2015 21:42:37] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/reborn.lua [08/01/2015 21:42:37] data/npc/scripts/reborn.lua:19: unexpected symbol near '=' TEM MAIS ALGUNS ERRORS, MAIS ACONTECE ISSO QUANDO EU TENTO SUMONAR ELE local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local Vocations = { --Goku [69] = {NewVoc = 12} -- [Vocation atual] = {Nova vocation} [12] = {NewVoc = 32} } local newlevel = 1 -- level após reset local newexp = 1 -- nova experiencia após reset local tmp = Vocations[getPlayerVocation(cid)] local Level = 200 --LvL para rb local playerid = getPlayerGUID(cid) if msgcontains(msg, "reborn") then selfSay("Voce tem certeza disso?", cid) talkState[talkUser] = 2 end if msgcontains(msg, "yes") and talkState[talkUser] = 2 then if not tmp then selfSay("Sua vocação não esta configurada, avise o ADM.", cid) return true end if getPlayerLevel(cid) >= Level then setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 20000) doCreatureAddHealth(cid, getCreatureMaxHealth(cid) + 20000) setCreatureMaxMana(cid, getCreatureMaxHealth(cid) + 20000) doCreatureAddMana(cid, getCreatureMaxHealth(cid) + 20000) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doPlayerSetVocation(cid, tmp.NewVoc) doRemoveCreature(cid) db.query("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."") else selfSay("Voce precisa ter level "..Level.." para rebornar.", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Janeiro 8, 2015 10 anos por arthurabreu (veja o histórico de edições) I helped you ? REP +. Att: Abreu
Postado Janeiro 8, 2015 10 anos Tá dando algum erro? Se sim, informe pra agilizar o processo. Te ajudei?? REP + e ficamos quites... http://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'> Atenciosamente, Daniel. Abraços! Meus tutoriais: Programação: Resolvendo QUALQUER erro na data base. Scripts (system's, creaturescripts, mod's, NPC's, etc): (Sistema) GOD Ambient Light Full. Adicionando novas mounts ao servidor [NPC] Papai Noel que dá presente todo ano. Web-site: Resolvendo problema de caracteres especiais em PHP Formatando textos em PHP! Mudando a cor, tamanho, fonte, etc. Criando e configurando tabelas para paginas PHP
Postado Janeiro 8, 2015 10 anos Autor Tá dando algum erro? Se sim, informe pra agilizar o processo. Sim, exemplo; nessa tag o da error na distro.. o error que aparenta ser é os { {3} = {NewVoc = 12} ja tentei trokar por [ mais sem sucesso NOVO ERROR: [08/01/2015 21:42:37] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/reborn.lua [08/01/2015 21:42:37] data/npc/scripts/reborn.lua:19: unexpected symbol near '=' Editado Janeiro 8, 2015 10 anos por arthurabreu (veja o histórico de edições) I helped you ? REP +. Att: Abreu
Postado Janeiro 9, 2015 10 anos vc esqueceu de colocar uma virgula indicando que há outro elemento na tabela na linha 19. local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local Vocations = { --Goku [69] = {NewVoc = 12}, -- [Vocation atual] = {Nova vocation} [12] = {NewVoc = 32} } local newlevel = 1 -- level após reset local newexp = 1 -- nova experiencia após reset local tmp = Vocations[getPlayerVocation(cid)] local Level = 200 --LvL para rb local playerid = getPlayerGUID(cid) if msgcontains(msg, "reborn") then selfSay("Voce tem certeza disso?", cid) talkState[talkUser] = 2 end if msgcontains(msg, "yes") and talkState[talkUser] = 2 then if not tmp then selfSay("Sua vocação não esta configurada, avise o ADM.", cid) return true end if getPlayerLevel(cid) >= Level then setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 20000) doCreatureAddHealth(cid, getCreatureMaxHealth(cid) + 20000) setCreatureMaxMana(cid, getCreatureMaxHealth(cid) + 20000) doCreatureAddMana(cid, getCreatureMaxHealth(cid) + 20000) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doPlayerSetVocation(cid, tmp.NewVoc) doRemoveCreature(cid) db.query("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."") else selfSay("Voce precisa ter level "..Level.." para rebornar.", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá! "Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda (obg ao @Beeny por fazer essa linda sign <3)
Postado Janeiro 9, 2015 10 anos Autor vc esqueceu de colocar uma virgula indicando que há outro elemento na tabela na linha 19. local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local Vocations = { --Goku [69] = {NewVoc = 12}, -- [Vocation atual] = {Nova vocation} [12] = {NewVoc = 32} } local newlevel = 1 -- level após reset local newexp = 1 -- nova experiencia após reset local tmp = Vocations[getPlayerVocation(cid)] local Level = 200 --LvL para rb local playerid = getPlayerGUID(cid) if msgcontains(msg, "reborn") then selfSay("Voce tem certeza disso?", cid) talkState[talkUser] = 2 end if msgcontains(msg, "yes") and talkState[talkUser] = 2 then if not tmp then selfSay("Sua vocação não esta configurada, avise o ADM.", cid) return true end if getPlayerLevel(cid) >= Level then setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 20000) doCreatureAddHealth(cid, getCreatureMaxHealth(cid) + 20000) setCreatureMaxMana(cid, getCreatureMaxHealth(cid) + 20000) doCreatureAddMana(cid, getCreatureMaxHealth(cid) + 20000) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doPlayerSetVocation(cid, tmp.NewVoc) doRemoveCreature(cid) db.query("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."") else selfSay("Voce precisa ter level "..Level.." para rebornar.", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Agora está dando esse erro [08/01/2015 22:15:01] [Error - Npc interface] [08/01/2015 22:15:01] (Unknown script file) [08/01/2015 22:15:01] Description: [08/01/2015 22:15:01] attempt to call a nil value [08/01/2015 22:15:01] stack traceback: Seria pedir de mais eu pedir pra alguem fazer um NPC que Reseta, da uma nova vocação, uma nova outfit e da 20k de life e mana a + MaxHealth tb VERSÃO 8.54 Editado Janeiro 9, 2015 10 anos por arthurabreu (veja o histórico de edições) I helped you ? REP +. Att: Abreu
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.