Posted: Fri Aug 10, 2018 1:24 am Post subject: Pythagoras theorem in Lua Help
Hi guys. First of all I just want to admit that Math isn't my strong suit. I could use some help with this problem. Now I have the addresses for Z and X coordinates for my current location and the Z and X coordinates for the thing I have targeted in the game I'm playing and I want to be able to calculate the distance in meters between my own character and my target. I believe the way to do this is using Pythagoras Theorem.
local MyZCoords = ReadFloat("blablabla")
local MyXCoords = ReadFloat("blablabla")
local TargetZCoords = ReadFloat("blablabla")
local TargetXCoords = readFloat("blablabla")
If someone could help me fill in the part of the script involving the Pythagoras theorem I'd appreciate it. I meannnnn really appreciate it. Thanks in advance
a=math.abs(TargetYCoords-MyYCoords) --abs is not really necessary but just to make things understandable)
b=math.abs(MyXCoords-TargetXCoords)
c=math.sqrt(a*a+b*b)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum