johnsamir
Advanced OT User
Hello I'm using this npc boat it's working but it isn't charging the cost when players travel and i got no errors in console im using tfs 1.3 8.6 downgraded by nekiro
Lua:
--------------------By Jpkulik!----------------------------
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
-- Set the greeting message.
npcHandler:setMessage(MESSAGE_GREET, HelloText)
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end
local function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
---------------------------------------MENSAGES CONFIG--------------------------------------------
local HelloText = 'Hello |PLAYERNAME|. Welcome to my Boat!'
local HelpText = 'Do you need help?I can tell you some {destinations}.'
local DestinationText = 'I can take you to {Carlin}, {Ab\'Dendriel}, {Venore}, {Edron}, {Port Hope}.'
local CitysText = 'I can take you to {Carlin}, {Ab\'Dendriel}, {Venore}, {Edron}, {Port Hope}.'
local JobText = 'Im an Captain, and this is my Boat.'
---------------------------------------END MENSAGES CONFIG----------------------------------------
---------------------------------------CARLIN CONFIG----------------------------------------------
local CarlinPosition = {x=32387, y=31821, z=7} ----> Destination from Carlin Boat <----
local CarlinCost = 110 ----> Cost to Travel for Carlin <----
carlin = true ---->TRUE:Working/FALSE:Not Working<----
---------------------------------------END CARLIN CONFIG------------------------------------------
---CARLIN-----------------------------------------------------------------------------------------------------------------------------------------
local CarlinText = 'Do you seek a passage to Carlin for 110 gold coins?'
local CarlinTextNo = 'Ok, come back when you want then!'
local NoTravel = 'Sorry, i do not travel to this city..'
local CarlinLvl = 1
local CarlinPremium = false --True/false
--Carlin--
if carlin == true then
local travelNode = keywordHandler:addKeyword({'carlin'},
StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = CarlinText })
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = CarlinPremium, level = CarlinLvl, cost = CarlinCost, destination = CarlinPosition })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = CarlinTextNo })
else
local travelNode = keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = NoTravel })
end
--End Carlin--
local function addTravelKeyword(keyword, cost, destination, action)
local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you seek a passage to ' .. titleCase(keyword) .. ' for |TRAVELCOST|?', cost = cost, discount = 'postman'})
travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = cost, discount = 'postman', destination = destination })
travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to serve you some time.', reset = true})
end
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())