i'm realy good in math but i'm just starting in the world of coding , i created a basic function in lua for check if a target running away from your champion , i used GetPred from Noddy Pred.
Tell me if i made a mistake , i want to learn , ty.
code :
function runningAway(target)
local d1 = GetDistance(target)
local x, y, z = GetPred(target,2,0)
local d2 = GetDistance({x=x, y=y, z=z})
local d3 = GetDistance({x=x, y=y, z=z},target)
local angle = math.acos((d2*d2-d3*d3-d1*d1)/(-2*d3*d1))
return angle%(2*math.pi)>math.pi/2 and angle%(2*math.pi)<math.pi*3/2
end
Sign In
Create Account

Back to top
Report







