What i need it to do is to pck every Unit type - flag in the map area, assign it a random custom value, then assign that same custom value to all the units within a certain range. Basiclly a way to associate all the units with a certain "Town." What i have now, works... but sometimes it skips some units and i know it's not because they were out of range. is there an easier way to do this?
What i have so far:
I'm thinking it might have something to do with the (Random unit from (Units within 1200.00 of (Position of (Picked unit)) part... I figure that if there is only one Flag within 1200 of the unit in question, that will be the one selected by rule of default, right? (i've ensured that there is always a flag within 1200 of a unit that this needs to apply to.)
any ideas?
What i have so far:
Trigger:
- Association
- Events
- Map initialization
- Conditions
- Actions
- Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Flag)) and do (Unit - Set the custom value of (Picked unit) to (Integer((Random real number between 100.00 and 9999.00))))
- Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Not equal to Flag)) and do (Unit - Set the custom value of (Picked unit) to (Custom value of (Random unit from (Units within 1200.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Flag)))))
- Events
I'm thinking it might have something to do with the (Random unit from (Units within 1200.00 of (Position of (Picked unit)) part... I figure that if there is only one Flag within 1200 of the unit in question, that will be the one selected by rule of default, right? (i've ensured that there is always a flag within 1200 of a unit that this needs to apply to.)
any ideas?