Aqui esta meu amigo, caso você queria que o player troque apenas uma vez com o npc só me falar:
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 if(msgcontains(msg, 'change')) then selfSay('Yes, i am exchanging fragments of mega stone for a mega stone! Do you want to change?') talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(doPlayerRemoveItem(cid, 20719, 130)) then doPlayerAddItem(cid, 14252, 1) selfSay('Here your mega stone, thank you for your fragments!') else selfSay('Sorry, but you do not have the 130 fragments you need to trade!') end end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
.xml do npc:
<?xml version="1.0" encoding="UTF-8"?> <npc name="Julie" script="Julie.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="511" head="9" body="1" legs="1" feet="0" addons="0"/> <parameters> <parameter key="message_greet" value="Mega stones? I change!" /> </parameters> </npc>



info
Grupo: Campones
Registrado: 09/06/17
Posts: 3
Reputação: 0
Gênero: Masculino
Pessoal, alguém poderia deixar um script De um npc que troque X item por outro
Gostaria de um npc que pegasse 130 Fragment of Mega Stone (20719)
Por 1 Mega stone (14252)
Se alguem puder me ajudar agradeço