Laur1
Banned User
Hello! All the other NPCs and even travelling between for example Cormaya and Eremo's island works fine, but the main boat NPCs are somehow bugged.
It answers the greet message, like it should but after that, nothing. I don't use any kind of VIP system but the script checks if the player is VIP, for some reason. I tried to remove that function but the NPC stopped answering in anything after that
Here's the NPC script:
I have tried to replace Captain Bluebear scripts with Pemaret and Eremo's ones and searched for this forum to an answer so solve this case. I would really appreciate any assistance.
An image from npchandler.lua:
It answers the greet message, like it should but after that, nothing. I don't use any kind of VIP system but the script checks if the player is VIP, for some reason. I tried to remove that function but the NPC stopped answering in anything after that
Here's the NPC script:
Code:
dofile(getDataDir() .. 'global/greeting.lua')
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
function onThink() npcHandler:onThink() end
function greetCallback(cid)
if getPlayerSex(cid) == 1 then
npcHandler:setMessage(MESSAGE_GREET, "Welcome on board, Sir ".. getPlayerName(cid) ..".")
return true
else
npcHandler:setMessage(MESSAGE_GREET, "Welcome on board, Madam ".. getPlayerName(cid) ..".")
return true
end
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is Captain Bluebear from the Royal Tibia Line."})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am the captain of this sailing-ship."})
keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am the captain of this sailing-ship."})
keywordHandler:addKeyword({'ship'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The Royal Tibia Line connects all seaside towns of Tibia."})
keywordHandler:addKeyword({'line'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The Royal Tibia Line connects all seaside towns of Tibia."})
keywordHandler:addKeyword({'company'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The Royal Tibia Line connects all seaside towns of Tibia."})
keywordHandler:addKeyword({'route'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The Royal Tibia Line connects all seaside towns of Tibia."})
keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The Royal Tibia Line connects all seaside towns of Tibia."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We can transport everything you want."})
keywordHandler:addKeyword({'passenger'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We would like to welcome you on board."})
keywordHandler:addKeyword({'trip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where do you want to go? To Carlin, Ab'Dendriel, Venore, Port Hope or Edron?"})
keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where do you want to go? To Carlin, Ab'Dendriel, Venore, Port Hope or Edron?"})
keywordHandler:addKeyword({'town'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where do you want to go? To Carlin, Ab'Dendriel, Venore, Port Hope or Edron?"})
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where do you want to go? To Carlin, Ab'Dendriel, Venore, Port Hope or Edron?"})
keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where do you want to go? To Carlin, Ab'Dendriel, Venore, Port Hope or Edron?"})
keywordHandler:addKeyword({'go'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where do you want to go? To Carlin, Ab'Dendriel, Venore, Port Hope or Edron?"})
keywordHandler:addKeyword({'ice'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but we don't serve the routes to the Ice Islands."})
keywordHandler:addKeyword({'senja'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but we don't serve the routes to the Ice Islands."})
keywordHandler:addKeyword({'folda'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but we don't serve the routes to the Ice Islands."})
keywordHandler:addKeyword({'vega'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but we don't serve the routes to the Ice Islands."})
keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, 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, onlyFocus = true, 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, onlyFocus = true, 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, onlyFocus = true, text = "This is Thais. Where do you want to go?"})
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
local carlin = {x=32387,y=31821,z=6, stackpos=0}
local abdendriel = {x=32733,y=31668,z=6, stackpos=0}
local edron = {x=33175,y=31764,z=6, stackpos=0}
local venore = {x=32954,y=32023,z=6, stackpos=0}
local porthope = {x=32530,y=32784,z=6, stackpos=0}
-- Carlin
if msgcontains(msg, 'carlin') then
if isPlayerVip(cid) == TRUE then
npcHandler:say('Do you seek a passage to Carlin for free?')
talk_state = 1
town_boat = carlin
else
npcHandler:say('Do you seek a passage to Carlin for 110 gold?')
talk_state = 1
price = 110
town_boat = carlin
end
-- Ab'Dendriel
elseif msgcontains(msg, 'ab\'dendriel') then
if isPlayerVip(cid) == TRUE then
npcHandler:say('Do you seek a passage to Ab\'Dendriel for free?')
talk_state = 1
town_boat = abdendriel
else
npcHandler:say('Do you seek a passage to Ab\'Dendriel for 130 gold?')
talk_state = 1
price = 130
town_boat = abdendriel
end
-- Edron
elseif msgcontains(msg, 'edron') then
if isPlayerVip(cid) == TRUE then
npcHandler:say('Do you seek a passage to Edron for free?')
talk_state = 1
town_boat = edron
else
npcHandler:say('Do you seek a passage to Edron for 160 gold?')
talk_state = 1
price = 160
town_boat = edron
end
-- Venore
elseif msgcontains(msg, 'venore') then
if isPlayerVip(cid) == TRUE then
npcHandler:say('Do you seek a passage to Venore for free?')
talk_state = 1
town_boat = venore
else
npcHandler:say('Do you seek a passage to Venore for 170 gold?')
talk_state = 1
price = 170
town_boat = venore
end
-- Port Hope
elseif msgcontains(msg, 'port hope') then
if isPlayerVip(cid) == TRUE then
npcHandler:say('Do you seek a passage to Port Hope for free?')
talk_state = 1
town_boat = porthope
else
npcHandler:say('Do you seek a passage to Port Hope for 160 gold?')
talk_state = 1
price = 160
town_boat = porthope
end
-- Confirm Yes or No
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if isPremium(cid) == TRUE then
if getTilePzInfo(getPlayerPosition(cid)) == 1 then
if getPlayerMoney(cid) >= price or isPlayerVip(cid) == TRUE then
if isPlayerVip(cid) == TRUE then
selfSay('Set the sails!')
doTeleportThing(cid, town_boat)
doSendMagicEffect(getCreaturePosition(cid), 10)
talk_state = 0
else
selfSay('Set the sails!')
doPlayerRemoveMoney(cid, price)
doTeleportThing(cid, town_boat)
doSendMagicEffect(getCreaturePosition(cid), 10)
talk_state = 0
end
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
else
npcHandler:say('First get rid of those blood stains! You are not going to ruin my vehicle!')
talk_state = 0
end
else
npcHandler:say('I\'m sorry, but you need a premium account in order to travel onboard our ships.')
talk_state = 0
end
elseif msgcontains(msg, 'no') and talk_state == 1 then
npcHandler:say('We would like to serve you some time.')
talk_state = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
I have tried to replace Captain Bluebear scripts with Pemaret and Eremo's ones and searched for this forum to an answer so solve this case. I would really appreciate any assistance.
An image from npchandler.lua:
Last edited: