Been modifying some of the profiles inside of PQR, but having some issues and was wondering if anyone might know how to help. I have it successfully following the focus and engaging in and out of combat. The part i can't get to work is when i enter combat how can i make it stay within range of the target and orient to the direction of the target like it does the focus?
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
local Px,Py,Pz,Pr = PQR_UnitInfo("player")
if UnitAffectingCombat("focus") then
AssistUnit("focus")
end
if not UnitAffectingCombat("focus") then
ClearTarget()
local x,y = PQR_UnitInfo("focus")
Walk(x,y,Px,Py,Pr)
elseif not IsMouselooking() then
MoveForwardStop()
TurnLeftStop()
TurnRightStop()
end
return true