• 🏆 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!

[Solved] Will 'pick every unit -and do- remove picked unit from the game' cause a leak?

Status
Not open for further replies.
Level 7
Joined
Nov 10, 2010
Messages
87
I definitely don't want any leaks because my triggers often repeat themselves throughout the game.

It's just I noticed normal unit groups only seam capable of containing 12 units at a time and I tested this trigger and it can do whole armies. But it seams to not be able to do an infinite amount of units either, not sure. I wonder how many units it can do, anyone know? Doesn't matter if it leaks so that's more important, does it leak???

Will these triggers circled in red cause a leak?
NOTE: I attached the level too.
View attachment 277721
 
Level 14
Joined
Aug 31, 2009
Messages
775
You need to do something more like

Set (GroupVariable) = Units of Type [MyUnitType]

Then do actions on that group.

Lastly, do: Custom script: call DestroyGroup(udg_GroupVariable)


Easier still, just do something like this:
  • Set GrouptoRemove = (Units owned by (Player 1 (Red)))
  • Unit Group - Pick Every Unit in (GrouptoRemove) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or (Any Conditions are True)
            • Unit-Type of Picked Unit equal to English Captain 1
            • Unit-Type of Picked Unit equal to English Captain 2
            • Unit-Type of Picked Unit equal to .... (etc.)
            • ....
        • Then - Actions
          • Unit - Remove (Picked Unit) from the game.
        • Else - Actions
  • Custom script: call DestroyGroup(udg_GrouptoRemove)
 
Level 22
Joined
Aug 27, 2013
Messages
3,973
You can also do it like this

  • Custom script: Set bj_wantDestroyGroup = true
  • Unit Group - Pick Every Unit in (Units owned by (Player 1 (Red))) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or (Any Conditions are True)
            • Unit-Type of Picked Unit equal to English Captain 1
            • Unit-Type of Picked Unit equal to English Captain 2
            • Unit-Type of Picked Unit equal to .... (etc.)
            • ....
        • Then - Actions
          • Unit - Remove (Picked Unit) from the game.
        • Else - Actions
 
Status
Not open for further replies.
Top