local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local position = {x = 100, y = 100, z = 7}
local kickPos = {x = 100, y = 100, z = 7}
local Topic = {}
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 greetCallback(cid)
Topic[cid] = 0
return true
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, 'addon') then
selfSay('Do you want to go to town?', cid)
Topic[cid] = 1
elseif Topic[cid] == 1 and msgcontains(msg, 'yes') then
npcHandler:releaseFocus(cid)
Topic[cid] = nil
doTeleportThing(cid, position)
doSendMagicEffect(position, CONST_ME_TELEPORT)
addEvent(doTeleportThing, 10 * 60 * 1000, cid, kickPos)
end
end
npcHandler:setMessage(MESSAGE_GREET, "Can I take you to the city to make {addons}? You have 10 minutes to find the statues, then you will be teleported back to the temple.")
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())