• 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.

A kinda noobish question

Status
Not open for further replies.
Level 9
Joined
Apr 23, 2011
Messages
460
Hello. I've been getting helped by a lot of people (Most notably Pharaoh_) and he/she has told me to put "set bj_wantDestroyGroup = true" in front of all unit groups. Why is this? What does this do? Should it be put in front of every unit group action in my map(s)?
 
Level 10
Joined
Apr 25, 2009
Messages
296
It should be put infront of non-variable unit groups.

Such as Picked every unit in range()

Here's what the unit group bj looks like, and it also shows why its so useful:

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
With set bj_wantDestroyGroup infront, it removes the leak in GUI, by destroying the group when its done.
 
Last edited:
It destroys the leak created by the unit group action. Every time you use
  • Unit Group - Pick every unit in (Units in (Playable Map Area)) and do (Actions)
    • Loop - Actions
that line creates a unit group (the units in the playable map area). In order to clear the leak, you need to allocate the said group. So, the script set bj_wantDestroyGroup = true will instantly destroy the group after its creation.

Alternatively, you can set the group in a variable, with which you have a direct allocation:
  • Set Group = (Units in (Playable Map Area))
  • Unit Group - Pick every unit in Group and do (Actions)
    • Loop - Actions
  • Custom script: call DestroyGroup (udg_Group)
P.S. I'm a "he" :)
P.S.2 Late!
 
Status
Not open for further replies.
Top