Postado Outubro 2, 2014 10 anos galera, to com um erro num npc que estou fazendo... pq num pedido ali ninguem me ajudou, to tentando me virar.... ele simplesmente não dá o item pro player e também nao fala os textos... quando eu falo yes pela segunda vez segue o script. 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 function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) if msgcontains(msg, "help") then if npcHandler.topic[cid] == 0 then npcHandler.topic[cid] = 1 npcHandler:say("Yeah yeah, you can help me actually. You know, I feel some bad vibes coming out of the earth, recently. I think there's something wrong with the creatures of the deep. Care to join me?", cid) else npcHandler:say('I don\'t know what you are talking about.', cid) end elseif msgcontains(msg, 'yes') then if npcHandler.topic[cid] == 1 then npcHandler.topic[cid] = 2 npcHandler:say({ 'Great, great. There is something going on, you know? I can feel it in my bones. There really are some bad spirits down there. ...', 'See, a long time ago I acquired these nets. They are called soul nets. Do you know what they can do? Neither do I. ...', 'What I know is they vibrate when evil is near. Yeah, vibration man. ...', 'They also let evil glow in a deep red. Glowing red stuff. So next time you go down there, just take one with you and when you find evil spirits - catch them with the net. ...', 'They will vanish in an instant. But - you will have to take care that all bad spirits in the near vicinity vanish almost instantaneously or they will regenerate. ...', 'So you might need some help down there, my friend. Ready to do this?' }, cid) end elseif msgcontains(msg, 'yes') then if npcHandler.topic[cid] == 2 then player:setStorageValue(15433, 1) player:addItem(15433, 1) npcHandler:say("Good, I hope this will help you keeping the spirits away.", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:setMessage(MESSAGE_GREET, "Hi there |PLAYERNAME|, and welcome to the gray island.") npcHandler:setMessage(MESSAGE_FAREWELL, "See you, |PLAYERNAME|.") npcHandler:setMessage(MESSAGE_WALKAWAY, "See you, |PLAYERNAME|.") npcHandler:addModule(FocusModule:new())
Postado Outubro 2, 2014 10 anos Solução 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 function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) if msgcontains(msg, "help") then if npcHandler.topic[cid] == 0 then npcHandler.topic[cid] = 1 npcHandler:say("Yeah yeah, you can help me actually. You know, I feel some bad vibes coming out of the earth, recently. I think there's something wrong with the creatures of the deep. Care to join me?", cid) else npcHandler:say('I don\'t know what you are talking about.', cid) end elseif msgcontains(msg, 'yes') then if npcHandler.topic[cid] == 1 then npcHandler.topic[cid] = 2 npcHandler:say({ 'Great, great. There is something going on, you know? I can feel it in my bones. There really are some bad spirits down there. ...', 'See, a long time ago I acquired these nets. They are called soul nets. Do you know what they can do? Neither do I. ...', 'What I know is they vibrate when evil is near. Yeah, vibration man. ...', 'They also let evil glow in a deep red. Glowing red stuff. So next time you go down there, just take one with you and when you find evil spirits - catch them with the net. ...', 'They will vanish in an instant. But - you will have to take care that all bad spirits in the near vicinity vanish almost instantaneously or they will regenerate. ...', 'So you might need some help down there, my friend. Ready to do this?' }, cid) elseif npcHandler.topic[cid] == 2 and player:getStorageValue(15433) ~= 1 then player:setStorageValue(15433, 1) player:addItem(15433, 1) npcHandler:say("Good, I hope this will help you keeping the spirits away.", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:setMessage(MESSAGE_GREET, "Hi there |PLAYERNAME|, and welcome to the gray island.") npcHandler:setMessage(MESSAGE_FAREWELL, "See you, |PLAYERNAME|.") npcHandler:setMessage(MESSAGE_WALKAWAY, "See you, |PLAYERNAME|.") npcHandler:addModule(FocusModule:new()) Você tinha dois elseifs iguais, então o segundo nunca era checado na prática.
Postado Outubro 2, 2014 10 anos Autor se tu quiser, eu marquei a opção melhor resposta, mas não foi, agora foi, você quem sabe em
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.