Your best bet would probably be to run a fastloop through your units and store the distance into one of their alterable values. As you are going through the loop, store the id of the unit and it's distance if it the distance value is lower than the one from the previous loop.
yes, but how would i check the distance? I know 360 extension but it needs a lot of events to work properly.
What's my best option?
And i think that going throught each of enemies, check, for each unit on my side, could be quite laggy.
I know that 360 has find fixed of closest. But that doesn't work very well often.
That should work Put that in a value
Its always a good idea to test such explanations in a seperate frame an display the value with a counter to see how it works.
Edited by the Author.
EDIT: i didnt recognized that you have already solved the problem. Anyway mayby its interessting for others