HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Ordering Unitgroups in unit amounts greater than 12

05-25-2004, 09:29 PM#1
Panto
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 pointDummy
However, I want to use the formation behaviors that are built into Warcraft 3. If I were to, instead, do this simple trigger:
Code:
Unit Group - Order unitGroupDummy to Attack-Move To pointDummy
then it does use the formation behavior. However, it only works on the first 12 units (logically, I expect that this is because the formation behavior for player-ordered units never has to deal with more than 12 units at a time).

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
but I can't get over the feeling that this isn't a very efficient or sexy system. Can you offer better suggestions for how to go about doing this?
05-26-2004, 02:00 AM#2
Shimrra
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
Panto
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
Anitarf
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.