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

Lua Full Boat NPC

44 Hunter

New Member
Joined
Dec 14, 2017
Messages
18
Reaction score
4
Full Boat NPC for Old Tibia, TFS 1.5 (Nekiro Downgrade)

Hello, if anyone can help me with this question I would be very grateful. It is worth remembering that all those who have servers in version 7x and 8x will be pleased with this script, because at the time it worked in the way that I will describe in detail.


1- The NPC must teleport the players to the same coordinates defined in the script, however, they must do it automatically when the player says "bring me to [city]", and must charge the same amount they would charge if it were done the traditional way by saying hi > [city] > yes
It must count a variable to define a delay time, so that players are not jumping from city to city so quickly

2- When the player says "kick me out" he should be automatically teleported to a defined position, without charging any cost.

3- Both for the traditional method and for the "bring me to" method, the NPC must apply a 10gps discount (not a percentage, but 10gps), for those who have Storage 30050.

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

keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, text = 'I am the captain of this sailing-ship.'})
keywordHandler:addKeyword({'trip'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To Trekolt, Rhyves, Varak or Saund?'})
keywordHandler:addKeyword({'ice'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry, but we don\'t serve the routes to the Ice Islands.'})

local node1 = keywordHandler:addKeyword({'trekolt'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you seek a passage to Trekolt for 100 gold?'})
    node1:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, cost = 100, destination = math.random(10) == 1 and Position(489, 384, 4) or Position(95 ,117, 7)})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})

local node2 = keywordHandler:addKeyword({'rhyves'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you seek a passage to Rhyves for 120 gold?'})
    node2:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, cost = 120, destination = Position(139, 337, 6)})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})

local node3 = keywordHandler:addKeyword({'varak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you seek a passage to Varak for 150 gold?'})
    node3:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, cost = 160, destination = Position(271, 516, 11)})
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})

local node4 = keywordHandler:addKeyword({'saund'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you seek a passage to Saund for 150 gold?'})
    node4:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, cost = 150, destination = Position(258, 602, 7)})
    node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})

npcHandler:addModule(FocusModule:new())
 
Full Boat NPC for Old Tibia, TFS 1.5 (Nekiro Downgrade)
U should use travel_destinations in the .xml file of the npc

XML:
<parameter key="travel_destinations" value="thais, X, Y, Z, Cost, true or false(for premium);venore, X, Y, Z, Cost, true or false(for premium)" />


Go in npc/lib/npcsystem/modules.lua

Search for:
Lua:
" .. cost .. "

Change for:
Lua:
" .. Player(cid):getStorageValue(30050) > 0 and cost - 10 or cost .. "


After, search for(will apear two results, but its the first - line 446):
Lua:
if not player:removeTotalMoney(cost) then

Change for:
Lua:
if not player:removeTotalMoney(player:getStorageValue(30050) > 0 and cost - 10 or cost) then


After, search for:
Lua:
if player:removeTotalMoney(cost) then

Change for:
Lua:
if player:removeTotalMoney(player:getStorageValue(30050) > 0 and cost - 10 or cost) then

After that, search for >> TravelModule.bringMeTo

Right below(two lines) where is:
Lua:
if not module.npcHandler:isFocused(cid) then

Remove the >> not <<

WITH that:
*travel will work
*list using "destination", "travel" or another Word will make npc say where you can travel
*will cost - 10gp if player has storage
*bring me to will work

To do the exhausted when using the bring is really easy, but i need to sleep now and i'm in the smartphone, try to figure out by yourself, u only need to use storage + time.os() or another
 
Back
Top