cariocaenois 0 Postado Fevereiro 15, 2011 Share Postado Fevereiro 15, 2011 Boa tarde! Estou eu aqui de novo para pedir mais um script(ot 8.60 thhyrania) Seguinte: Estou fazendo uma quest complicada, e quero um script de um npc mendigo, mas um antigo sábio da ilha: Player:hi NPC:Olá, (nome do player). O que queres com um pobre e velho mendigo como eu? Se quiseres me ajudar, diga {help}. Player:help NPC:Se me ajudares, poderei ajudar-te também com uma valiosa dica. Apenas traga-me minha velha {staff}. Player:staff NPC:Trouxeste minha staff? Player:yes NPC:Muito obrigado! Pegue este papel e leia-o com atencao. Ele podera ajudar muito. (neste momento ele daria um paper comum id[1954] com o seguinte texto escrito nele:"Certas vezes, uma espada que voce acha muito forte pode te levar a uma com poder infinitamente mais forte.") ou então Player:no NPC:Que pena, nao queres a dica. Se mudar de ideia, volte. Player:bye NPC:Adeus, viajante. Se quiseres falar comigo, sabe onde estarei. É só isso, acho que não é tão difícil. Muito obrigado. Link para o comentário https://xtibia.com/forum/topic/151699-ajuda-com-npc-de-troca/ Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Fevereiro 15, 2011 Share Postado Fevereiro 15, 2011 npc: 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 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 storage,itemid = 98754,1954 if(msgcontains(msg, 'help') or msgcontains(msg, 'HELP')) then selfSay('Se me ajudares,poderei ajudar-te também com uma valiosa dica.Apenas traga-me minha velha... {staff}', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'staff') and talkState[talkUser] == 1 then selfSay('Trouxeste minha staff? {yes}', cid) talkState[talkUser] = 3 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then if getPlayerStorageValue(cid, storage) <= 0 then doPlayerAddItem(cid,itemid,1) selfSay('Muito obrigado,pegue este papel e leia o com atencao,ele poderá ajudar muito!', cid) setPlayerStorageValue(cid,storage, 1) talkState[talkUser] = 0 else selfSay('Eu já lhe entreguei o papel com a dica!', cid) talkState[talkUser] = 0 end elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("Que pena, nao queres a dica. Se mudar de ideia volte!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) actions nome do seu script.lua function onUse(cid, item, fromPos, itemEx, toPos) local text = "Certas vezes, uma espada que voce acha muito forte pode te levar a uma com poder infinitamente mais forte" return doShowTextDialog(cid, item.itemid, text) end actions.xml <action itemid="1954" script="nome do seu script.lua" /> Link para o comentário https://xtibia.com/forum/topic/151699-ajuda-com-npc-de-troca/#findComment-1002068 Compartilhar em outros sites More sharing options...
Posts Recomendados