| 05-25-2004, 09:29 PM | #1 |
Greetings. I need to order around a large amount of units every so often. The amount of units that I want to order can be pretty much any size. Typically, a person in this situation might do something like: Code:
Unit Group - Pick every unit in unitGroupDummy and do (Actions)
Loop - Actions
Unit - Order (Picked unit) to Attack-Move To pointDummyCode:
Unit Group - Order unitGroupDummy to Attack-Move To pointDummy Therefore, I'm trying to come up with a way to order unit groups of any given size to do things in chunks of 12. The best system that I have right now is thus: Code:
Set intGroupNumber = 1
Set intDummy = 0
Unit Group - Pick every unit in unitGroupDummy and do (Actions)
Loop - Actions
Set intDummy = (intDummy + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
intDummy Greater than or equal to 12
Then - Actions
Set intDummy = 0
Set intGroupNumber = (intGroupNumber + 1)
Else - Actions
Unit Group - Add (Picked unit) to unitgroupArraySubdummy[intGroupNumber]
For each (Integer A) from 1 to intGroupNumber, do (Actions)
Loop - Actions
Unit Group - Order unitgroupArraySubdummy[(Integer A)] to Attack-Move To pointDummy |
| 05-26-2004, 02:00 AM | #2 |
Perhaps you could pick a random 12 units from the unit group and then give them order. Following that, remove them from the unit group. You can repeat this action until there are no units left and then stop. Hope this helps! |
| 05-26-2004, 03:14 AM | #3 |
How would I go about repeating it until there are no units left? In the GUI, there's no Do-While that I am aware of. |
| 05-26-2004, 08:24 PM | #4 |
Just make a loop from 1 to (number of units in unit group) if you are removing a unit at a time or (number of units in unit group/12) if you are removing them by a dozen. If you want a sexy system (lol what a name), maybe you could first select all melee units and move them in groups of 12, then all ranged, then all casters? That way you get formations of knights-only followed by formations of archers. |
