Eu quero um npc que troca 2 items por 1.
Fechem eu cliquei 2x sem querer.
e desculpe pelo flood é que nao consigo editar.
Eu quero um npc que troca 2 items por 1.
Fechem eu cliquei 2x sem querer.
e desculpe pelo flood é que nao consigo editar.
Vê se assim pega..
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
if msgcontains(msg, 'help') then
selfSay('You can here change some items for "spider silk yarn", "chunk of crude iron", "draconian steel", "warrior sweat", "magic sulpher", "enchanted chicken wing", "royal steel", "hell steel", "engraved crossbow", "fighting spirit", "infernal bolt", "blue piece of cloth", "green piece of cloth", "red piece of cloth", "lottery ticket".', cid)
elseif msgcontains(msg, 'spider silk yarn') then
if getPlayerItemCount(cid,5879) >= 10 then
if getPlayerItemCount(cid,5879) >= 10 then
selfSay('Did you bring me the 10 Giant Silks ?', cid)
talk_state = 1
else
selfSay('I need a 10 Giant Spider Silks, to give you the spider silk yarn. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,5879) >= 10 then
if doPlayerRemoveItem(cid,5879, 10) == TRUE then
if doPlayerRemoveItem(cid,5879, 10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 5886, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok than.')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Negrito é o id dos items que ele deve ter para trocar..
Obs: não sei se funciona, teste ai..
Não pareceu sem querer.. você mudou até o smile do tópico..
sem mais.
Atenciosamente, Vilden.