• 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!

tfs 1.1 Travel Npc please.

oshrigames

Active Member
Joined
Nov 9, 2012
Messages
222
Reaction score
47
Location
israel
please help me fix this NPC T ^T

problem is i don't get error to the consol so i have no idea where to look for the bug.

this what i manage to find:
npc does spawn, does respond to "hi" but when i say the destenation he don't warp me.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Steven" script="travel.lua" walkinterval="0" floorchange="0">
    <health now="150" max="150"/>
    <look type="151" head="114" body="57" legs="114" feet="114" addons="3"/>
    <parameters>
   
        <parameter key="module_travel" value="1"/>
        <parameter key="message_greet" value="Hello |PLAYERNAME|. You don't know my ship rotes? say {travel} and I help you!" />
        <parameter key="travel_destinations" value="Relencia,1005,1001,5,500;Volcano,963,1114,6,500;Skyknot,1217,901,6,500"/>
 
    </parameters>
 
</npc>

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'Relencia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Relencia Town for 500 gold coins?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 500, destination = {x=1005, y=1001, z=5} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
local travelNode = keywordHandler:addKeyword({'Volcano'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Volcano Town for 500 gold coins?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 500, destination = {x=963, y=1114, z=6} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
local travelNode = keywordHandler:addKeyword({'Skyknot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Skyknot Town for 500 gold coins?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 500, destination = {x=1217, y=901, z=6} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'Relencia\', \'Volcano\', \'Skyknot\' for just a small fee.'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())

Im using:
TFS 1.2
please let me know if theres anything else you might need to know.


I highly appreciate any help here.
Thanks
 
Last edited:
Try erasing all parameters of npc.xml as you already have them in your script. Try again?
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Steven" script="travel.lua" walkinterval="0" floorchange="0">
    <health now="150" max="150"/>
    <look type="151" head="114" body="57" legs="114" feet="114" addons="3"/>
</npc>

------EDIT------

If that also doesn't work. Leave npc without parameters and try this script:
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

local voices = { {text = 'Come travel with me!'} }
npcHandler:addModule(VoiceModule:new(voices))

-- Travel
local function addTravelKeyword(keyword, cost, destination, action)
    local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Are you looking for a passage to ' .. keyword .. ' for ' .. cost .. ' gold coins?', cost = cost})
        travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, cost = cost, destination = destination}, nil, action)
        travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'Come again if you want to travel anywhere.', reset = true})
end

addTravelKeyword('relencia', 500, Position(1005, 1001, 5))
addTravelKeyword('volcano', 500, Position(963, 1114, 6))
addTravelKeyword('skyknot', 500, Position(1217, 901, 6))

keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, text = 'I can take you to {Relencia}, {Volcano} or {Skyknot}.'})

npcHandler:setMessage(MESSAGE_GREET, 'Welcome, |PLAYERNAME|. Are you looking for a {passage}?')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Goodbye.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Bye then.')

npcHandler:addModule(FocusModule:new())
 
Last edited:
Back
Top