• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

A kinda noobish question

Not open for further replies.
Level 9
Apr 23, 2011
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
Apr 25, 2009
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:

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)
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!
Not open for further replies.