Hi, I'm having trouble trying to get an npc script to work,
when i say for example "mission", he says "NO? Well, I knew you didn\'t had the guts anyway!" when he should say "So you have come this far, have you? ...', 'Still, the biggest challenge lies before you. ...', 'Are you ready for the hardest fight of your life?"
I'm not assigning any storagevalue cuz it will not be possible to visit this NPC again after done the quest
this is the script
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, "mission") or msgcontains(msg, "wrath") or msgcontains(msg, "emperor") or msgcontains(msg, "quest") then
npcHandler:say({'So you have come this far, have you? ...', 'Still, the biggest challenge lies before you. ...', 'Are you ready for the hardest fight of your life?'}, cid)
if msgcontains(msg, "yes") then
npcHandler:say({'So be it!'}, cid)
doSummonCreature("Snake God Essence", {x=33066, y=31153, z=15})
else
npcHandler:say({'NO? Well, I knew you didn\'t had the guts anyway!'}, cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
when i say for example "mission", he says "NO? Well, I knew you didn\'t had the guts anyway!" when he should say "So you have come this far, have you? ...', 'Still, the biggest challenge lies before you. ...', 'Are you ready for the hardest fight of your life?"
I'm not assigning any storagevalue cuz it will not be possible to visit this NPC again after done the quest
this is the script
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, "mission") or msgcontains(msg, "wrath") or msgcontains(msg, "emperor") or msgcontains(msg, "quest") then
npcHandler:say({'So you have come this far, have you? ...', 'Still, the biggest challenge lies before you. ...', 'Are you ready for the hardest fight of your life?'}, cid)
if msgcontains(msg, "yes") then
npcHandler:say({'So be it!'}, cid)
doSummonCreature("Snake God Essence", {x=33066, y=31153, z=15})
else
npcHandler:say({'NO? Well, I knew you didn\'t had the guts anyway!'}, cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())