Distance between units

Status
Not open for further replies.
The distence between 2 units is the same as the distance between 2 points.

To do that you need to run a mathematical formula to find the hypotnuse of the right angled triangle between the 2 points.

it is basicly the square root of the square of the distance between X1 X2 and the square of the distance between Y1 and Y2 added together.

SquareRoot((X1-X2)(X1-X2)+(Y1-Y2)(Y1-Y2))
 
Last edited:
You missed squaring it, super :p

SquareRoot(deltaX * deltaX + deltaY * deltaY )

And in GUI, it's as RedBlade said. However, you'll want to clean up the leaks, or you'll get slowness/delay issues after awhile.

Eg.

  • Set loc = (Position of (Triggering Unit))
  • -------- do something with loc --------
  • Custom script: call RemoveLocation(udg_loc)
where loc is a global point variable
 
Well, to actually answer the question he asked...

Action
- Set IntVar = (Integer((Distance between (Position of [Unit1]) and (Position of [Unit2]))))
 
Distance between two units can be stored in a real variable. Good luck finding it, considering you couldnt even find the proper forum which was right above this one.

Moved.

did i post this in the Map Development forum?
O___O my bad, at least i thought i clicked on the world editor forum XD

and yea thx to those who helped...
 
Status
Not open for further replies.
Back
Top