Postado Novembro 15, 2018 6 anos Diga em poucas palavras a base utilizada (Nome do servidor ou nome do website). OTXServer 3.1 Based on TFS 1.3 (By Malucoo) Base: TFS 1.3 Qual erro está surgindo/O que você procura? can not load script: Tutorial_NPCS/Ariana.lua 'end' expected <to close 'if' at line 44> near '<eof>' Você tem o código disponível? Se tiver publique-o aqui: 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 local voices = { { text = 'Evil little beasts... I hope someone helps me fight them.' }, { text = 'Nasty creepy crawlies!' }, { text = 'Hey! You over there, could you help me with a little quest? Just say \'hi\' to talk to me!' }, { text = 'Don\'t be shy, can\'t hurt to greet me with \'hi\'!' } } npcHandler:addModule(VoiceModule:new(voices)) function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, "new") then selfSay("Yes... Smells like new, like the all of the new adventurers than come of north looks like. Hey, Tell me a thing, you are interested in make me a favor? Tell me {yes} or {no}", cid) talkState[TalkUser] = 1 else if msgcontains(msg, "yes") and talkState[talkUser] == 1 then selfSay("Oh, Great! So.. I have an infestation of cockroaches under my house, right there, down the stairs...", cid) selfSay("*Cooff Coff..* I need you to eliminate the cockroaches and bring me your legs... I need those little things to make a good soup recipe I learned recently...", cid) selfSay("You do not seem to be ready to deal with those disgusting things. So take it here, I'll give you a coat and a club. When ready, go down the indicated stairs and kill them.", cid) selfSay("When you get the three legs, come back here and say {complete} to me.", cid) SetPlayerStorageValue(cid, 1001, 1) doPlayerAddItem(cid, 2651, 1) doPlayerAddItem(cid, 2382, 1) Position(880, 1051, 7):sendMagicEffect(CONST_ME_TUTORIALARROW) elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then selfSay("Ok then.. Maybe later! ", cid) npcHandler:releaseFocus(cid) npcHandler:resetNpc(cid) talkState[talkUser] = 0 if msg == "complete" and GetPlayerStorageValue(cid, 1001) == 1 then if getPlayerItemCount(cid,8710) >= 3 then doPlayerRemoveItem(cid,8710, 3) selfSay("Yeah! thank you for helping me! My soup will be tasty! ", cid) selfSay("For that, I'll grant you 100 experience points! Oh - what was that? I think you advanced a level! Congratulations!", cid) selfSay("If you want to continue your adventure continue following this path. With luck you should find Brul, he is a hunter who has lived here for a long time! See if he needs anything. Maybe he does not have something to offer you!", cid) player:addExperience(100, true) player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS) SetPlayerStorageValue(cid, 1001, 2) else if msg == "complete" and GetPlayerStorageValue(cid, 1001) == 1 then if GetPlayerItemCount(cid, 8710) < 3 then selfSay("You have no cheap leg. Are you sure you killed them and opened their bodies?", cid) selfSay("Click with the right button of your mouse above the dead body and click with left button on the \'Open\' option, when the loot appears, drag the items into your bag.", cid) SelfSay("Keep trying!", cid) npcHandler:releaseFocus(cid) npcHandler:resetNpc(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Novembro 16, 2018 6 anos local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 local voices = { { text = 'Evil little beasts... I hope someone helps me fight them.' }, { text = 'Nasty creepy crawlies!' }, { text = 'Hey! You over there, could you help me with a little quest? Just say \'hi\' to talk to me!' }, { text = 'Don\'t be shy, can\'t hurt to greet me with \'hi\'!' } } npcHandler:addModule(VoiceModule:new(voices)) local function releasePlayer(cid) if not Player(cid) then return end npcHandler:releaseFocus(cid) npcHandler:resetNpc(cid) end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) if msgcontains(msg, "new") then selfSay("Yes... Smells like new, like the all of the new adventurers than come of north looks like. Hey, Tell me a thing, you are interested in make me a favor? Tell me {yes} or {no}", cid) npcHandler.topic[cid] = 1 else if msgcontains(msg, "yes") and npcHandler.topic[cid] == 1 then selfSay("Oh, Great! So.. I have an infestation of cockroaches under my house, right there, down the stairs...", cid) selfSay("*Cooff Coff..* I need you to eliminate the cockroaches and bring me your legs... I need those little things to make a good soup recipe I learned recently...", cid) selfSay("You do not seem to be ready to deal with those disgusting things. So take it here, I'll give you a coat and a club. When ready, go down the indicated stairs and kill them.", cid) selfSay("When you get the three legs, come back here and say {complete} to me.", cid) player:setStorageValue(1001, 1) player:addItem(2651, 1) player:addItem(2382, 1) Position(880, 1051, 7):sendMagicEffect(CONST_ME_TUTORIALARROW) elseif msgcontains(msg, "no") and npcHandler.topic[cid] == 1 then selfSay("Ok then.. Maybe later! ", cid) releasePlayer(cid) end if msgcontains(msg, "complete") and player:getStorageValue(1001, 1) then if player:removeItem(8710, 3) then selfSay("Yeah! thank you for helping me! My soup will be tasty! ", cid) selfSay("For that, I'll grant you 100 experience points! Oh - what was that? I think you advanced a level! Congratulations!", cid) selfSay("If you want to continue your adventure continue following this path. With luck you should find Brul, he is a hunter who has lived here for a long time! See if he needs anything. Maybe he does not have something to offer you!", cid) player:addExperience(100, true) player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS) player:setStorageValue(1001, 2) else selfSay("You have no cheap leg. Are you sure you killed them and opened their bodies?", cid) selfSay("Click with the right button of your mouse above the dead body and click with left button on the \'Open\' option, when the loot appears, drag the items into your bag.", cid) SelfSay("Keep trying!", cid) npcHandler:releaseFocus(cid) npcHandler:resetNpc(cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Novembro 16, 2018 6 anos Autor 15 horas atrás, FlavioHulk disse: Usei este código e analisei-o para ver o que eu tinha feito de errado, e ví que você ajustou bastante coisa! Faltava só fechar a função com um end e eu fiz isto. Só uma pergunta, e caso eu quisesse guardar que este NPC já falou com o jogador e ele comprimentasse ele de uma forma diferente, tem como? Por que o que eu estou tentando fazer é um NPC de um tutorial similar ao Santiago da Tutorial Island que tinha no tibia antigo.. Então ele vem, concorda que quer ajudar, ele manda você matar algumas baratas e trazer as pernas delas, você traz e ela te upa pro level 2 e manda você procurar outro NPC (que já fiz). Só queria que o NPC te comprimentasse diferente caso você falasse com ele já com a missão pra que não possa ficar repetindo e atualizando o QuestLog (bugando tudo) e caso você já tenha feito ele diz que já foi feito. Eu usei alguns if's e criei condições verificando o Storage da missão no valor final mas não consegui, ele buga e independente de estar com a missão ou não, ele agradece e diz que você já completou. Editado Novembro 16, 2018 6 anos por zNexus (veja o histórico de edições)
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.