I made a exchange npc but i want it to give a bag with items but when i tried the npc disapeared.
Anyone can help me fix it?
Here is epic.lua :
Anyone can help me fix it?
Here is epic.lua :
Code:
local talk_state = 0
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 msgcontains(msg, 'epic') then
if getPlayerItemCount(cid,2089,1) then
if doPlayerRemoveItem(cid,2089,1) == 1 then
selfSay('Here is your rewards! .')
doPlayerAddItem(cid,1987,1)
<inside>
<item id="7418"/>
<item id="7433"/>
<item id="6534"/>
<item id="7424"/>
<item id="2184"/>
<item id="7431"/>
</inside>
end
else
selfSay('I am sorry then!. ')
talk_state = 0
end
elseif msgcontains(msg, 'no') then
selfSay('Ok.. Good bye then!!')
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())