Help .. Calculate Is if in range of attack?

10/23/2017 16:57 edmer#1
Hi all... I am new using autoit...
I try create one bot .. for now all is ok ... but, i try to attack enemy if is in distance of my attack range.. i use the Memoryread for read the cord.. of my position and position of my enemy .. ok example my cord is x= 1193.75 y= 197.25

Ok.. How calculate if is in my range of attack? :S if my range example is 20

I only search for attack all enemy in this range :.. 1203.75,127.25 ... 1173.75,177.25 .. is in range of 20... help me pliss? :s
how calculate if my enemy if in this range
10/23/2017 19:19 elmarcia#2
$dy = Enemy_Y - Player_Y
$dx = Enemy_X - Player_X
$dz = Enemy_Z - Player_Z
$3dDistance = sqrt($dy*dy + $dx*$dx + $dz*$dz) //on 3d games
$2dDistance = sqrt($dx*$dx + $dy*$dy)//2d games
10/24/2017 19:40 edmer#3
Ty Bro !! i go to test :3
10/31/2017 09:43 lenclstr746#4
Quote:
Originally Posted by edmer View Post
Ty Bro !! i go to test :3
its work ??? share you script pls :)
11/01/2017 09:47 florian0#5
Quote:
Originally Posted by lenclstr746 View Post
its work ???
Of course this works. Its just basic maths. It applys for all games, you just need to figure out where to get the 2d or 3d coordinates from.