• 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] For Each Integer A

Status
Not open for further replies.
Level 7
Joined
Jan 18, 2007
Messages
180
What in the hell do these actions do? I've been triggering stuff for quite a while now and have never used these since I have no idea what their purpose is. +rep for detail.
 

Attachments

  • temp.PNG
    temp.PNG
    15.4 KB · Views: 119
For each integer A, do multiple actions extends

JASS:
set bj_LOOP_INTEGER_A = 1
set bj_LOOP_INTEGER_A_MAX = 10
loop
     set bj_LOOP_INTEGER_A = bj_LOOP_INTEGER_A + 1
     exitwhen bj_LOOP_INTEGER_A > bj_LOOP_INTEGER_A_MAX
     (Actions)
endloop

Therefore the trigger will do a loop of the number you want of actions.
Basically its for:
  • Actions -
    • Unit - call Kill Unit (Hero[Integer A])
The thing above there when is inserted to a loop, the action in the loop will take the integer of the loop and use it as the index of the variable. Therefore, the action above in a loop is same as:

  • Actions -
    • Unit - call Kill Unit (Hero[1])
    • Unit - call Kill Unit (Hero[2])
    • Unit - call Kill Unit (Hero[3])
    • Unit - call Kill Unit (Hero[4])
    • Unit - call Kill Unit (Hero[5])
    • Unit - call Kill Unit (Hero[6])
    • Unit - call Kill Unit (Hero[7])
    • Unit - call Kill Unit (Hero[8])
    • Unit - call Kill Unit (Hero[9])
    • Unit - call Kill Unit (Hero[10])
 
Status
Not open for further replies.
Top