Rexanilator
New Member
- Joined
- Oct 3, 2009
- Messages
- 297
- Reaction score
- 2
I have been working on a npc that trades the 6 parts of jester doll for a jester doll the only issue I dont understand is how to make the npc take the 6 parts of jester doll I have tried a lot of stuff that I thought would work but none of them did so I decided to post here
and ofc Rep +++ to who helps
Code:
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 cycmsg = 'Enjoy your new Jester Doll!'
local noimsg = 'You don't have the necessary items to get your Jester Doll!'
local deny = 'Come back when you want a cool looking doll of me!'
--------------------MESSAGES------------------------------------------------------------------------------
if msgcontains(msg, 'help') or msgcontains(msg, 'trade') then
selfSay('I can trade the 6 jester parts for a cool looking jester doll.', cid)
elseif msgcontains(msg, 'jester doll') then
selfSay('If you want a jester doll you must have the 6 parts of it with you? Do you want to trade for a awesome jester doll?', cid)
talkState[talkUser] = 1
-------------GETTING JESTER DOLL FROM HIM-------------------
-- Jester Doll
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'yes') then
doPlayerRemoveItem(cid, (9694,1) (9695,1) (9696,1) (9697,1) (9698,1) (9699,1))
doPlayerAddItem(cid,9693,1)
selfSay(cycmsg, cid)
talkState[talkUser] = 0
else
selfSay(noimsg, cid)
end
else
selfSay(deny, cid)
end
talkState[talkUser] = 0
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
and ofc Rep +++ to who helps