Hopefully you understand my explanation.
Unit group, all units that match <town hall> allied to player, set total1 = total1 +1;
Unit group, all units that match <town hall> allied to player, set distance1 = distance from hero to <picked unit> if distance1 > distance2, set distance2 = distance1, total1 = total1 - 1, if total1 <= 0: if distance1 < distance2, spawn hero at distance2, else spawn hero at distance1.
That's what I would do.
Last edited by Vegavak; 12-02-2008 at 10:44 PM..
Reason: replaced if with else. I hate editing.
|