i got a little problem with my npcs when i say hi it give me error in console
the line 558 in npc handler
line 381
Thanks
Code:
Error - NpcScript Interface
data/npc/scripts/runes.luaLonCreatureSay
description:
data/npc/lib/npcsystem/npchandler.lua:558: attempt to call global 'getDistanceto' <a nil value
data/npc/lib/npcsystem/npchandler.lua:558: in function 'isInRange'
data/npc/lib/npcsystem/npchandler.lua:381: in function 'onCreatureSay'
the line 558 in npc handler
Lua:
function NpcHandler:isInRange(cid)
local distance = getDistanceTo(cid) or -1
if(distance == -1) then
return false
end
return (distance <= self.talkRadius)
end
Lua:
function NpcHandler:onCreatureSay(cid, class, msg)
local callback = self:getCallback(CALLBACK_CREATURE_SAY)
if(callback == nil or callback(cid, class, msg)) then
if(self:processModuleCallback(CALLBACK_CREATURE_SAY, cid, class, msg)) then
if(not self:isInRange(cid)) then
return
end
if(self.keywordHandler ~= nil) then
if((self:isFocused(cid) and (class == TALKTYPE_PRIVATE_PN or NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT)) or not self:isFocused(cid)) then
local ret = self.keywordHandler:processMessage(cid, msg)
if(not ret) then
local callback = self:getCallback(CALLBACK_MESSAGE_DEFAULT)
if(callback ~= nil and callback(cid, class, msg)) then
if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
self.talkStart[cid] = os.time()
else
self.talkStart = os.time()
end
end
else
if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
self.talkStart[cid] = os.time()
else
self.talkStart = os.time()
end
end
end
end
end
end
end
Thanks
Last edited: