Postado Setembro 24, 2015 9 anos Olá pessoal, gostaria de pedir a ajuda de vocês em relação a um NPC de meu servidor. É o seguinte: tenho um NPC que é a mistura do Nah'Bob (Blue Djinn) com o Alesar (Green Djinn) e esse npc se chama Nahlesar... A outfit dele fica trocando entre a green e blue djinn, só que está sem delay nenhum, tipo, fica trocando freneticamente entre a 51 e 80 (id das outfits dos djinns). Teria como adicionar um delay de 1 segundo ou algo do tipo? Segue o Nahlesar.lua: 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 function onThink() local npc = getNpcCid() if (getCreatureOutfit(npc).lookType == 80) then doCreatureChangeOutfit(npc, {lookType = 51}) else doCreatureChangeOutfit(npc, {lookType = 80}) end npcHandler:onThink() end npcHandler:addModule(FocusModule:new()) Rep+ pra quem ajudar @UP @UP
Postado Setembro 28, 2015 9 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 interval = 2 -- in seconds function onThink() local npc = getNpcCid() addEvent(function() if isCreature(npc) then doCreatureChangeOutfit(npc, {lookType = (getCreatureOutfit(npc).lookType == 80 and 51 or 80)}) end end, interval*1000) npcHandler:onThink() end npcHandler:addModule(FocusModule:new()) O intervalo está em dois segundos, altere em interval. _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
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.