Jump to content

Is there an script for distance between 2 units ?


Recommended Posts

Posted (edited)

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
Posted

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

Posted

ok thank you but this is not usable in the editor.

 

So necessarily, I have to use MIST ... and that's my problem ! :( I just looked without success MIST

Posted
ok thank you but this is not usable in the editor.

 

Trigger Condition -> LUA Predicate

 

Not entirely sure how it works, but I believe this is what you're looking for, with or without MIST.

  • Recently Browsing   0 members

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