Creating units with loop

216199

Member
Reaction score
11
A very simple trigger, yet it does not work. I don't understand.

Code:
Begin 
    Events
        Map initialization
    Conditions
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (PlayerNumber[(Integer A)] controller) Equal to User
                        (PlayerNumber[(Integer A)] slot status) Equal to Is playing
                    Then - Actions
                        Unit - Create 1 Peasant for PlayerNumber[(Integer A)] at (Center of start <gen>) facing 0.00 degrees
                    Else - Actions
                        Do nothing
 
1

1337D00D

Guest
The other players are used and controlled by a non-computer player, right?
And PlayerNumber[] has been set to a player?

Did it only create a peasant for you?

If it entirely does not work, try this trigger:

Code:
Blah
    Events
        Map initialization
    Conditions
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Player((Integer A))) slot status) Equal to Is playing
                        ((Player((Integer A))) controller) Equal to User
                    Then - Actions
                        Unit - Create 1 Peasant for (Player((Integer A))) at (Center of (start <gen>)) facing Default building facing degrees
                    Else - Actions
                        Do nothing
 

216199

Member
Reaction score
11
Yes, when I use that function there are no problems, but I don't see a reason why it shouldn't work with a variable.
 

elmstfreddie

The Finglonger
Reaction score
203
You gotta set each array on the Player variable to the player the array number represents in a separate trigger first.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top