• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

A question about custom script

Status
Not open for further replies.
Level 12
Joined
Jul 5, 2014
Messages
556
Hey guys. I'm new here, but I know this was discussed many times already, but either I can't understand something or there are just unclear details.

From what I know leaks are the still in use, but no longer required elements of the map. I don't want to mess up my map while I have no idea what I'm doing.

For example if I have a region, the RemoveLocation command will destroy it? I should use this when I don't need the region at all? It was mostly used when there was a create unit command. Is this region itself the trouble of the game create something else when a unit created and it is what must be removed?

Same question stand for groups. Destroying the group should occur if a group is completely empty or no longer used in game? (That's seems to be an obvious question, but better safe than sorry) As I read, leak occurs after every picked unit, but I don't know why.

A bit of an off-topic

I didn't find anything about this anywhere, but did you realize that the succubus unit's portrait is somewhat bugged? It is the only unit to my knowledge whose portrait freezes after about 6-8 seconds of transmission, preventing me to use them as major characters (who actually talk). Is there a fix for this?
 
Last edited:
The region does not leak, the point does. Example: Random Point In Region, Center of Region, etc.

Points only leak as well when not cached in variables.

For groups, use "set bj_wantDestroyGroup = true" before picking. Otherwise you should use variables for groups, but imo the said solution is easier if you don't have to reference the group somewhere.
 
Hmm, thanks, the point leak is now understood. So, if I destroy points, I can still use the region.

So, destroying groups custom script should be used when it's no longer necessary? If I keep creating units for a group, I don't think I should destroy them, until they are no longer needed.

I read things that leak already, it was pretty much the closest thing to clear up, although there were still gaps I didn't saw or overlooked that's why I asked.

I made an edit about succubi, it's less important, but I never found anything remotely referred to that problem.
 
I didn't find anything about this anywhere, but did you realize that the succubus unit's portrait is somewhat bugged? It is the only unit to my knowledge whose portrait freezes after about 6-8 seconds of transmission, preventing me to use them as major characters (who actually talk). Is there a fix for this?
Perhaps the anims have a pause after actually completing.
 
I see. So, I guess, I should put every center of region, point of unit, random point of region into variable and destroy them to avoid leaks.

Already variable groups aren't leak? For example if I use
  • Unit Group - Add all units of (Units in GroupRegion <gen> owned by Player 10 (Light Blue)) to Toughguys
it's not reacting to call DestroyGroup(udg_Toughguys) so I don't know if it's because the lack of leak or I'm doing something wrong.


Perhaps the anims have a pause after actually completing.

If that's the case, it is encoded within the unit. So, there's no way to fix this? It's also does that when I give succubus model to a unit that has long 'pissed' lines.
 
I see. So, I guess, I should put every center of region, point of unit, random point of region into variable and destroy them to avoid leaks.

Already variable groups aren't leak? For example if I use
Unit Group - Add all units of (Units in GroupRegion <gen> owned by Player 10 (Light Blue)) to Toughguys
it's not reacting to call DestroyGroup(udg_Toughguys) so I don't know if it's because the lack of leak or I'm doing something wrong.

'set bj_wantDestroyGroup = true' before that. The said line is useful not only in group picks but other GUI Group Functions as well.

If that's the case, it is encoded within the unit. So, there's no way to fix this? It's also does that when I give succubus model to a unit that has long 'pissed' lines.

There is however animation is not my job so I cannot fix it for you.
 
'set bj_wantDestroyGroup = true' is just leak prevention or it does something else? I'm not sure what 'useful' may refer other than that. It used with call DestroyGroup or without it? The tutorial says 'set bj_wantDestroyGroup = true' is used for non-variable groups.

I suppose it shouldn't be used if it's a constant trigger (like create units for the group - do something, then repeat the trigger).
 
Yes. Basically all non-variable group functions, including Group Picks, you should use that line.

Even if the group itself is among the variables? My picked group was added to the Toughguys which is a variable group.

As for the succubus bug, it's also a help if you can direct me somewhere where I can find fix. Googling it only brings up WoW stuff.
 
Group Picks are
'Pick every unit in <group> and do <Actions>'
Even if the group itself is among the variables?
  • Add all units of (|||Units in GroupRegion <gen> owned by Player 10 (Light Blue)|||) to Toughguys
Though the group is among a variable, it is not in a variable. Hence it will leak without wantDestroyGroup.
 
example for the win

  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
    • Loop - Actions
evaluates into:

JASS:
call ForGroupBJ( GetUnitsInRectAll(GetPlayableMapRect()), function Trig_Melee_Initialization_Func011A )
//note, the function is empty cause there is nothing inside the Loop - Actions

and the ForGroupBJ is:

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

If you dont understand it its fine, it basically stores in boolean variable whether bj_wantDestroyGroup is set or not, and after it does the callback for each and every unit and then checks if that was set, and if it was(recursive safety) set, and if it was it destroys the created group
 
Status
Not open for further replies.
Back
Top