<?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>
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
lua file
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() 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())
ghostcoords = {x = 1111, y = 1111, z = 1111}
if (math.random(1, 100) <= 90)
doTeleportThing(cid, parameters.destination, false)
else
doTeleportThing(cid, ghostcoords, false)
end
local parameters = {
cost = price,
destination = position,
premium = premium,
module = self
}
local parameters = {
cost = price,
destination = position,
premium = premium,
module = self,
destiname = name
}
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
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())
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() 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())
-- 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!