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

[Help]Function NpcHandler:isInRange(cid)

RenegadeThePox

New Member
Joined
Oct 7, 2007
Messages
62
Reaction score
2
Hello, a im using the OTSERV 0.6.3 sources, and i want know if possibles i change this code to other function for this sources...

function NpcHandler:isInRange(cid)
local distance = getDistanceTo(cid) or -1
if(distance == -1) then


Have another term to replace the "getDistanceTo(cid)" ?

Thanks.
 
Well, try using this function instead:
Code:
function getDistanceBetween(firstPosition, secondPosition)
	local xDif = math.abs(firstPosition.x - secondPosition.x)
	local yDif = math.abs(firstPosition.y - secondPosition.y)

	local posDif = math.max(xDif, yDif)
	if(firstPosition.z ~= secondPosition.z) then
		posDif = posDif + 9 + 6
	end
	return posDif
end
Code:
local distance = getDistanceBetween(getCreaturePosition(getNpcCid()), getCreaturePosition(cid))
 
function NpcHandler:isInRange(cid)
local distance = getDistanceTo(cid) or -1
if distance == -1 then
return false
end

return (distance <= self.talkRadius)
end
??
u mean that function is in lib of trunk jiddo and there isn't getDistanceTo(cid)?
if yes then u can report it here:
http://otfans.net/project.php?projectid=1
 
Last edited:
Back
Top