• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Lua Script Error for NPC's

Wryhn

New Member
Joined
Nov 27, 2012
Messages
7
Reaction score
0
[29/11/2012 15:44:24] Lua Script Error: [Npc interface]
[29/11/2012 15:44:24] data/npc/scripts/Jessica.lua:onThink
[29/11/2012 15:44:24] data/npc/lib/npcsystem/npchandler.lua:596: table index is nil
[29/11/2012 15:44:25] stack traceback:
[29/11/2012 15:44:25] [C]: in function '__newindex'
[29/11/2012 15:44:25] data/npc/lib/npcsystem/npchandler.lua:596: in function 'say'
[29/11/2012 15:44:25] data/npc/scripts/Jessica.lua:28: in function 'callback'
[29/11/2012 15:44:25] data/npc/lib/npcsystem/npchandler.lua:462: in function 'onThink'
[29/11/2012 15:44:25] data/npc/scripts/Jessica.lua:23: in function <data/npc/scripts/Jessica.lua:23>

Currently running a 9.60 tibia with TFS 2.14.
Anyone know what is causing this problem? It happens with all BANK NPC's.
 
I searched for a similar error, try this:

Search for this in data/npc/lib/npcsystem/npchandler.lua:
LUA:
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

And replace it with:
LUA:
 function NpcHandler:say(message, focus, publicize, delay)
		if type(message) == 'table' then
			return self:doNPCTalkALot(message, delay or 10000, focus)
		end

		focus = focus or 0
		if self.eventDelayedSay[focus] then
			self:cancelNPCTalk(self.eventDelayedSay[focus])
		end

		stopEvent(self.eventSay[focus])
		self.eventSay[focus] = addEvent(function(x) doCreatureSay(x[1], x[2], x[3] == 0 and TALKTYPE_SAY or TALKTYPE_PRIVATE_NP, false, x[3], getThingPos(x[1])) end, 1000, {getNpcCid(), message, focus})
	end

Source of similar error: http://otland.net/f16/lua-script-error-npc-interface-139947/
 
Testing it now, I also get some errors when starting the server.

[29/11/2012 21:01:06] [Warning - NpcScript::NpcScript] Can not load script: default.lua
[29/11/2012 21:01:06] cannot open default.lua: No such file or directory

I have the default.lua file in my data folder, but migth be in the wrong place? Where is it supposed to be?

- - - Updated - - -

Seems to currently work without npc errors , thanks a lot for the help!!! :)
 
Back
Top