• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Help Ghost Ship rote

Eldran

New Member
Joined
Jul 13, 2009
Messages
85
Reaction score
1
Hello guys!

I would like to add to npc boat venore (to darashia) the percentage taking the player to the ghost ship whose coordinates in my ot server are 33325,32173, 6.
Any saint knows how to do this?

Thx all :>
 
Last edited:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Nimral" script="default.lua" walkinterval="0" floorchange="0">
	<health now="150" max="150"/>
	<look type="129" head="114" body="119" legs="114" feet="114" corpse="2212"/>
    <parameters>
        <parameter key="module_travel" value="1"/>
	<parameter key="message_greet" value="Hello |PLAYERNAME|. If you don't know where to flow, say {travel}."/>
        <parameter key="travel_destinations" value="rhyves,159,338,6,50;"/>
    </parameters>
</npc>

Hello thats the default boat npc for TFS 0.4 / 0.3... You have to change this "rhyves,159,338,6,50;" for the name and coords, last value is the price
 
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Nimral" script="default.lua" walkinterval="0" floorchange="0">
	<health now="150" max="150"/>
	<look type="129" head="114" body="119" legs="114" feet="114" corpse="2212"/>
    <parameters>
        <parameter key="module_travel" value="1"/>
	<parameter key="message_greet" value="Hello |PLAYERNAME|. If you don't know where to flow, say {travel}."/>
        <parameter key="travel_destinations" value="rhyves,159,338,6,50;"/>
    </parameters>
</npc>

Hello thats the default boat npc for TFS 0.4 / 0.3... You have to change this "rhyves,159,338,6,50;" for the name and coords, last value is the price

<parameter key="travel_destinations" value="rhyves,159,338,6,50;"/> this line to add the percentage chance of taking the player to ghost ship? Looks like a normal function teleport to another location o_o
 
Last edited:

There are :}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end
-- OTServ event handling functions end


-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Carlin for 130 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 130, destination = {x=32387, y=31820, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'ab\'dendriel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Ab\'dendriel for 90 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 90, destination = {x=32734, y=31668, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Thais for 170 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 170, destination = {x=32310, y=32210, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Darashia for 60 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 60, destination = {x=33289, y=32480, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Edron for 40 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 40, destination = {x=33173, y=31764, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'port hope'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Port Hope for 160 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 160, destination = {x=32527, y=32784, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'ankrahmun'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Ankrahmun for 150 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 150, destination = {x=33092, y=32883, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'svargrond'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Svargrond for 150 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 170, destination = {x=32431, y=31162, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'liberty bay'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Liberty Bay for 150 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 170, destination = {x=32285, y=32892, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to Carlin, Ab\'dendriel, Thais, Port Hope, Ankrahmun, Darashia and Edron.'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can only take you to Carlin, Ab\'dendriel, Thais, Port Hope, Ankrahmun, Darashia, Svargrond, Liberty Bay and Edron.'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
 
Ahhh you don't need a regular boat, ok, go to npc/lib/npcsystem/modules.lua

Find the line: 214 should be "doTeleportThing(cid, parameters.destination, false)"

Delete it and change for:

Lua:
			ghostcoords = {x = 1111, y = 1111, z = 1111}

			if (math.random(1, 100) <= 90)
				doTeleportThing(cid, parameters.destination, false)
			else
				doTeleportThing(cid, ghostcoords, false)
			end

Change 90 for the number you want, it will give you random number from 1-100 and if the number is bigger or equal to 90 (or the number you set), it will teleport to regular location if not it will teleport to ghostcoords (edit those too ofc).

This will change it for EVERY boat npc that uses default script, if you want it for specific boat only then you have to make a script for that boat npc.
 
I wish only trip venore going to darashia to have this chance to teleport the player to the ghost ship .. equal the original tibia:>

Could you help me? Version of the tibia 8.50 real map Crying Damson 0.3.5pl1
 
Last edited:
Mhmmm ok... delete all you did, I mean replace your modules.lua with clean modules.lua and do this (I'm checking with 0.4 so not sure if modules.lua is the same as yours, check that the lines are the same):

line 418~:

Lua:
		local parameters = {
			cost = price,
			destination = position,
			premium = premium,
			module = self
		}

Change to:

Lua:
		local parameters = {
			cost = price,
			destination = position,
			premium = premium,
			module = self,
			destiname = name
		}

and line 460~ delete: doTeleportThing(cid, parent.destination, true)

and line 457 before: module.npcHandler:releaseFocus(cid)

add:
Lua:
					if math.random(1, 100) >= 90 and parent.destiname == 'venore' then
						doTeleportThing(cid, {x = 11111111111, y = 11111111111, z = 11111111}, true)
					else
						doTeleportThing(cid, parent.destination, true)
					end

(change coords for the coords u want)
 
bump

- - - Updated - - -

This works for every travel going to venore.. i need a specific npc boat script working only venore to darashia to have a chance teleport player to ghost ship :p look like a tibia global

Thx!
 
Last edited:
just write own one, this one throws you randomly, but not sure if premium and pzblock works correclty
could be shorter and written in separate module, but I'm lazy as fuck and made it quickly just for testing
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 onThink() 							npcHandler:onThink() 						end

-- example of nodes placement

-- local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Darashia for 60 gold coins?'})
-- travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 60, destination = {x=33289, y=32480, z=6} })
-- travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

-- standard travel nodes should end here, you may also use module travel in XML npc file

function creatureSayCallback(cid, type, msg)
 local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	-- random travel section starts here --
	-- dara travel config --
	local dara = {
	price = 60,
	premium = true,
	pzLocked = true, -- if true, player cannot use board when pzlocked
	destination = {x=244, y=271, z=7}, -- testing only, use your own coordinates
	fail = {x=256, y=256, z=7}
	}
	-- end config
	
	if msgcontains(msg, "yes") and talkState[talkUser] == 2 then
		if(dara.premium and not isPremium(cid)) then
			npcHandler:say('I\'m sorry, but you need a premium account in order to travel onboard our ships.', cid)
		else
			if(dara.pzLocked and isPlayerPzLocked(cid)) then
				npcHandler:say('First get rid of those blood stains! You are not going to ruin my ship!', cid)
			else
				if doPlayerRemoveMoney(cid, dara.price) then
					doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
					if math.random(1,10) > 1 then
						doTeleportThing(cid, dara.destination)
						doSendMagicEffect(dara.destination, CONST_ME_TELEPORT)
					else
						doTeleportThing(cid, dara.fail)
						doSendMagicEffect(dara.fail, CONST_ME_TELEPORT)
					end
					npcHandler:say('Set the sails!', cid)
					npcHandler:releaseFocus(cid)
				else
					npcHandler:say('You don\'t have enough money.', cid)
				end
			end
		end
	talkState[talkUser] = 0
	end
	
	if msgcontains(msg, "yes") and talkState[talkUser] == 1 then
		selfSay("This route is afflicted by ghost ship. It may be dangerous to travel now! Are you sure you want to travel here?", cid) -- go to rl veno ship and provide more accurate question here
		talkState[talkUser] = 2
	end
	
	if msgcontains(msg, "darashia") then
			selfSay("Do you want to travel to Darashia for ".. dara.price .." gold?", cid)
			talkState[talkUser] = 1
	end
	-- random travel section ends here --
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
just write own one, this one throws you randomly, but not sure if premium and pzblock works correclty
could be shorter and written in separate module, but I'm lazy as fuck and made it quickly just for testing
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 onThink() 							npcHandler:onThink() 						end

-- example of nodes placement

-- local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Darashia for 60 gold coins?'})
-- travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 60, destination = {x=33289, y=32480, z=6} })
-- travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

-- standard travel nodes should end here, you may also use module travel in XML npc file

function creatureSayCallback(cid, type, msg)
 local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	-- random travel section starts here --
	-- dara travel config --
	local dara = {
	price = 60,
	premium = true,
	pzLocked = true, -- if true, player cannot use board when pzlocked
	destination = [COLOR="#FF0000"]{x=244, y=271, z=7}[/COLOR], -- testing only, use your own coordinates
	fail = [COLOR="#FF0000"]{x=256, y=256, z=7}[/COLOR]
	}
	-- end config
	
	if msgcontains(msg, "yes") and talkState[talkUser] == 2 then
		if(dara.premium and not isPremium(cid)) then
			npcHandler:say('I\'m sorry, but you need a premium account in order to travel onboard our ships.', cid)
		else
			if(dara.pzLocked and isPlayerPzLocked(cid)) then
				npcHandler:say('First get rid of those blood stains! You are not going to ruin my ship!', cid)
			else
				if doPlayerRemoveMoney(cid, dara.price) then
					doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
					if math.random(1,10) > 1 then
						doTeleportThing(cid, dara.destination)
						doSendMagicEffect(dara.destination, CONST_ME_TELEPORT)
					else
						doTeleportThing(cid, dara.fail)
						doSendMagicEffect(dara.fail, CONST_ME_TELEPORT)
					end
					npcHandler:say('Set the sails!', cid)
					npcHandler:releaseFocus(cid)
				else
					npcHandler:say('You don\'t have enough money.', cid)
				end
			end
		end
	talkState[talkUser] = 0
	end
	
	if msgcontains(msg, "yes") and talkState[talkUser] == 1 then
		selfSay("This route is afflicted by ghost ship. It may be dangerous to travel now! Are you sure you want to travel here?", cid) -- go to rl veno ship and provide more accurate question here
		talkState[talkUser] = 2
	end
	
	if msgcontains(msg, "darashia") then
			selfSay("Do you want to travel to Darashia for ".. dara.price .." gold?", cid)
			talkState[talkUser] = 1
	end
	-- random travel section ends here --
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Thank you i'll test

- - - Updated - - -

Oh my god :D

This works perfect! Thank you so much zbizu rep + :>

I will provide my script with your help to those who come looking for the ghost ship script can also be helped too.

lua code:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local talkState = {}

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

-- example of nodes placement

-- local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Darashia for 60 gold coins?'})
-- travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 60, destination = {x=33289, y=32480, z=6} })
-- travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

-- standard travel nodes should end here, you may also use module travel in XML npc file

function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(not npcHandler:isFocused(cid)) then
return false
end
-- random travel section starts here --
-- dara travel config --
local dara = {
price = 60,
premium = true,
pzLocked = true, -- if true, player cannot use board when pzlocked
destination = {x=33289, y=32480, z=6}, -- testing only, use your own coordinates
fail = {x=33330, y=32172, z=5}
}
-- end config

if msgcontains(msg, "yes") and talkState[talkUser] == 2 then
if(dara.premium and not isPremium(cid)) then
npcHandler:say('I\'m sorry, but you need a premium account in order to travel onboard our ships.', cid)
else
if(dara.pzLocked and isPlayerPzLocked(cid)) then
npcHandler:say('First get rid of those blood stains! You are not going to ruin my ship!', cid)
else
if doPlayerRemoveMoney(cid, dara.price) then
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
if math.random(1,10) > 1 then
doTeleportThing(cid, dara.destination)
doSendMagicEffect(dara.destination, CONST_ME_TELEPORT)
else
doTeleportThing(cid, dara.fail)
doSendMagicEffect(dara.fail, CONST_ME_TELEPORT)
end
npcHandler:say('Set the sails!', cid)
npcHandler:releaseFocus(cid)
else
npcHandler:say('You don\'t have enough money.', cid)
end
end
end
talkState[talkUser] = 0
end

if msgcontains(msg, "yes") and talkState[talkUser] == 1 then
selfSay("This route is afflicted by ghost ship. It may be dangerous to travel now! Are you sure you want to travel here?", cid) -- go to rl veno ship and provide more accurate question here
talkState[talkUser] = 2
end

if msgcontains(msg, "darashia") then
selfSay("Do you want to travel to Darashia for ".. dara.price .." gold?", cid)
talkState[talkUser] = 1
end
-- random travel section ends here --
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Carlin for 130 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 130, destination = {x=32387, y=31820, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'ab\'dendriel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Ab\'dendriel for 90 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 90, destination = {x=32734, y=31668, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Thais for 170 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 170, destination = {x=32310, y=32210, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Edron for 40 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 40, destination = {x=33173, y=31764, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'port hope'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Port Hope for 160 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 160, destination = {x=32527, y=32784, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'ankrahmun'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Ankrahmun for 150 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 150, destination = {x=33092, y=32883, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'svargrond'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Svargrond for 150 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 170, destination = {x=32431, y=31162, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

local travelNode = keywordHandler:addKeyword({'liberty bay'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Liberty Bay for 150 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 170, destination = {x=32285, y=32892, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to Carlin, Ab\'dendriel, Thais, Port Hope, Ankrahmun, Darashia and Edron.'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can only take you to Carlin, Ab\'dendriel, Thais, Port Hope, Ankrahmun, Darashia, Svargrond, Liberty Bay and Edron.'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())

Status: Solved
 
Last edited:
glad you managed to run it :)
if you want it less messy you may remove these comments:
-- example of nodes placement

-- local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Darashia for 60 gold coins?'})
-- travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 60, destination = {x=33289, y=32480, z=6} })
-- travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

-- standard travel nodes should end here, you may also use module travel in XML npc file

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
 
Back
Top