Postado Janeiro 21, 2018 7 anos Estou aprendendo a construir npc de missão, mas estou tendo problemas com o NPC 2 e 3, eles não respondem ao 'sim'. Alguém pode me ajudar? Desde já, obrigado. Eles estão relacionados: O NPC 1 diz para trazer coisas do NPC 2. E o NPC 2 diz que para fazer isso, precisa de itens do NPC3. NPC 1: Spoiler 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 storage = 135001 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower(); local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msg == "catacounbs" then if getPlayerStorageValue(cid, storage) == -1 then selfSay("Hello! I think you are here to get acess to the entrance of The Catacounbs, right?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, storage) == 5 then selfSay("Did you bring me the itens?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, storage) == 6 then selfSay("Thanks for the help.", cid) else selfSay("Something is missing.", cid) end npcHandler:addFocus(cid) else return false end if msgcontains(msg, "yes") and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, storage) == -1 then selfSay("For I give you the acess you need to make me a favor. Go to Nico and tell him that I want the {stuffs}. He'll know what is.", cid) setPlayerStorageValue(cid, storage, 1) elseif getPlayerStorageValue(cid, storage) == 5 then if doPlayerRemoveItem(cid, 2796, 1) then selfSay("Well, now you can pass the door.", cid) doPlayerAddItem(cid, 2160, 3) doPlayerAddExp(cid, 5000) setPlayerStorageValue(cid, storage, 6) else selfSay("You don't have it.", cid) end else selfSay("I think you've not talk with Nico yet", cid) end talkState[talkUser] = 0 elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then selfSay("Ok then.", cid) talkState[talkUser] = 0 elseif msgcontains(msg, "bye") then selfSay("Bye.", cid) npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) NPC 2: Spoiler 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 storage = 135001 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower(); local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msg == "stuffs" then if getPlayerStorageValue(cid, storage) == -1 then selfSay("What you mean?", cid) elseif getPlayerStorageValue(cid, storage) == 1 then selfSay("I think you come here for Tery. Well, to do what him want I need that you go to Lian and bring me some {mix herbs}, can you do it?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, storage) == 4 then selfSay("Did you bring the mix herbs?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, storage) == 5 then selfSay("Already done.", cid) else selfSay("Something is missing.", cid) end npcHandler:addFocus(cid) else return false end if msgcontains(msg, "yes") and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, storage) == 1 then selfSay("So be it. Come back when you have it.", cid) setPlayerStorageValue(cid, storage, 2) elseif getPlayerStorageValue(cid, storage) == 4 then if doPlayerRemoveItem(cid, 2801, 1) then selfSay("Here are. Tell Tery to come visit me at any time.", cid) doPlayerAddItem(cid, 2796, 1) setPlayerStorageValue(cid, storage, 5) else selfSay("You don't have it.", cid) end else selfSay("I think you've not talk with Lian yet", cid) end talkState[talkUser] = 0 elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then selfSay("Ok then.", cid) talkState[talkUser] = 0 elseif msgcontains(msg, "bye") then selfSay("Bye.", cid) npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) NPC 3: Spoiler 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 storage = 135001 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower(); local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msg == "mix herbs" then if getPlayerStorageValue(cid, storage) <= 1 then selfSay("What do you mean by that?", cid) elseif getPlayerStorageValue(cid, storage) == 2 then selfSay("Hm...Ok then. Back with one of each item below: blood herb, stone herb, star herb, sling herb, powder herb and shadow herb. Ok?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, storage) == 3 then selfSay("You bring the herbs?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, storage) == 6 then selfSay("I already gave it to you. Have you memory loss?", cid) else selfSay("Something is missing.", cid) end npcHandler:addFocus(cid) else return false end if msgcontains(msg, "yes") and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, storage) == 2 then selfSay("Ok, come back when you have it.", cid) setPlayerStorageValue(cid, storage, 3) elseif getPlayerStorageValue(cid, storage) == 3 then if doPlayerRemoveItem(cid, 2798, 1) and doPlayerRemoveItem(cid, 2799, 1) and doPlayerRemoveItem(cid, 2800, 1) and doPlayerRemoveItem(cid, 2802, 1) and doPlayerRemoveItem(cid, 2803, 1) and doPlayerRemoveItem(cid, 2804, 1) then selfSay("So done. Here are the mix herb", cid) doPlayerAddItem(cid, 2801, 1) setPlayerStorageValue(cid, storage, 4) else selfSay("You don't have it.", cid) end end talkState[talkUser] = 0 elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then selfSay("Ok then.", cid) talkState[talkUser] = 0 elseif msgcontains(msg, "bye") then selfSay("Bye.", cid) npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Janeiro 21, 2018 7 anos Rapais fiz uma cambiarra louca aqui vê se funfa ai. NPC 1: 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 storage = 135001 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower(); local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msg == "catacounbs" then if getPlayerStorageValue(cid, storage) == -1 then selfSay("Hello! I think you are here to get acess to the entrance of The Catacounbs, right?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, storage) == 5 then selfSay("Did you bring me the itens?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, storage) == 6 then selfSay("Thanks for the help.", cid) else selfSay("Something is missing.", cid) end npcHandler:addFocus(cid) elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, storage) == -1 then selfSay("For I give you the acess you need to make me a favor. Go to Nico and tell him that I want the {stuffs}. He'll know what is.", cid) setPlayerStorageValue(cid, storage, 1) elseif getPlayerStorageValue(cid, storage) == 5 then if doPlayerRemoveItem(cid, 2796, 1) then selfSay("Well, now you can pass the door.", cid) doPlayerAddItem(cid, 2160, 3) doPlayerAddExp(cid, 5000) setPlayerStorageValue(cid, storage, 6) else selfSay("You don't have it.", cid) end else selfSay("I think you've not talk with Nico yet", cid) end talkState[talkUser] = 0 elseif msg == "no" or msg == "nao" or msg == "n" and talkState[talkUser] >= 0 then npcHandler:say("Ok then.", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) elseif msgcontains(msg, "bye") then npcHandler:say("bye.", cid) npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) NPC 2: 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 storage = 135001 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower(); local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msg == "stuffs" then if getPlayerStorageValue(cid, storage) == -1 then selfSay("What you mean?", cid) elseif getPlayerStorageValue(cid, storage) == 1 then selfSay("I think you come here for Tery. Well, to do what him want I need that you go to Lian and bring me some {mix herbs}, can you do it?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, storage) == 4 then selfSay("Did you bring the mix herbs?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, storage) == 5 then selfSay("Already done.", cid) else selfSay("Something is missing.", cid) end npcHandler:addFocus(cid) elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, storage) == 1 then selfSay("So be it. Come back when you have it.", cid) setPlayerStorageValue(cid, storage, 2) elseif getPlayerStorageValue(cid, storage) == 4 then if doPlayerRemoveItem(cid, 2801, 1) then selfSay("Here are. Tell Tery to come visit me at any time.", cid) doPlayerAddItem(cid, 2796, 1) setPlayerStorageValue(cid, storage, 5) else selfSay("You don't have it.", cid) end else selfSay("I think you've not talk with Lian yet", cid) end talkState[talkUser] = 0 elseif msg == "no" or msg == "nao" or msg == "n" and talkState[talkUser] >= 0 then npcHandler:say("Ok then.", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) elseif msgcontains(msg, "bye") then npcHandler:say("bye.", cid) npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) NPC 3: 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 storage = 135001 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower(); local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msg == "mix herbs" then if getPlayerStorageValue(cid, storage) <= 1 then selfSay("What do you mean by that?", cid) elseif getPlayerStorageValue(cid, storage) == 2 then selfSay("Hm...Ok then. Back with one of each item below: blood herb, stone herb, star herb, sling herb, powder herb and shadow herb. Ok?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, storage) == 3 then selfSay("You bring the herbs?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, storage) == 6 then selfSay("I already gave it to you. Have you memory loss?", cid) else selfSay("Something is missing.", cid) end npcHandler:addFocus(cid) elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, storage) == 2 then selfSay("Ok, come back when you have it.", cid) setPlayerStorageValue(cid, storage, 3) elseif getPlayerStorageValue(cid, storage) == 3 then if doPlayerRemoveItem(cid, 2798, 1) and doPlayerRemoveItem(cid, 2799, 1) and doPlayerRemoveItem(cid, 2800, 1) and doPlayerRemoveItem(cid, 2802, 1) and doPlayerRemoveItem(cid, 2803, 1) and doPlayerRemoveItem(cid, 2804, 1) then selfSay("So done. Here are the mix herb", cid) doPlayerAddItem(cid, 2801, 1) setPlayerStorageValue(cid, storage, 4) else selfSay("You don't have it.", cid) end else selfSay("I think you've not talk with Lian yet", cid) end talkState[talkUser] = 0 elseif msg == "no" or msg == "nao" or msg == "n" and talkState[talkUser] >= 0 then npcHandler:say("Ok then.", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) elseif msgcontains(msg, "bye") then npcHandler:say("bye.", cid) npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Perdão mas não sei deixar as paradas ocultas.
Postado Janeiro 23, 2018 7 anos Autor Em 21/01/2018 em 17:34, Roy disse: Rapais fiz uma cambiarra louca aqui vê se funfa ai. Eu não testei a script pois já consegui resolver o problema, mas te reputarei mesmo assim pela iniciativa de ajuda.
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.