• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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