I did some googling and couldn't find anything. I'm a huge fan of figuring things out on my own, but unfortunately I've been thinking about this for quite some time and can't figure it out.
I want to pick within the conditions an object that is closest to another object.
For example, I have automatic fighter ships that fly around and shoot stuff with limited ammo. When the Ammo is depleted, they are sent to the command center to replenish. This works fine.
However, when there are two command centers for them, I'd rather make them a bit smarter. I want each individual ammo-depleted fighter to decide which command center is closest to them and pick it. The actions are taken care of. I just can't figure out how to make a unit Pick an object based on distance.