• 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 Npc Problem(when i say Hi)

tetra20

DD
Joined
Jan 17, 2009
Messages
1,315
Solutions
4
Reaction score
323
Location
Egypt
i got a little problem with my npcs when i say hi it give me error in console
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
line 381
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 :p
 
Last edited:
Back
Top