Postado Março 5, 2014 11 anos Npc .xml: <?xml version="1.0" encoding="UTF-8"?> <npc name="Npc Quest" script="data/npc/scripts/nomedoseuarquivo.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="133" head="114" body="114" legs="78" feet="114" addons="0"/> <parameters> <parameter key="message_greet" value="Olá.. Oh sim... Então deseja que eu te leve até a quest?"/> </parameters> </npc> Npc .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 creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local config = { iditem = 0000, quant = 0, pos = {x= 0, y= 1, z= 2} } if (msgcontains(msg, 'yes')) then if getPlayerItemCount(cid, config.iditem) < config.quant then selfSay('Eu preciso de '..config.quant.. ' '..getItemNameById(config.iditem)..' pra te levar até lá.') else doTeleportThing(cid, config.pos) doPlayerRemoveItem(cid, config.iditem, config.quant) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) local config = { iditem = 0000, ---- Item ID. quant = 0, ---- Quantidade. pos = {x= 0, y= 1, z= 2} ---- Posição pra onde o player será levado. } Editado Março 5, 2014 11 anos por Nogard (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.