Anski Posted January 2, 2016 Posted January 2, 2016 (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 January 2, 2016 by Anski
Grumpy Old Man Posted January 2, 2016 Posted January 2, 2016 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
Anski Posted January 2, 2016 Author Posted January 2, 2016 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
Yurgon Posted January 2, 2016 Posted January 2, 2016 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.
Recommended Posts