• 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.X+ Realera npc boats are not charging designed cost (something is bad at libraries)

johnsamir

Advanced OT User
Joined
Oct 13, 2009
Messages
844
Solutions
6
Reaction score
150
Location
Nowhere
Hello Community

I'm using realera 8.0 npcs folder in my tfs 1.3 everything work good. However, like the title says, boat npcs are not charging designed cost, the npcs are letting players travel for free. Have no errors in console. and this occurs with every boat.lua fil that i have tested
Does anybody knows how to solve this? edit- every other npc in the server works good.
Thanks
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 Carlin, Ab\'Dendriel, Edron, Venore and Port Hope.'} }
npcHandler:addModule(VoiceModule:new(voices))

-- Travel
local function addTravelKeyword(keyword, cost, destination, action)
    Keyword({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})
Keyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you seek a passage to ' .. keyword:titleCase() .. ' for |TRAVELCOST|?', cost = cost, discount = 'postman'})
    keywordHandler:addKeyword({"bring me to "..keyword}, StdModule.travel, {npcHandler = npcHandler, premium = false, cost = cost, discount = 'postman', destination = destination, onlyFocus = false}, nil, action)
end

addTravelKeyword('carlin', 110, Position(32387, 31821, 7), function(player) if player:getStorageValue(2005) == 1 then player:setStorageValue(2005, 2) end end)
addTravelKeyword('ab\'dendriel', 130, Position(32733, 31667, 7))
addTravelKeyword('edron', 160, Position(33178, 31768, 7))
addTravelKeyword('venore', 170, Position(32958, 32024, 7))
addTravelKeyword('port hope', 160, Position(32532, 32784, 6))
addTravelKeyword('svargrond', 180, Position(32341, 31108, 6))
--addTravelKeyword('liberty bay', 180, Position(32285, 32892, 6))

-- Kick
keywordHandler:addKeyword({'kick'}, StdModule.kick, {npcHandler = npcHandler, destination = {Position(32320, 32219, 6), Position(32321, 32210, 6)}})
 
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({'route'}, 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, Edron, Venore, Port Hope, Liberty Bay or Svargrond?'})
keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To Carlin, Ab\'Dendriel, Edron, Venore, Port Hope, Liberty Bay or Svargrond?'})
keywordHandler:addKeyword({'town'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To Carlin, Ab\'Dendriel, Edron, Venore, Port Hope, Liberty Bay or Svargrond?'})
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To Carlin, Ab\'Dendriel, Edron, Venore, Port Hope, Liberty Bay or Svargrond?'})
keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To Carlin, Ab\'Dendriel, Edron, Venore, Port Hope, Liberty Bay or Svargrond?'})
keywordHandler:addKeyword({'go'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To Carlin, Ab\'Dendriel, Edron, Venore, Port Hope, Liberty Bay or Svargrond?'})
keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To Carlin, Ab\'Dendriel, Edron, Venore, Port Hope, Liberty Bay or Svargrond?'})
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())
Code:
21:13 Captain Bluebear: Do you seek a passage to Venore for free?
Every npc that i have tested offers free passages, something must be bad at libraries, i use npc old talk syle(7.4) so i can't use whatever libraries . please help me

i watched this thread and i can asure you that i have those code added into libraries
i have viewed this and added to the files
 
Last edited:
Solution
@Xikini man i found out that it seems like the npc is charging player, but the money is not being removed from inventory, don't have errors in console.
Lua:
12:01 Captain Fearless: Do you seek a passage to Thais for 170 gold coins?
Seems like line 197 does a second check, for whatever reason.
Lua:
if cost and cost > 0 and player:getLevel() >= 50 then
change to
Lua:
if cost and cost > 0 then
Looks like players under level 50 get free travel.

line 62, in modules.lua
Lua:
if cost and cost > 0 and player:getLevel() >= 50 then

If you want everyone to be charged, just remove that check.
Lua:
if cost and cost > 0 then
 
Looks like players under level 50 get free travel.

line 62, in modules.lua
Lua:
if cost and cost > 0 and player:getLevel() >= 50 then

If you want everyone to be charged, just remove that check.
Lua:
if cost and cost > 0 then
really, thank you very much was struggling with this, again thank
 
Last edited:
@Xikini man i found out that it seems like the npc is charging player, but the money is not being removed from inventory, don't have errors in console.
Lua:
12:01 Captain Fearless: Do you seek a passage to Thais for 170 gold coins?
 
@Xikini man i found out that it seems like the npc is charging player, but the money is not being removed from inventory, don't have errors in console.
Lua:
12:01 Captain Fearless: Do you seek a passage to Thais for 170 gold coins?
Seems like line 197 does a second check, for whatever reason.
Lua:
if cost and cost > 0 and player:getLevel() >= 50 then
change to
Lua:
if cost and cost > 0 then
 
Solution
Seems like line 197 does a second check, for whatever reason.
Lua:
if cost and cost > 0 and player:getLevel() >= 50 then
change to
Lua:
if cost and cost > 0 then
yes i did i changed those lines , tried to remove the check too but im having errors
Seems like line 197 does a second check, for whatever reason.
Lua:
if cost and cost > 0 and player:getLevel() >= 50 then
change to
Lua:
if cost and cost > 0 then
now it does properly remove the money from the inventory, that was curious. thank you once again @Xikini
 
Back
Top