Jump to content

Is there an script for distance between 2 units ?


Anski

Recommended Posts

Hi,

 

is it possible to know the distance between 2 units?

 

condition : unit1 (helico player) distance unit2 (soldier or static object) ---> action ...

 

ty

 

edit : for example distance is : distance > 100, distance < 100, ...


Edited by Anski
Link to comment
Share on other sites

You could use the old school approach of calculating the distance between two 2d vectors, or use MIST for it, since MIST already has a function for that.

 

Old school approach would be to get the 2d points of both units, then use the following:

point1 = {x1,y1}
point2 = {x2,y2}
xd = x2-x1
yd = y2-y1
distance = squareroot(xd*xd + yd*yd)

 

This would return the 2d distance between both points.

 

Cheers

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...