Distance between mob and player?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Roboethicist
Posts: 8
Joined: Thu Jan 14, 2016 9:25 pm

Distance between mob and player?

#1 Post by Roboethicist » Wed Oct 11, 2017 3:54 am

I'm trying to find a way to get the distance between my my character and a targeted mob so that I can plan my profile maxtargetdistance accordingly. ROM API unitdistance function appears to no longer work and I was hoping someone would have a workaround. Thanks.

User avatar
ThulsaDoom
Posts: 128
Joined: Mon Oct 19, 2015 2:46 pm

Re: Distance between mob and player?

#2 Post by ThulsaDoom » Mon Oct 16, 2017 2:52 pm

You can use function: player:distanceToTarget()
It will return distance between you and target, then you can compare with skill range.

This is the original function:

Code: Select all


function CPawn:distanceToTarget()
	self:updateTargetPtr()
	if( self.TargetPtr == 0 ) then return 0; end;

	local target = CPawn.new(self.TargetPtr);
	target:updateXYZ()
	self:updateXYZ()
	local tx,ty,tz = target.X, target.Y, target.Z;
	local px,py,pz = self.X, self.Y, self.Z;

	return math.sqrt( (tx-px)*(tx-px) + (ty-py)*(ty-py) + (tz-pz)*(tz-pz) );
end


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest