OldXar
Member
- Joined
- Feb 17, 2009
- Messages
- 215
- Reaction score
- 6
Hey all,
I'm trying to make a quest Npc but .Lua ain't my strongest side,...
However I would like to learn what I'm doing wrong.
This script isn't complete, I didn't add a reward yet, etc,.. but at this point I'm just testing.
My issue, while saying "quest" my npc doesn't seem to react and I have no clue why.
Any ideas what the problem might be ?
Kind regards,
I'm trying to make a quest Npc but .Lua ain't my strongest side,...
However I would like to learn what I'm doing wrong.
This script isn't complete, I didn't add a reward yet, etc,.. but at this point I'm just testing.
My issue, while saying "quest" my npc doesn't seem to react and I have no clue why.
Any ideas what the problem might be ?
Code:
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
npcHandler:addModule(FocusModule:new())
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
elseif msgcontains(msg, 'quest') then
npcHandler:say('Did you find my diary ?', cid)
if msgcontains(msg, 'yes') then
doPlayerRemoveItem(cid, 1961)
npcHandler:say('Thank you, Ive been looking for that book for ages now,...', cid)
end
elseif msgcontains(msg, 'no') then
npcHandler:say('Ok, no reward for you then,...', cid)
return false
end
end
Kind regards,