Distance between mob and player?
-
- Posts: 8
- Joined: Thu Jan 14, 2016 9:25 pm
Distance between mob and player?
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.
- ThulsaDoom
- Posts: 128
- Joined: Mon Oct 19, 2015 2:46 pm
Re: Distance between mob and player?
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:
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
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest