| 03-16-2006, 02:36 AM | #1 |
I have searched hi and low about this hack. But everywhere I see it mentioned it is spoken of as if everybody has always known what it is. Surely at some point it was first discovered and explained somewhere. I want to know what everybody else knows! What is it good for and how is it used? |
| 03-16-2006, 02:39 AM | #2 |
It is not a hack. It is a global variable. Blizzard uses it in some of the blizzard.j functions that take group variables. In those functions, when that variable is true they will automatically destroy the group they took as an argument and set that variable back to false. Typical Example://=========================================================================== 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 |
| 03-16-2006, 02:39 AM | #3 |
Edit: Damn you Vex, beat me to it. |
| 03-16-2006, 03:41 AM | #4 |
I'm sorry. I still don't really understand. So bj_wantDestroyGroup is something that basically always equal to true or false? I was thinking maybe it could save the hassle of capturing unit groups as a variable and then destroying the group when you are done with it. Am I mistaken? |
| 03-16-2006, 06:06 AM | #5 |
Yep, it's simply a value that is either true or false. |
| 03-16-2006, 12:54 PM | #6 |
Boolean yo, if true it destroys the group you popped into the action, like say if you go: Trigger: When it goes to do this action it will destroy the group created by "Pick every unit". But a warning, unless I am mistaken if you destroy a global group you MUST use Trigger: Set g = (Random 4 units from (Units in (Playable map area)))Edit: What I mean by the last statement is that "Add unit to group" will not work if you destroy the group, I believe you must use the set group = grouptype |
| 03-16-2006, 05:16 PM | #7 |
That is correct. I tried setting it to true a while back and it screwed up other triggers in my map. |
| 03-16-2006, 08:06 PM | #8 |
Hmm, so I could actually say Trigger: instead of Trigger: ? So I could save a bunch of lines of code if I just set bj_wantDestroyGroup = true at the beginning of the game and specifically set it false around things where I didn't want it to destroy the group? Do I have that all right? Would that screw up things like the Caster System or other systems? |
| 03-16-2006, 08:08 PM | #9 |
IT could save a pair of lines but I actually think that if you can destroy the group manually it is 100% times better to do so, cause the boolean has a couple of unexpected behaviours |
| 03-17-2006, 03:29 PM | #10 |
For sure, its just easier to use a temporary group, like you would for locations. Then destroy it afterwards with JASS:call DestroyGroup(udg_NAME) And no you can't just set it true once, because within the bj functions that use it they reset it to false in the case that you don't want it to fire off anymore. Won't screw up the caster system since from what I have seen Vex does it all manually, may take longer the first time but its better than relying on some lame bj functions. |
