Pick every number 1-5 ?

Status
Not open for further replies.

311

311

Level 4
Joined
May 12, 2019
Messages
73
I am trying to make a trigger that picks every number 1-5 with just one easy trigger instead of needing 5 different triggers.


Basically I have a unit type variable array, named Undead Units [15]
and of course I set each undead unit to a variable 1-15

In most cases I just reference one unit like Undead units [5] for example, or random # 1-15, which helps a lot for what I am doing
but my question is how would make a trigger that says something similar to "Create Undead units [1-5]"

as I have many units types, and different ranges, so I want to avoid making 5 different triggers just to do the above, then would need even more for like 1-15 for example
 
Level 43
Joined
Feb 27, 2007
Messages
5,461
  • For each (Integer A) from 1 to 5 do (Actions)
    • Loop - Actions
      • Unit - Create 1 UndeadUnits[(Integer A)] for Player 12 (Brown) at ...
If you want a non consecutive sequence (for example 2,3,4,8,9,10) you'll either have to use multiple loops or do something different. If you want "N random units out of 15 possibilities" that also requires something different.
 

311

311

Level 4
Joined
May 12, 2019
Messages
73
thanks, it worked, and it should also help with other similar triggers I had to make them also easier
 
Status
Not open for further replies.
Top