local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler
![Eek! :eek: :eek:](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler
![Eek! :eek: :eek:](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler
![Eek! :eek: :eek:](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
nCreatureSay(cid, type, msg) end
-- Set the greeting message.
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|. Where do you want to go?')
function onThink() npcHandler
![Eek! :eek: :eek:](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
nThink() end
-- OTServ event handling functions end
-----------------------------------------------------------------------------Script---------------------------------------------------------------------
------------------------Destinations-----------------------------
local Venore = {x=32360, y=31782, z=7}
------------------------End of Destinations----------------------
--- Travel on? (true/false)
Travel = true
if Travel == true then
CitysMsg = 'I can take you to CITYS'
VenoreMsg = 'Do you want to go to Venore for 100 Gold Coins?'
KazordoonMsg = 'Do you want to go to Kazordoon for 100 Gold Coins?'
AbDendrielMsg = 'Do you want to go to Ab\'\Dendriel for 100 Gold Coins?'
CarlinMsg = 'Do you want to go to Carlin for 100 Gold Coins?'
SvargrondMsg = 'Do you want to go to Svargrond for 100 Gold Coins?'
LibertyBayMsg = 'Do you want to go to Liberty Bay for 100 Gold Coins?'
EdronMsg = 'Do you want to go to Edron for 100 Gold Coins?'
DarashiaMsg = 'Do you want to go to Darashia for 100 Gold Coins?'
AnkrahmunMsg = 'Do you want to go to Ankrahmun for 100 Gold Coins?'
PorthopeMsg = 'Do you want to go to Port Hope for 100 Gold Coins?'
ThaisMsg = 'Do you want to go to Port Hope for 100 Gold Coins?'
NoTravelMsg = 'Sorry, you cannot travel to this City!'
NoMsg = 'Ok Then...'
NoCashMsg = 'Sorry, you dont have any money to pay, or you are out of Premium Account Days.'
else
BoatoffMsg = 'Sorry, you cannot travel right now!'
end
----------------------Possible Mensages---------------------
if msgcontains(msg, 'citys') or msgcontains(msg, 'destination') then
selfSay(CitysMsg)
NoCashMsg = 'Sorry, you dont have any money to pay, or you are out of Premium Account Days.'
----------------------Possible Mensages End-----------------
----------------------Citys---------------------
--- Venore on? (true/false)
Venore = true
if Venore == true then
if msgcontains(msg, 'venore') then
selfSay(VenoreMsg)
talk_state = 1
else
selfSay(NoTravelMsg)
end
---End
--- Kazordoon on? (true/false)
Kazordoon = true
if Kazordooon == true then
if msgcontains(msg, 'kazordoon') then
selfSay(KazordoonMsg)
talk_state = 2
end
else
selfSay(NoTravelMsg)
end
---End
--- Carlin on? (true/false)
Carlin = true
if Carlin == true then
if msgcontains(msg, 'Carlin') then
selfSay(CarlinMsg)
talk_state = 3
end
else
selfSay(NoTravelMsg)
end
---End
--- Svargrond on? (true/false)
Svargrond = true
if Kazordooon == true then
if msgcontains(msg, 'Svargrond') then
selfSay(SvargrondMsg)
talk_state = 4
end
else
selfSay(NoTravelMsg)
end
---End
--- Libery Bay on? (true/false)
LibertyBay = true
if LiberyBay == true then
if msgcontains(msg, 'Libery Bay') then
selfSay(LiberyBayMsg)
talk_state = 5
end
else
selfSay(NoTravelMsg)
end
---End
--- Edron on? (true/false)
Edron = true
if Edron == true then
if msgcontains(msg, 'Edron') then
selfSay(EdrondMsg)
talk_state = 6
end
else
selfSay(NoTravelMsg)
end
---End
--- Darashia on? (true/false)
Darashia = true
if Darashia == true then
if msgcontains(msg, 'Darashia') then
selfSay(DarashiaMsg)
talk_state = 7
end
else
selfSay(NoTravelMsg)
end
---End
--- Ankrahmun on? (true/false)
Ankrahmun = true
if Ankrahmun == true then
if msgcontains(msg, 'Ankrahmun') then
selfSay(AnkrahmunMsg)
talk_state = 8
end
else
selfSay(NoTravelMsg)
end
---End
--- Port Hope on? (true/false)
PortHope = true
if PortHope == true then
if msgcontains(msg, 'Port Hope') then
selfSay(PortHopeMsg)
talk_state = 9
end
else
selfSay(NoTravelMsg)
end
---End
--- AbDendriel on? (true/false)
AbDendriel = true
if AbDendriel == true then
if msgcontains(msg, 'Ab Dendriel') then
selfSay(AbDendrielMsg)
talk_state = 10
end
else
selfSay(NoTravelMsg)
end
---End
--- Thais on? (true/false)
Thais = true
if Thais == true then
if msgcontains(msg, 'Thais') then
selfSay(ThaisMsg)
talk_state = 11
end
else
selfSay(NoTravelMsg)
end
---End
----------------------Citys End-----------------
----------------------Send Players---------------------
elseif msgcontains(msg, 'yes') and talk_state == 1 then
doPlayerRemoveMoney(cid,100)
doTeleportThing(cid, Venore, TRUE)
selfSay('Have a Nice Trip!')
ense
selfSay(NoCashMsg)
end
talk_state = 0
---
elseif msgcontains(msg, 'yes') and talk_state == 2 then
doPlayerRemoveMoney(cid,100)
doTeleportThing(cid, Kazordoon, TRUE)
selfSay('Have a Nice Trip!')
ense
selfSay(NoCashMsg)
end
talk_state = 0
---
elseif msgcontains(msg, 'yes') and talk_state == 3 then
doPlayerRemoveMoney(cid,100)
doTeleportThing(cid, Carlin, TRUE)
selfSay('Have a Nice Trip!')
ense
selfSay(NoCashMsg)
end
talk_state = 0
---
elseif msgcontains(msg, 'yes') and talk_state == 4 then
getPlayerPremiumDays(cid) >= 1 then
doPlayerRemoveMoney(cid,100)
doTeleportThing(cid, Svargrond, TRUE)
selfSay('Have a Nice Trip!')
else
selfSay(NocashMsg)
end
talk_state = 0
---
elseif msgcontains(msg, 'yes') and talk_state == 5 then
getPlayerPremiumDays(cid) >= 1 then
doPlayerRemoveMoney(cid,100)
doTeleportThing(cid, LibertyBay, TRUE)
selfSay('Have a Nice Trip!')
else
selfSay(NocashMsg)
end
talk_state = 0
---
elseif msgcontains(msg, 'yes') and talk_state == 6 then
getPlayerPremiumDays(cid) >= 1 then
doPlayerRemoveMoney(cid,100)
doTeleportThing(cid, Edron, TRUE)
selfSay('Have a Nice Trip!')
else
selfSay(NocashMsg)
end
talk_state = 0
---
elseif msgcontains(msg, 'yes') and talk_state == 7 then
getPlayerPremiumDays(cid) >= 1 then
doPlayerRemoveMoney(cid,100)
doTeleportThing(cid, Darashia, TRUE)
selfSay('Have a Nice Trip!')
else
selfSay(NocashMsg)
end
talk_state = 0
---
elseif msgcontains(msg, 'yes') and talk_state == 8 then
getPlayerPremiumDays(cid) >= 1 then
doPlayerRemoveMoney(cid,100)
doTeleportThing(cid, Ankrahmun, TRUE)
selfSay('Have a Nice Trip!')
else
selfSay(NocashMsg)
end
talk_state = 0
---
elseif msgcontains(msg, 'yes') and talk_state == 9 then
getPlayerPremiumDays(cid) >= 1 then
doPlayerRemoveMoney(cid,100)
doTeleportThing(cid, PortHope, TRUE)
selfSay('Have a Nice Trip!')
else
selfSay(NocashMsg)
end
talk_state = 0
---
---
elseif msgcontains(msg, 'yes') and talk_state == 10 then
doPlayerRemoveMoney(cid,100)
doTeleportThing(cid, AbDendriel, TRUE)
selfSay('Have a Nice Trip!')
ense
selfSay(NoCashMsg)
end
talk_state = 0
---
elseif msgcontains(msg, 'yes') and talk_state == 11 then
doPlayerRemoveMoney(cid,100)
doTeleportThing(cid, Thais, TRUE)
selfSay('Have a Nice Trip!')
ense
selfSay(NoCashMsg)
end
talk_state = 0
------------------------------------------------ No Travel ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 10) then
selfSay(NoMsg)
talk_state = 0
end
-----------------------------------------------------------------------------Script---------------------------------------------------------------------
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())