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

Question about leak

Status
Not open for further replies.
Level 12
Joined
Nov 3, 2013
Messages
989
  • Trigger
    • Events
    • Conditions
    • Actions
      • For each (Integer Temp_Int[0]) from 1 to SomeVar, do (Actions)
        • Loop - Actions
          • Set Some_UnitGroup[Temp_Int[0]] = (Units in SomeRegion[Temp_Int[0]])
          • Unit Group - Pick every unit in Some_UnitGroup[Temp_Int[0]] and do (Actions)
            • Loop - Actions
              • Some Actions
              • Custom script: set bj_wantDestroyGroup = true
Would set "bj_wantDestroyGroup = true" remove "Some_UnitGroup" even though it was made before the loop?

Don't really know why you wouldn't just call destroy group but I were just wondering.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Setting it to true has to be done before using the group, while if you want to use DestroyGroup you'll have to set it to a variable earlier.

Pick every unit in... is this:

JASS:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
endfunction
 
Status
Not open for further replies.
Top