Group Order:

Ben

New Member
Reaction score
4
Whenever a trigger is occuring in my map it seems to only work for 12 units. Will the following action:

JASS:
call GroupPointOrderLoc( udg_Unit_Group[udg_Group1, udg_Order, GetOrderPointLoc() )


only order 12 units to follow the point order. Is it this action which only works for 12 units or do I have to look elsewhere for the problem?

Thanks,

Skli
 

saw792

Is known to say things. That is all.
Reaction score
280
Yes, a unit group loop is necessary because of the 12 unit limit (which has something to do with the max units a player can select/order at a time).
 

Ben

New Member
Reaction score
4
Is it possible to loop the command without using unit group-pick every unit, but with it picking 12 different units each time?

I really need the units to move in "formation" rather than individually,

Thanks,

Skli
 

Ben

New Member
Reaction score
4
Is it possible, using Jass, to do something like:

Unit Group-pick every unit Group of 12 units in Unit_Group and do Actions.

I'm not very good with this sort of triggering :(,

Thanks,

Skli
 

saw792

Is known to say things. That is all.
Reaction score
280
Create two group variables. Use a 'Pick Every Unit...' and add the picked unit to the first unit group. Create an integer loop from 1 to (Integer((Units in group 1 / 12) + 1).Then use another integer loop from 1 to 12 and pick a random unit from the first group and add it to the second group, then remove it from the first group. Then order your second group to do what you want, and clear the second group afterwards.

So yes, it's fairly complicated, and will run one to many times if the number of units is a multiple of 12 (won't really affect anything negatively, and can be fixed with an If condition), but that's what you asked for.

EDIT: Yes, this would be much easier in JASS, but only through simpler loop conditions which doesn't really give you an advantage that is worth pursuing in this case.
 

Ben

New Member
Reaction score
4
Thanks, thats what I'm going to do then. If the number of units is not a multiple of 12, and I try and select 12 units from a unit group in which there is less than 12 units will it select all remaining units it will it not work?

Skli
 

saw792

Is known to say things. That is all.
Reaction score
280
It will add a null unit to the unit group, which does not cause problems.
 

Ben

New Member
Reaction score
4
Trigger Help

Anyone know why the following trigger is not working?

JASS:
Events
    Unit - A unit Is issued an order targeting a point
Conditions

Actions
    Set Identifier = (Custom value of (Ordered unit))
    Set Order = (String((Issued order)))
    Trigger - Turn off (This trigger)
    For each (Integer A) from 1 to 10, do (Actions)
        Loop - Actions
            Set Temp_Group[(Integer A)] = (Random 12 units from (Units in (Playable map area) matching ((((Matching unit) is in Battalion[Identifier]) Equal to True) and (((Matching unit) is in Temp_Group[((Integer A) - 1)]) Equal to False))))
            Unit Group - Add all units of Temp_Group[((Integer A) - 1)] to Temp_Group[(Integer A)]
            Custom script:   call GroupPointOrderLoc( udg_Temp_Group[GetForLoopIndexA()], udg_Order, GetOrderPointLoc() )
            Custom script:   call DestroyGroup (udg_Temp_Group[GetForLoopIndexA()-1])
    Trigger - Turn on (This trigger)


It should make all units in the Unit Group Battallion[Identifier] move to a point however it only moves 12;

Thanks,

Skli
 

averes

New Member
Reaction score
17
Any reason its Integer A from 1 to 10? Are there 10 temp groups? Are the other groups even populated with units? As it looks like right it should only move 12 units thats are in each Temp_Group[Integer A] that are also in battallion.

If you want it to move every unit in battalion just do a pick every unit in battallion and move them.

If you want them to be moved in groups of 12, one after another, then do the same as above, but pick 12 random units, and then delete each picked unit from battallion and do it again. Though unless you have a delay somewhere in the loop its just going to look like there all moving at the same time.
 

Ben

New Member
Reaction score
4
Thanks, I've attempted to do what you suggested, but it isn't working :(. Any ideas. I've probably been stupid.


Code:
     Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        (Custom value of (Ordered unit)) Greater than 0
    Actions
        Set Identifier = (Custom value of (Ordered unit))
        Set Order = (String((Issued order)))
        Trigger - Turn off (This trigger)
        For each (Integer A) from 1 to (((Number of units in Battalion[Identifier]) / 12) + 1), do (Actions)
            Loop - Actions
                Unit Group - Pick every unit in (Random 12 units from Battalion[Identifier]) and do (Actions)
                    Loop - Actions
                        Unit Group - Add (Picked unit) to Temp_Group
                        Unit Group - Remove (Picked unit) from Battalion[Identifier]
                Custom script:   call GroupPointOrderLoc( udg_Temp_Group, udg_Order, GetOrderPointLoc() )
                Unit Group - Add all units of Temp_Group to Temp_Group2
                Unit Group - Remove all units from Temp_Group
        Unit Group - Add all units of Temp_Group2 to Battalion[Identifier]
        Custom script:   call DestroyGroup (udg_Temp_Group)
        Custom script:   call DestroyGroup (udg_Temp_Group2)
        Trigger - Turn on (This trigger)
        Set Order = <Empty String>
        Set Identifier= 0

Thanks,

Skli
 

averes

New Member
Reaction score
17
Code:
     Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        (Custom value of (Ordered unit)) Greater than 0
    Actions
    Set TempInt = 3
    Unit Group - Add all units of Battallion to TempGroup
    For each (Integer A) from 1 to TempInt, do (Actions)
        Loop - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Number of units in TempGroup) Greater than or equal to 12
                Then - Actions
                    Set TempInt = (TempInt+ 1)
                    Unit Group - Pick every unit in (Random 12 units from TempGroup) and do (Actions)
                        Loop - Actions
                            Unit - Order (Picked unit) to Move To TempPoint
                            Unit Group - Remove (Picked unit) from TempGroup
                Else - Actions
                    Set TempInt = ((Integer A) + 1)

Not tested but that would be how I would go about it. Still not sure if thats exactly how you want to do it.
 

Ben

New Member
Reaction score
4
Tested it and played around with it - your trigger does work sort of. It works once. Any time I try repeating it, it doesn't work however (I'm guessing a problem with the loop - and I should be able to fix this). What I'd really like to try and do, however is to get them moving in groups of 12 to staggered locations - sort of like an army moving - am trying to modify your trigger to get the units to do this but am having no success :( getting them to even move once.

Any suggestions?

Thanks,

Skli
 

averes

New Member
Reaction score
17
My trigger actually ends up being an infinite loop, which is probably why it doesn't work after the first one. As for a 'staggered army' thing if you know where you want each group of 12 to go, and you know how many groups of 12 there will be, then just make a location array with each of the points. In the loop instead of using TempInt use the value of the number of groups of 12 you have. Then do the loop without the TempInt thing and replace TempPoint with TempPoint[Integer A] where TempPoint[] is an array of all the points you want the army to move to.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top