• 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.

efficient way to limit number of units picked?

Status
Not open for further replies.
Level 15
Joined
Jul 9, 2008
Messages
1,552
when using
  • Unit Group - Pick every unit in (range of POINT matching bla bla bla bla) and do (Actions)
    • Loop - Actions
how can i limit the number of units

e.g when making a AoE entangle spell and using dummy units to cast entangle on the group of units. whats a good way so it will only cast the entangle on say 3 units instead of the 10 or so units in the group.
making max number of units the spell can hit 3
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Before picking the units, set a variable to 0.
Then inside the loop put an IF. The condition is that your variable is under 3 or whatever you want the limit to be.
For action, do the entangle thing and after that increase your variable by 1.
For the else part you don't need anything.
 
Status
Not open for further replies.
Top