pansuchar
Member
- Joined
- Dec 29, 2008
- Messages
- 68
- Reaction score
- 5
Hi all. I have mission npc :
The conversation ends when I tell him about the executed task, when I say xxx NPC does not respond, no errors appear in the console.
Please help me
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() 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
if(msgcontains(msg, 'quest')) then
selfSay('You can start from the {first mission}.', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'first mission')) then
if (getPlayerStorageValue(cid,210) > 0) then
selfSay('You have already done this mission.', cid)
elseif (getPlayerStorageValue(cid,210) < 0) then
selfSay('First mission is {xxx}.', cid)
talkState[talkUser] = 1
setPlayerStorageValue(cid,190,1)
elseif(msgcontains(msg, 'xxx') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,200) > 0) then
setPlayerStorageValue(cid,210,1)
selfSay('Okay, you can start {second mission}', cid)
else
selfSay('You must perform the task.', cid)
end
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'second mission')) then
if (getPlayerStorageValue(cid,211) > 0) then
selfSay('You have already done this mission.', cid)
elseif (getPlayerStorageValue(cid,210) < 0) then
selfSay('Complete previous mission.', cid)
elseif (getPlayerStorageValue(cid,211) < 0) then
selfSay('Second mission is {yyy}.', cid)
setPlayerStorageValue(cid,191,1)
talkState[talkUser] = 1
if(msgcontains(msg, 'yyy') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,201) > 0) then
setPlayerStorageValue(cid,211,1)
selfSay('Very good!.', cid)
else
selfSay('You must perform the task.', cid)
end
end
end
return true
end
---------------------------------------------------------
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
The conversation ends when I tell him about the executed task, when I say xxx NPC does not respond, no errors appear in the console.
Please help me