sharpy
New Member
- Joined
- Jan 4, 2010
- Messages
- 77
- Reaction score
- 0
I'm working on a 9.6 TFS v0.2.14 server and I am getting repeating errors from several of my npcs.
I know enough lua to edit most scripts but I am stumped on this, I know something is missing from the last lines but I don't know what was removed...
here is the error i keep receiving:
here are the parts of code for npchandler.lua that I have:
from line 580-598 error is line 596
Other lines: 460-486 error line 462
If anyone would help me I would greatly appreciate it!
I know enough lua to edit most scripts but I am stumped on this, I know something is missing from the last lines but I don't know what was removed...
here is the error i keep receiving:
Code:
[08/07/2013 15:19:03] Lua Script Error: [Npc interface]
[08/07/2013 15:19:03] data/npc/scripts/Sam.lua:onThink
[08/07/2013 15:19:03] data/npc/lib/npcsystem/npchandler.lua:596: table index is nil
[08/07/2013 15:19:03] stack traceback:
[08/07/2013 15:19:03] [C]: in function '__newindex'
[08/07/2013 15:19:04] data/npc/lib/npcsystem/npchandler.lua:596: in function 'say'
[08/07/2013 15:19:04] data/npc/scripts/Sam.lua:18: in function 'callback'
[08/07/2013 15:19:04] data/npc/lib/npcsystem/npchandler.lua:462: in function 'onThink'
[08/07/2013 15:19:04] data/npc/scripts/Sam.lua:13: in function <data/npc/scripts/Sam.lua:13>
here are the parts of code for npchandler.lua that I have:
from line 580-598 error is line 596
PHP:
function NpcHandler:say(message, focus, publicize, shallDelay, delay)
if(type(message) == "table") then
return self:doNPCTalkALot(message, delay or 10000, focus)
end
if self.eventDelayedSay[focus] then
self:cancelNPCTalk(self.eventDelayedSay[focus])
end
local shallDelay = not shallDelay and true or shallDelay
if(NPCHANDLER_TALKDELAY == TALKDELAY_NONE or shallDelay == false) then
selfSay(message, focus, publicize and TRUE or FALSE)
return
end
stopEvent(self.eventSay[focus])
>>>> self.eventSay[focus] = addEvent(function(x) if isPlayer(x[3]) then doCreatureSay(x[1], x[2], TALKTYPE_PRIVATE_NP, false, x[3], getCreaturePosition(x[1])) end end, self.talkDelayTime * 1000, {getNpcCid(), message, focus})
end
end
Other lines: 460-486 error line 462
PHP:
function NpcHandler:onThink()
local callback = self:getCallback(CALLBACK_ONTHINK)
>>>> if(callback == nil or callback()) then
if(NPCHANDLER_TALKDELAY == TALKDELAY_ONTHINK) then
for cid, talkDelay in pairs(self.talkDelay) do
if(talkDelay.time ~= nil and talkDelay.message ~= nil and os.time() >= talkDelay.time) then
selfSay(talkDelay.message, cid, talkDelay.publicize and TRUE or FALSE)
self.talkDelay[cid] = nil
end
end
end
if(self:processModuleCallback(CALLBACK_ONTHINK)) then
for pos, focus in pairs(self.focuses) do
if(focus ~= nil) then
if(not self:isInRange(focus)) then
self:onWalkAway(focus)
elseif(self.talkStart[focus] ~= nil and (os.time() - self.talkStart[focus]) > self.idleTime) then
self:unGreet(focus)
else
self:updateFocus()
end
end
end
end
end
end
If anyone would help me I would greatly appreciate it!