HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Picking closest unit?

01-26-2004, 03:41 PM#1
Biflspud
I'm attempting to make homing missiles, and I've run into a little snag. If there's only one valid target on the map, the homing behavior runs fine, but since I'm using Random Unit from Unit Group, the missiles run around like idiots if there are multiple targets on the map.

Here's the trigger as it stands currently:
Code:
Unit - Make (Picked unit) face (Random unit from (Units within
 100000000.00 of (Position of (Picked unit)) matching ((((Matching unit)
 is Mechanical) Equal to True) and ((((Matching unit) belongs to an
 enemy of (Owner of (Picked unit))) Equal to True) and ((Custom value
 of (Matching unit)) over 0.00 seconds

It doesn't matter what I change the range to, even at 100 range, they loop around like fools. Which is amusing, but so not what I want them to do (if you have some need for swarmers, however, the above code works great)

Is there some more direct means of picking the closest of all valid targets?
01-26-2004, 03:48 PM#2
Vexorian
http://kattana.users.whitehat.dk/viewfunc.php?id=67

hope you know how to use that function
01-26-2004, 04:16 PM#3
Biflspud
Uh... <scratching head> No. I've not used JASS before, so this is all C++ to me.

I'll do what I can with it, if I can figure out how to implement it. Any quick pointers?