Detect closest target on the map.

Arre

You can change this now in User CP.
Reaction score
1
How do I make something like this?


Every 0.25

pick closest unit of "triggering unit" (it should check the whole map.)

Set position[1]= position of triggering unit
Set position[2]= position of closest unit

if
X value of position[1] is greater than or equal to position[2]
then
do this
else
do another this :p

I've searched for this in the forums but it only seem to detect the closest unit within a range of 600. I tried to increase the radius but it still dont work.

If your'e wondering what i am doing im making a map something like super smash bros. You are on a "2d" arena and fighting.
And this trigger should be for the "intelligent" bots im trying to do. If the closest unit is to the left of the bot he should walk left and if the closest unit is to the right he should walk right.

i hope you will understand!
 

Happy

Well-Known Member
Reaction score
71
pick every unit on the map. then loop through them and set TempPoint to position of picked unit. then set a real variable TempReal to distance between position[1] and TempPoint. create a second real ShortestDistance. and then check in an if/then/else loop whether ShortestDistance>TempReal. if it is do nothing and if not set ShortestDistance to TempReal and set another variable to the picked unit.

i hope you got what i mean. :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top