Grehy
Killroy
I just want a npc when you say "xxx", it tps you to "x x x" with no message, and when you say "xxxx" it tps you to "xx xx xx" with no message (response)
local keywordHandler = KeywordHandler:new()
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)
if(string.lower(msg) == 'text 1') then
doTeleportThing(cid, {x=100,y=100,z=3}, TRUE)
elseif(string.lower(msg) == 'text 2') then
doTeleportThing(cid, {x=200,y=200,z=6}, TRUE)
end
end
function onThink() npcHandler:onThink() end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid)
talk_state[cid] = 0
npcHandler:onCreatureAppear(cid)
end
function onCreatureDisappear(cid)
talk_state[cid] = 0
npcHandler:onCreatureDisappear(cid)
end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, message)
if(not npcHandler:isFocused(cid)) then
return false
end
if(string.lower(msg) == 'text 1') then
doTeleportThing(cid, {x=100,y=100,z=3}, TRUE)
elseif(string.lower(msg) == 'text 2') then
doTeleportThing(cid, {x=200,y=200,z=6}, TRUE)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, 'Hi |PLAYERNAME|. Tell me teleport name.')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Bye |PLAYERNAME|.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Bye |PLAYERNAME|.')
npcHandler:addModule(FocusModule:new())