• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

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