Originally Posted by
Xelper
Hi everyone, I know sheuron used to have some sort of "Follow any mob" type coding that used my PQR_UnitInfo functions. I looked through his profile/data stuff but couldn't find it. Does anyone happen to have that?
Not sure if this is what your after.
Ability "Follow Target" in an old "xrn" Interrupt profile I still have.
PHP Code:
function Walk(x1,y1,x2,y2,r2)
local angle = math.atan2(y1-y2,x2-x1) + r2 - math.pi
if ( angle < -0.5 and angle > -math.pi ) or angle >= math.pi then
TurnRightStop() TurnLeftStart()
elseif ( angle > 0.5 and angle < math.pi ) or angle < -math.pi then
TurnLeftStop() TurnRightStart()
else
TurnRightStop() TurnLeftStop()
end
if sqrt( (x1-x2)^2 + (y1-y2)^2 ) > 5
and angle < math.pi/2 and angle > -math.pi/2
then MoveForwardStart() else MoveForwardStop() end
end
if UnitAffectingCombat("player") and not UnitExists("target") then TargetNearestEnemy() end
local Px,Py,Pz,Pr = PQR_UnitInfo("player")
if UnitExists("target") then
local x,y = PQR_UnitInfo("target")
Walk(x,y,Px,Py,Pr)
elseif not IsMouselooking() then
MoveForwardStop() TurnLeftStop() TurnRightStop()
end