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

error npc boats

Jpstafe

Well-Known Member
Joined
Aug 8, 2011
Messages
507
Reaction score
68
Hello, on my server tfs 1.2(8.0) I implemented the bring me to, they work perfectly, but when I go the route of no bring me to... I say, hi, ab'dendriel:
21:52 Kid Masta [9]: ab'dendriel
21:52 Captain Fearless: Do you seek a passage to Ab'dendriel for free?

They tell me that they are free, but they bring them to me if they charge them... how can I change this?
From Venore to Darashia, I can't go like that either...
21:53 Kid Masta [9]: darashia
21:53 Captain Fearless: I'm not sailing there. This route is afflicted by a ghostship! However I've heard that Captain Fearless from Venore sails there.

Lua:
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 = 'Passages to Thais, Carlin, Ab\'Dendriel, Port Hope,Edron, Darashia, Liberty Bay, Svargrond, Ankrahmun.'} }
npcHandler:addModule(VoiceModule:new(voices))

-- Travel
local function addTravelKeyword(keyword, cost, destination, action, condition)
    if condition then
        keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry but I don\'t sail there.'}, condition)
    end

    local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you seek a passage to ' .. keyword:titleCase() .. ' for |TRAVELCOST|?', cost = cost, discount = 'postman'})
        travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, cost = cost, discount = 'postman', destination = destination}, nil, action)
        travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to serve you some time.', reset = true})
end

-- START BRING ME TO --

local function Cptl(f, r)
     return f:upper()..r:lower()
end

local exhausts = 159321

function creatureSayCallback(cid, type, msg)       
     local player, cmsg = Player(cid), msg:gsub("(%a)([%w_']*)", Cptl)
     if not npcHandler:isFocused(cid) then
        if os.time() < getPlayerStorageValue(cid, exhausts) then
            npcHandler:say('Sorry, but you need to wait two seconds before travel again.', cid)
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
         elseif msg == "bring me to ab\'dendriel" then        --Ab'dendriel
             npcHandler:addFocus(cid)
            local randomPositionsab = {
            Position(32734, 31668, 6),
            Position(32734, 31671, 6),
            Position(32732, 31665, 6),
            Position(32732, 31672, 6),
            Position(32736, 31673, 6),
            Position(32736, 31667, 6)}
            local playerpos = player:getPosition()
            local randomPositionab = randomPositionsab[math.random(#randomPositionsab)]
                if (doPlayerRemoveMoney(cid, 100) == TRUE) then         
                    player:teleportTo(randomPositionab, false)                         
                    randomPositionab:sendMagicEffect(CONST_ME_TELEPORT)
                    doSendMagicEffect(randomPositionab,11)                           
                else
                    selfSay('Not enough gold.')
                    npcHandler:releaseFocus(cid)
                end
    elseif msg == "bring me to svargrond" then        --Svargrond
             npcHandler:addFocus(cid)
            local randomPositionssvarg = {
            Position(32342, 31108, 6),
            Position(32344, 31106, 6),
            Position(32344, 31110, 6),
            Position(32339, 31110, 6),
            Position(32347, 31108, 6),
            Position(32348, 31108, 5)}
            local playerpos = player:getPosition()
            local randomPositionsvarg = randomPositionssvarg[math.random(#randomPositionssvarg)]
                if (doPlayerRemoveMoney(cid, 100) == TRUE) then         
                    player:teleportTo(randomPositionsvarg, false)                         
                    randomPositionsvarg:sendMagicEffect(CONST_ME_TELEPORT)
                    doSendMagicEffect(randomPositionsvarg,11)                           
                else
                    selfSay('Not enough gold.')
                    npcHandler:releaseFocus(cid)
                end
        elseif msg == "bring me to thais" then        --Thais
             npcHandler:addFocus(cid)
            local randomPositionscarlin = {
            Position(32310, 32210, 6),
            Position(32310, 32211, 6),
            Position(32310, 32208, 6),
            Position(32310, 32213, 6)}
            local playerpos = player:getPosition()
            local randomPositioncarlin = randomPositionscarlin[math.random(#randomPositionscarlin)]
                if (doPlayerRemoveMoney(cid, 100) == TRUE) then         
                    player:teleportTo(randomPositioncarlin, false)                         
                    randomPositioncarlin:sendMagicEffect(CONST_ME_TELEPORT)
                    doSendMagicEffect(randomPositioncarlin,11)                           
                else
                    selfSay('Not enough gold.')
                    npcHandler:releaseFocus(cid)
                end
    elseif msg == "bring me to edron" then        --Edron
             npcHandler:addFocus(cid)
            local randomPositionsedron = {
            Position(33173, 31764, 6),
            Position(33177, 31764, 6),
            Position(33175, 31764, 6),
            Position(33173, 31762, 6),
            Position(33177, 31762, 6),
            Position(33173, 31766, 6),
            Position(33177, 31766, 6)}
            local playerpos = player:getPosition()
            local randomPositionedron = randomPositionsedron[math.random(#randomPositionsedron)]
                if (doPlayerRemoveMoney(cid, 100) == TRUE) then         
                    player:teleportTo(randomPositionedron, false)                         
                    randomPositionedron:sendMagicEffect(CONST_ME_TELEPORT)
                    doSendMagicEffect(randomPositionedron,11)                           
                else
                    selfSay('Not enough gold.')
                    npcHandler:releaseFocus(cid)
                end
    elseif msg == "bring me to carlin" then        --Carlin
             npcHandler:addFocus(cid)
            local randomPositionsvenore = {
            Position(32388, 31821, 6),
            Position(32384, 31820, 6),
            Position(32385, 31823, 6),
            Position(32393, 31821, 6),
            Position(32393, 31821, 5)}                     
            local playerpos = player:getPosition()
            local randomPositionvenore = randomPositionsvenore[math.random(#randomPositionsvenore)]
                if (doPlayerRemoveMoney(cid, 100) == TRUE) then         
                    player:teleportTo(randomPositionvenore, false)                 
                    randomPositionvenore:sendMagicEffect(CONST_ME_TELEPORT)
                    doSendMagicEffect(randomPositionvenore,11)                         
                else
                    selfSay('Not enough gold.')
                    npcHandler:releaseFocus(cid)
                end
    elseif msg == "bring me to port hope" then        --Port Hope
             npcHandler:addFocus(cid)
            local randomPositionsvenore = {
            Position(32532, 32784, 6),
            Position(32531, 32785, 6),
            Position(32527, 32784, 6),
            Position(32524, 32784, 6)}                     
            local playerpos = player:getPosition()
            local randomPositionvenore = randomPositionsvenore[math.random(#randomPositionsvenore)]
                if (doPlayerRemoveMoney(cid, 100) == TRUE) then         
                    player:teleportTo(randomPositionvenore, false)                 
                    randomPositionvenore:sendMagicEffect(CONST_ME_TELEPORT)
                    doSendMagicEffect(randomPositionvenore,11)                         
                else
                    selfSay('Not enough gold.')
                    npcHandler:releaseFocus(cid)
                end   
    elseif msg == "bring me to darashia" then        --Darashia
             npcHandler:addFocus(cid)
            local randomPositionsvenore = {
            Position(33289, 32481, 6),
            Position(33288, 32481, 6),
            Position(33295, 32481, 5),
            Position(33293, 32481, 6)}                     
            local playerpos = player:getPosition()
            local randomPositionvenore = randomPositionsvenore[math.random(#randomPositionsvenore)]
                if (doPlayerRemoveMoney(cid, 100) == TRUE) then         
                    player:teleportTo(randomPositionvenore, false)                 
                    randomPositionvenore:sendMagicEffect(CONST_ME_TELEPORT)
                    doSendMagicEffect(randomPositionvenore,11)                         
                else
                    selfSay('Not enough gold.')
                    npcHandler:releaseFocus(cid)
                end       
    elseif msg == "bring me to svargrond" then        --Svargrond
             npcHandler:addFocus(cid)
            local randomPositionssvarg = {
            Position(32342, 31108, 6),
            Position(32344, 31106, 6),
            Position(32344, 31110, 6),
            Position(32339, 31110, 6),
            Position(32347, 31108, 6),
            Position(32348, 31108, 5)}
            local playerpos = player:getPosition()
            local randomPositionsvarg = randomPositionssvarg[math.random(#randomPositionssvarg)]
                if (doPlayerRemoveMoney(cid, 100) == TRUE) then         
                    player:teleportTo(randomPositionsvarg, false)                         
                    randomPositionsvarg:sendMagicEffect(CONST_ME_TELEPORT)
                    doSendMagicEffect(randomPositionsvarg,11)                           
                else
                    selfSay('Not enough gold.')
                    npcHandler:releaseFocus(cid)
                end       
    elseif msg == "bring me to liberty bay" then    --Liberty Bay
             npcHandler:addFocus(cid)
            local randomPositionsliberty = {
            Position(32285, 32891, 6),
            Position(32283, 32894, 6),
            Position(32288, 32894, 6),
            Position(32285, 32888, 6),
            Position(32288, 32889, 6),
            Position(32288, 32891, 6),
            Position(32282, 32890, 6)}
            local playerpos = player:getPosition()
            local randomPositionliberty = randomPositionsliberty[math.random(#randomPositionsliberty)]
                if (doPlayerRemoveMoney(cid, 100) == TRUE) then         
                    player:teleportTo(randomPositionliberty, false)                         
                    randomPositionliberty:sendMagicEffect(CONST_ME_TELEPORT)
                    doSendMagicEffect(randomPositionliberty,11)                           
                else
                    selfSay('Not enough gold.')
                    npcHandler:releaseFocus(cid)
                end
elseif msg == "bring me to ankrahmun" then    --Ankrahmun
             npcHandler:addFocus(cid)
            local randomPositionsliberty = {
            Position(33092, 32883, 6),
            Position(33092, 32886, 6),
            Position(33095, 32884, 6),
            Position(33094, 32889, 5)}
            local playerpos = player:getPosition()
            local randomPositionliberty = randomPositionsliberty[math.random(#randomPositionsliberty)]
                if (doPlayerRemoveMoney(cid, 100) == TRUE) then         
                    player:teleportTo(randomPositionliberty, false)                         
                    randomPositionliberty:sendMagicEffect(CONST_ME_TELEPORT)
                    doSendMagicEffect(randomPositionliberty,11)                           
                else
                    selfSay('Not enough gold.')
                    npcHandler:releaseFocus(cid)
                end               
    elseif msg == "kick" then        --Kick
             npcHandler:addFocus(cid)
            local randomPositionskick = {
            Position(32956, 32031, 6),
            Position(32952, 32032, 6),
            Position(32955, 32029, 6)}
            local playerpos = player:getPosition()
            local randomPositionkick = randomPositionskick[math.random(#randomPositionskick)]
                if (doPlayerRemoveMoney(cid, 100) == TRUE) then         
                    player:teleportTo(randomPositionkick, false)                         
                    randomPositionthais:sendMagicEffect(CONST_ME_TELEPORT)
                    doSendMagicEffect(randomPositionkick,11)                       
                else
                    selfSay('Not enough gold.')
                    npcHandler:releaseFocus(cid)
                end
        end --final
        setPlayerStorageValue(cid, exhausts, 2 + os.time())
    end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

-- END BRING ME TO--

addTravelKeyword('thais', 110, Position(32310, 32210, 6), function(player) if player:getStorageValue(Storage.postman.Mission01) == 1 then player:setStorageValue(Storage.postman.Mission01, 2) end end)
addTravelKeyword('ab\'dendriel', 80, Position(32734, 31668, 6))
addTravelKeyword('edron', 110, Position(33175, 31764, 6))
addTravelKeyword('venore', 130, Position(32954, 32022, 6))
addTravelKeyword('svargrond', 110, Position(32341, 31108, 6))
addTravelKeyword('liberty bay', 180, Position(32285, 32892, 6),
nil, function(player) return player:getStorageValue(Storage.SearoutesAroundYalahar.Thais) ~= 1 and player:getStorageValue(Storage.SearoutesAroundYalahar.TownsCounter) < 5 end)


-- Kick
--keywordHandler:addKeyword({'kick'}, StdModule.kick, {npcHandler = npcHandler, destination = {Position(32320, 32219, 6), Position(32321, 32210, 6)}})

-- Basic
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, text = 'My name is Captain Bluebear from the Royal Tibia Line.'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, text = 'I am the captain of this sailing-ship.'})
keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, text = 'I am the captain of this sailing-ship.'})
keywordHandler:addKeyword({'ship'}, StdModule.say, {npcHandler = npcHandler, text = 'The Royal Tibia Line connects all seaside towns of Tibia.'})
keywordHandler:addKeyword({'line'}, StdModule.say, {npcHandler = npcHandler, text = 'The Royal Tibia Line connects all seaside towns of Tibia.'})
keywordHandler:addKeyword({'company'}, StdModule.say, {npcHandler = npcHandler, text = 'The Royal Tibia Line connects all seaside towns of Tibia.'})
keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, text = 'The Royal Tibia Line connects all seaside towns of Tibia.'})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, text = 'We can transport everything you want.'})
keywordHandler:addKeyword({'passenger'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to welcome you on board.'})
keywordHandler:addKeyword({'trip'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Venore}, {Port Hope}, {Liberty Bay}, {Svargrond} or {Edron}?'})
keywordHandler:addKeyword({'route'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Venore}, {Port Hope}, {Liberty Bay}, {Svargrond} or {Edron}?'})
keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Venore}, {Port Hope}, {Liberty Bay}, {Svargrond} or {Edron}?'})
keywordHandler:addKeyword({'town'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Venore}, {Port Hope}, {Liberty Bay}, {Svargrond} or {Edron}?'})
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Venore}, {Port Hope}, {Liberty Bay}, {Svargrond} or {Edron}?'})
keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Venore}, {Port Hope}, {Liberty Bay}, {Svargrond} or {Edron}?'})
keywordHandler:addKeyword({'go'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Venore}, {Port Hope}, {Liberty Bay}, {Svargrond} or {Edron}?'})
keywordHandler:addKeyword({'ice'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry, but we don\'t serve the routes to the Ice Islands.'})
keywordHandler:addKeyword({'senja'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry, but we don\'t serve the routes to the Ice Islands.'})
keywordHandler:addKeyword({'folda'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry, but we don\'t serve the routes to the Ice Islands.'})
keywordHandler:addKeyword({'vega'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry, but we don\'t serve the routes to the Ice Islands.'})
keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m not sailing there. This route is afflicted by a ghostship! However I\'ve heard that Captain Fearless from Venore sails there.'})
keywordHandler:addKeyword({'darama'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m not sailing there. This route is afflicted by a ghostship! However I\'ve heard that Captain Fearless from Venore sails there.'})
keywordHandler:addKeyword({'ghost'}, StdModule.say, {npcHandler = npcHandler, text = 'Many people who sailed to Darashia never returned because they were attacked by a ghostship! I\'ll never sail there!'})
keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, text = 'This is Thais. Where do you want to go?'})

npcHandler:setMessage(MESSAGE_GREET, 'Welcome on board, |PLAYERNAME|. Where can I {sail} you today?')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Good bye. Recommend us if you were satisfied with our service.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Good bye then.')

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