SlayingWorld
Active Member
As the title says im using the latest 1.2 forgottenserver and i added a captain npc to travel to place around the map, but when the server loads it it says this error.
This is the script for my npc
It used to work with an old version of tfs 1.2 but with the latest it doesnt. Not sure if they changed some libraries.
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/Soul Captain.lua
data/npc/scripts/Soul Captain.lua:12: attempt to index global 'VoiceModule' (a nil value)
stack traceback:
[C]: in function '__index'
data/npc/scripts/Soul Captain.lua:12: in main chunk
[Warning - NpcScript::NpcScript] Can not load script: Soul Captain.lua
This is the script for my npc
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
local voices = { {text = 'Fly or sails to Amestris, Forgotten Lands, Pont Vanis, Nilfgaard, Snowhill, Riwen.'} }
npcHandler:addModule(VoiceModule:new(voices))
-- Travel
local function addTravelKeyword(keyword, cost, destination)
local travelKeyword = keywordHandler:addKeyword({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})
travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to serve you some time.', reset = true})
end
addTravelKeyword('amestris', 0, Position(1011, 996, 6))
addTravelKeyword('forgotten lands', 0, Position(855, 797, 7))
addTravelKeyword('pont vanis', 0, Position(689, 539, 6))
addTravelKeyword('nilfgaard', 0, Position(535, 315, 6))
addTravelKeyword('snowhill', 0, Position(1322, 1461, 6))
addTravelKeyword('riwen', 0, Position(520, 1397, 6))
-- Basic
keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Amestris}, {Forgotten Lands}, {Pont Vanis}, {Snowhill}, {Riwen}?'})
keywordHandler:addKeyword({'fly'}, StdModule.say, {npcHandler = npcHandler, text = 'I can only fly to {Nilfgaard} as there is no place for my boat.'})
keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Amestris}, {Forgotten Lands}, {Pont Vanis}, {Nilfgaard}, {Snowhill}, {Riwen}?'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, text = 'I am the captain of this ship.'})
keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, text = 'I am the captain of this ship.'})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, text = 'My name is Soul Captain from the Soul Society.'})
npcHandler:setMessage(MESSAGE_GREET, 'Welcome on board, |PLAYERNAME|. Where can I {sail} or {fly} 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())
It used to work with an old version of tfs 1.2 but with the latest it doesnt. Not sure if they changed some libraries.