• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

trigger or else

Status
Not open for further replies.
Level 4
Joined
Aug 5, 2011
Messages
99
  • gold
    • Events
      • Time - Every 15.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Player - Add (100 x (Number of units in (Units owned by (Player((Integer A))) of type Farm))) to (Player((Integer A))) Current gold
edit: added map so u can copy-paste :D
 

Attachments

  • test.w3x
    16.4 KB · Views: 57
Last edited:
Level 3
Joined
Apr 18, 2012
Messages
47
"For each (Integer A) from 1 to 12" means that Integer A will take the values 1, 2, 3, ..., 12 every time the event fires. Effectively this means that the Loop - Actions will look like this when they are fired.

Player - Add (100 x (Number of units in (Units owned by (Player((1))) of type Farm))) to (Player((Integer A))) Current gold
Player - Add (100 x (Number of units in (Units owned by (Player((2))) of type Farm))) to (Player((Integer A))) Current gold
Player - Add (100 x (Number of units in (Units owned by (Player((3))) of type Farm))) to (Player((Integer A))) Current gold

.
.
.


Player - Add (100 x (Number of units in (Units owned by (Player((12))) of type Farm))) to (Player((Integer A))) Current gold

In other words the action in Loop - Actions will run once for each value that Integer A takes. So YES, this will affect all players from 1 to 12. And this is how you loop actions. There is no other way to loop actions in GUI triggers except these "For Each" actions.
 

Br0

Br0

Level 4
Joined
May 4, 2012
Messages
102
Yes WhiteDeath is right, to fix this all you have to do is have three triggers, and a unitgroup. One of the triggers is when the structure has been completed then add it to the unitgroup. After that you make the other trigger with the peroidic timer event or timer expires event, and pick every unit in the unitgroup then add the gold from number of picked units. Then the third trigger to detect when the unit dies to remove it from the unitgroup. I think that is how it is done, well somewhat close because it isn't specific.
 
Status
Not open for further replies.
Top