Look at this:
Dunno what's wrong ;S
Help me somone :/
Dunno what's wrong ;S
Code:
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) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
npcHandler:addModule(FocusModule:new())
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- Topic
local talkState = {}
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 onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end
function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end
function onThink() npcHandler:onThink() end
-- Boat --
local travelNode = keywordHandler:addKeyword({"Inferesla}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to travel to Inferesla for 0 gold coins?"})
travelNode:addChildKeyword({"yes"}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=780, y=547, z=6} })
travelNode:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = "I wouldn't go there either."})
local travelNode = keywordHandler:addKeyword({"Newmore}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to travel to Newmore for 0 gold coins?"})
travelNode:addChildKeyword({"yes"}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=988, y=299, z=6} })
travelNode:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = "I wouldn't go there either."})
local travelNode = keywordHandler:addKeyword({"House island}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to travel to House island for 0 gold coins?"})
travelNode:addChildKeyword({"yes"}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=304, y=254, z=6} })
travelNode:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = "I wouldn't go there either."})
local travelNode = keywordHandler:addKeyword({"Prince}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to travel to Prince for 0 gold coins?"})
travelNode:addChildKeyword({"yes"}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=293, y=30, z=6} })
travelNode:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = "I wouldn't go there either."})
local travelNode = keywordHandler:addKeyword({"Marlboro}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to travel to Marlboro for 0 gold coins?"})
travelNode:addChildKeyword({"yes"}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=543, y=546, z=6} })
travelNode:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = "I wouldn't go there either."})
-- Talk modules
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, "Yo")) then
selfSay("Hello..! Where do you want to go? Newmore, Prince, Inferesla, Marlboro, House Island?", cid)
elseif(msgcontains(msg, "Hello")) then
selfSay("Hello..! Where do you want to go? Newmore, Prince, Inferesla, Marlboro, House Island?", cid)
elseif(msgcontains(msg, "Hi")) then
selfSay("Hello..! Where do you want to go? Newmore, Prince, Inferesla, Marlboro, House Island?", cid)
elseif(msgcontains(msg, "Newmore")) then
selfSay("Here you go!", cid)
elseif(msgcontains(msg, "Marlboro")) then
selfSay("Here you go!", cid)
elseif(msgcontains(msg, "Prince")) then
selfSay("Here you go!", cid)
elseif(msgcontains(msg, "House Island")) then
selfSay("Here you go!", cid)
elseif(msgcontains(msg, "Houseisland")) then
selfSay("Here you go!", cid)
elseif(msgcontains(msg, "inferesla")) then
selfSay("Here you go!", cid)
elseif(msgcontains(msg, "Inferesla")) then
selfSay("Here you go!", cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Help me somone :/