CorpseDude
Member
- Joined
- Jan 22, 2021
- Messages
- 20
- Solutions
- 1
- Reaction score
- 5
I am working on converting a data pack to work with TFS 1.4
I am getting a few errors that I have not be able to solve.
I understand that the NPC scripts are trying to call functions but not returning the values they need.
Error 1
Error 2
Below is the greet module that I found in the custom modules lua file. I have tried migrating it into the npchandler file but that did not work.
I have also tried creating a greet.lua and using dofile to import it. That did not work either.
Any guidance would be greatly appreciated.
I am getting a few errors that I have not be able to solve.
I understand that the NPC scripts are trying to call functions but not returning the values they need.
Error 1
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/Chondur.lua
data/npc/scripts/Chondur.lua:84: attempt to index global 'Storage' (a nil value)
stack traceback:
[C]: in function '__index'
data/npc/scripts/Chondur.lua:84: in main chunk
[Warning - NpcScript::NpcScript] Can not load script: Chondur.lua
Error 2
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/Maryza.lua
data/npc/scripts/Maryza.lua:46: attempt to call method 'addGreetMessage' (a nil value)
stack traceback:
[C]: in function 'addGreetMessage'
data/npc/scripts/Maryza.lua:46: in main chunk
[Warning - NpcScript::NpcScript] Can not load script: Maryza.lua
Below is the greet module that I found in the custom modules lua file. I have tried migrating it into the npchandler file but that did not work.
I have also tried creating a greet.lua and using dofile to import it. That did not work either.
Any guidance would be greatly appreciated.
Lua:
-------Greet function
local GreetModule = {}
function GreetModule.greet(cid, message, keywords, parameters)
if not parameters.npcHandler:isInRange(cid) then
return true
end
if parameters.npcHandler:isFocused(cid) then
return true
end
local parseInfo = { [TAG_PLAYERNAME] = Player(cid):getName() }
parameters.npcHandler:say(parameters.npcHandler:parseMessage(parameters.text, parseInfo), cid, true)
parameters.npcHandler:addFocus(cid)
return true
end
function GreetModule.farewell(cid, message, keywords, parameters)
if not parameters.npcHandler:isFocused(cid) then
return false
end
local parseInfo = { [TAG_PLAYERNAME] = Player(cid):getName() }
parameters.npcHandler:say(parameters.npcHandler:parseMessage(parameters.text, parseInfo), cid, true)
parameters.npcHandler:resetNpc(cid)
parameters.npcHandler:releaseFocus(cid)
return true
end
-- Adds a keyword which acts as a greeting word
function KeywordHandler:addGreetKeyword(keys, parameters, condition, action)
local keys = keys
keys.callback = FocusModule.messageMatcherDefault
return self:addKeyword(keys, GreetModule.greet, parameters, condition, action)
end
-- Adds a keyword which acts as a farewell word
function KeywordHandler:addFarewellKeyword(keys, parameters, condition, action)
local keys = keys
keys.callback = FocusModule.messageMatcherDefault
return self:addKeyword(keys, GreetModule.farewell, parameters, condition, action)
end