• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

efficient way to limit number of units picked?

Status
Not open for further replies.
Level 15
Joined
Jul 9, 2008
Messages
1,553
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
 
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.
Back
Top