• 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!

NPC talk distance

Evan

A splendid one to behold
Senator
Premium User
Joined
May 6, 2009
Messages
7,018
Solutions
1
Reaction score
1,040
Location
United States
How do I shorten the length of squares from the NPC is needed to talk to NPC?

Like if I say hi to the NPC from 7 squares away, he will react, but I want it to be a maximum of 4 squares, so if it's set at 4, then he will not react if you are 5+ squares away.

How do I change this number? I know it's somewhere in the NPC lib folder > NPCsystem, but I don't exactly know where.
 
it is in nps-lib->npcsystem.lua search fro "talkRadius" , this will work on all npc's.

Else for spesific npc you could handle functions in the npc lua file or you can check this part in same file up
LUA:
	-- Returns true if cid is within the talkRadius of this npc.
	function NpcHandler:isInRange(cid)
		local distance = getDistanceTo(cid) or -1
		if(distance == -1) then
			return false
		end

		return (distance <= self.talkRadius)
	end
 
it is in nps-lib->npcsystem.lua search fro "talkRadius" , this will work on all npc's.

Else for spesific npc you could handle functions in the npc lua file or you can check this part in same file up
LUA:
	-- Returns true if cid is within the talkRadius of this npc.
	function NpcHandler:isInRange(cid)
		local distance = getDistanceTo(cid) or -1
		if(distance == -1) then
			return false
		end

		return (distance <= self.talkRadius)
	end

Actually getDistanceTo is bugged, he should use getDistanceBetween.
 
LUA:
		local ret = NpcSystem.getParameter('talkradius')
		if(ret ~= nil) then
			npcHandler.talkRadius = tonumber(ret)
		end

What exactly is there to change?
 
Back
Top