• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

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.
 
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.
Back
Top