Hey guys, I'm using TFS 1.2 and I want to make so it is possible to travel carpets with PZ but if I remove player:isPzLocked() then it will be possible to travel boats with pz also.
Here's my modules.lua
and here's the npc Pino.lua
So is there any way to make so I can travel only on carpets with pz but not with boats?
bump
Here's my modules.lua
Lua:
function StdModule.travel(cid, message, keywords, parameters, node)
local npcHandler = parameters.npcHandler
if npcHandler == nil then
error("StdModule.travel called without any npcHandler instance.")
end
local onlyFocus = (parameters.onlyFocus == nil or parameters.onlyFocus == true)
if not npcHandler:isFocused(cid) and onlyFocus then
return false
end
local player = Player(cid)
local cost = parameters.cost
if cost and cost > 0 and player:getLevel() >= 8 then
if parameters.discount then
cost = cost - StdModule.travelDiscount(player, parameters.discount)
if cost < 0 then
cost = 0
end
end
else
cost = 0
end
if player:isPzLocked() then
npcHandler:say("First get rid of those blood stains! You are not going to ruin my vehicle!", cid)
elseif parameters.level and player:getLevel() < parameters.level then
npcHandler:say("You must reach level " .. parameters.level .. " before I can let you go there.", cid)
elseif not player:removeMoney(cost) then
npcHandler:say("You don't have enough money.", cid)
else
npcHandler:say(parameters.msg or "Set the sails!", cid)
if onlyFocus then
npcHandler:releaseFocus(cid)
end
local destination = parameters.destination
if type(destination) == 'function' then
destination = destination(player)
end
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:teleportTo(destination)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end
if onlyFocus then
npcHandler:resetNpc(cid)
end
return true
end
and here's the npc Pino.lua
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
keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can fly you to Femor Hills or Darashia if you like. Where do you want to go?"})
keywordHandler:addKeyword({'go'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can fly you to Femor Hills or Darashia if you like. Where do you want to go?"})
keywordHandler:addKeyword({'transport'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can fly you to Femor Hills or Darashia if you like. Where do you want to go?"})
keywordHandler:addKeyword({'ride'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can fly you to Femor Hills or Darashia if you like. Where do you want to go?"})
keywordHandler:addKeyword({'trip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can fly you to Femor Hills or Darashia if you like. Where do you want to go?"})
keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can fly you to Femor Hills or Darashia if you like. Where do you want to go?"})
local function addTravelKeyword(keyword, cost, destination, action)
local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you seek a seek a passage to ' .. titleCase(keyword) .. ' 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})
keywordHandler:addKeyword({"bring me to "..keyword}, StdModule.travel, {npcHandler = npcHandler, premium = true, cost = cost, discount = 'postman', destination = destination, onlyFocus = false}, nil, action)
end
addTravelKeyword('darashia', 40, Carpetdarashia)
addTravelKeyword('femor hills', 60, Carpethills)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
So is there any way to make so I can travel only on carpets with pz but not with boats?
Post automatically merged:
bump
Last edited: