Hello everyone! I have unsuccessfully tried to figure out how to get the closest point to a unit. I know there is a function for getting the closest unit to a point, but whats about the opposite?
The background: I am trying to create a waypoint system (I´ve seen the one Thenarden has created, but that´s not what I want) making units only move on defined points when they are issued an order to move. Eg. I put a bunch of points on a road I´ve created in the terrain editor. Now I want units to primarly use the road when they are ordered to move somewhere and only leave the road at the very last moment. I hope that doesn´t sound too confusing. :)
well you can use the .... distance from point to point. and use that to determine which points are closest.
I could get more involved ...
what your trying to do would be rather complex at first glance. Lots of logic for something that sounds simple.
I would suggest using an array of points and using the units custom values to track where in the array of points your unit is currently where they are headed. and where they need to stop.
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
I thought about the problem and decided the easiest way to get the closest point to a unit would be creating dummy units (eg. pineapples) at each point and use the closest unit to point function.
And of course remove the dummy unit after the unit got the order to move.
Hello everyone! I have unsuccessfully tried to figure out how to get the closest point to a unit. I know there is a function for getting the closest unit to a point, but whats about the opposite?
The background: I am trying to create a waypoint system (I´ve seen the one Thenarden has created, but that´s not what I want) making units only move on defined points when they are issued an order to move. Eg. I put a bunch of points on a road I´ve created in the terrain editor. Now I want units to primarly use the road when they are ordered to move somewhere and only leave the road at the very last moment. I hope that doesn´t sound too confusing. :)
~ petrov
well you can use the .... distance from point to point. and use that to determine which points are closest.
I could get more involved ...
what your trying to do would be rather complex at first glance. Lots of logic for something that sounds simple.
I would suggest using an array of points and using the units custom values to track where in the array of points your unit is currently where they are headed. and where they need to stop.
@SouLCarveRR: Go
thx for the reply!
I thought about the problem and decided the easiest way to get the closest point to a unit would be creating dummy units (eg. pineapples) at each point and use the closest unit to point function. And of course remove the dummy unit after the unit got the order to move.
@petrov1: Go
the dummy units is definatly a good way to go... you could just hide them as well.
Using my point system maybe more reliable if you have tons and tons of stuff going on.