CorpseDude
Member
- Joined
- Jan 22, 2021
- Messages
- 20
- Solutions
- 1
- Reaction score
- 5
I am working on converting over a RL map data pack to work with 1.4 for 10.98. I have searched but didnt find any releases. This is an error that a lot of my NPCS are getting. I know barely anything about coding but I can use context clues to normally make it work. The following error though I have no clue on because I want to keep the proper questing functions to allow for different destinations.
Below is the affected part of the script
Below is full script
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/Brodrosch.lua
data/npc/scripts/Brodrosch.lua:48: attempt to call method 'titleCase' (a nil value)
stack traceback:
[C]: in function 'titleCase'
data/npc/scripts/Brodrosch.lua:48: in function 'addTravelKeyword'
data/npc/scripts/Brodrosch.lua:53: in main chunk
[Warning - NpcScript::NpcScript] Can not load script: Brodrosch.lua
Below is the affected part of the script
Lua:
local function addTravelKeyword(keyword, cost, discount, destination, action)
local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you seek a ride to ' .. keyword:titleCase() .. ' for |TRAVELCOST|?', cost = cost, discount = discount})
travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, text = 'Full steam ahead!', cost = cost, discount = discount, destination = destination}, nil, action)
travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to serve you some time.', reset = true})
end
addTravelKeyword('farmine', 210, {'postman', 'new frontier'},
function(player)
local destination = Position(33025, 31553, 14)
--if player:getStorageValue(Storage.TheNewFrontier.Mission05) == 7 then --if The New Frontier Quest 'Mission 05: Getting Things Busy' complete then Stage 3
if player:getStorageValue(Storage.TheNewFrontier.Mission05) <= 700 then
destination.z = 10
--elseif player:getStorageValue(Storage.TheNewFrontier.Mission03) <= 300 then
--elseif player:getStorageValue(Storage.TheNewFrontier.Mission03) == 3 then --if The New Frontier Quest 'Mission 03: Strangers in the Night' complete then Stage 2
--destination.z = 10
end
return destination
end
)
addTravelKeyword('cormaya', 160, 'postman', Position(33311, 31989, 15),
function(player)
if player:getStorageValue(Storage.postman.Mission01) == 4 then
player:setStorageValue(Storage.postman.Mission01, 5)
end
end
)
Below is full script
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
local voices = { {text = 'Passage to Cormaya! Unforgettable steamboat ride!'} }
npcHandler:addModule(VoiceModule:new(voices))
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
if msgcontains(msg, 'ticket') then
if Player(cid):getStorageValue(Storage.wagonTicket) >= os.time() then
npcHandler:say('Your weekly ticket is still valid. Would be a waste of money to purchase a second one', cid)
return true
end
npcHandler:say('Do you want to purchase a weekly ticket for the ore wagons? With it you can travel freely and swiftly through Kazordoon for one week. 250 gold only. Deal?', cid)
npcHandler.topic[cid] = 1
elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] > 0 then
local player = Player(cid)
if npcHandler.topic[cid] == 1 then
if not player:removeMoney(250) then
npcHandler:say('You don\'t have enough money.', cid)
npcHandler.topic[cid] = 0
return true
end
player:setStorageValue(Storage.wagonTicket, os.time() + 7 * 24 * 60 * 60)
npcHandler:say('Here is your stamp. It can\'t be transferred to another person and will last one week from now. You\'ll get notified upon using an ore wagon when it isn\'t valid anymore.', cid)
end
npcHandler.topic[cid] = 0
elseif msgcontains(msg, 'no') and npcHandler.topic[cid] > 0 then
npcHandler:say('No then.', cid)
npcHandler.topic[cid] = 0
end
return true
end
local function addTravelKeyword(keyword, cost, discount, destination, action)
local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you seek a ride to ' .. keyword:titleCase() .. ' for |TRAVELCOST|?', cost = cost, discount = discount})
travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, text = 'Full steam ahead!', cost = cost, discount = discount, destination = destination}, nil, action)
travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to serve you some time.', reset = true})
end
addTravelKeyword('farmine', 210, {'postman', 'new frontier'},
function(player)
local destination = Position(33025, 31553, 14)
--if player:getStorageValue(Storage.TheNewFrontier.Mission05) == 7 then --if The New Frontier Quest 'Mission 05: Getting Things Busy' complete then Stage 3
if player:getStorageValue(Storage.TheNewFrontier.Mission05) <= 700 then
destination.z = 10
--elseif player:getStorageValue(Storage.TheNewFrontier.Mission03) <= 300 then
--elseif player:getStorageValue(Storage.TheNewFrontier.Mission03) == 3 then --if The New Frontier Quest 'Mission 03: Strangers in the Night' complete then Stage 2
--destination.z = 10
end
return destination
end
)
addTravelKeyword('cormaya', 160, 'postman', Position(33311, 31989, 15),
function(player)
if player:getStorageValue(Storage.postman.Mission01) == 4 then
player:setStorageValue(Storage.postman.Mission01, 5)
end
end
)
keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, text = 'Do you want me take you to {Cormaya} or {Farmine}?'})
npcHandler:setMessage(MESSAGE_GREET, 'Welcome, |PLAYERNAME|! May earth protect you on the rocky grounds. If you need a {passage}, I can help you.')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Good bye.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Good bye then.')
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())