• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Set bj_wantDestroyGroup = true

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
Simple question. Why is this trigger bad?

  • Custom script: set bj_wantDestroyGroup = true
According to this thread: http://www.thehelper.net/threads/custom-script-set-bj_wantdestroygroup-true.132841/

They do the same thing and are equally efficient, only difference being that bj
is easier to implement. But I hear tonnes of people saying to stay away from them,
or dont use them too often and set the group then destroy instead. Why?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
You may be confusing BJ's with each other.
In general, a BJ is bad, but a bj isn't.

The lower-case bj is just a prefix of a variable (like bj_lastCreatedUnit, which is just a unit variable).
There is nothing wrong with these variables and there's no reason not to use them.

The upper-case BJ is a function. In GUI, it would be something like "Unit - Create Units facing angle".
When you convert this to JASS, it becomes a stupid function
JASS:
function CreateNUnitsAtLoc takes integer count, integer unitId, player whichPlayer, location loc, real face returns group
    call GroupClear(bj_lastCreatedGroup)
    loop
        set count = count - 1
        exitwhen count < 0
        call CreateUnitAtLocSaveLast(whichPlayer, unitId, loc, face)
        call GroupAddUnit(bj_lastCreatedGroup, bj_lastCreatedUnit)
    endloop
    return bj_lastCreatedGroup
endfunction
Most of the GUI-functions are BJ's like this (some bigger, some smaller).
They're bad because it can usually be done in a much simpler way that requires less operations.


Conclusion: nothing wrong with bj_wantDestroyGroup. It's a boolean variable and you can use it whenever you want.
When using JASS, stay away from BJ functions though (in JNGP these are colored in red by default).

I hope that answers your question.
 
Status
Not open for further replies.
Top