Does "Unit Group - Remove" leaks?

asipo

New Member
Reaction score
15
I have been wandering some people use
Trigger:
  • Custom Script - call DestroyGroup( udg_myUnitGroup )

instead of
Trigger:
  • Unit Group - Remove all units from myUnitGroup

That have been made by world editor in GUI

  1. Does the Unit Group - Remove leaks?
  2. What the difference between them?
  3. What is leaks by the way?
  4. How to make Custom Script like Custom Script - call DestroyGroup( udg_myUnitGroup )
 
Unit Group - Remove does not leak by itself.

A leak is short for "memory leak", which is what happens if something is stored in memory but never cleared. This happens in Warcraft if you set a variable to a new value without destroying the old value (only for some kinds of variables; you can read more here).

A unit group won't leak if you only add and remove units from it, but if you ever use Set Variable to create a group of units, you will need to destroy that group when you're done using it, before setting it to a value again.
 
Emm.. from the last sentence, what is Set Variable?
Issit a global variable in Trigger Editor -> Variables (Ctrl+B) -> New Variable (Ctrl+N)
 
It depends

If you always use the same group and full/clean it won't leak.

If you make many array groups, then it will leak.
 
Emm.. from the last sentence, what is Set Variable?
It's when you set a value to a variable. For example:
Trigger:
  • Actions
    • Set TempGroup = (Units within 500.00 of TempPoint)
    • -------- do things with the unit group here --------
    • Custom script: call DestroyGroup(udg_TempGroup)


However, you don't need to destroy the group if you only add and remove units from it:
Trigger:
  • Actions
    • Unit Group - Add (Last created unit) to TempGroup
    • -------- do things with the unit group here --------
    • Unit Group - Remove all units from TempGroup
 
and "set variable" is an action....in fact, its one of the first. when you make a new action just look down the default list a few lines ;]

and btw i think its amazing that you know about custom scripts in removing leaks from triggers before you know about setting a variable :thup:
 
however, you don't need to destroy the group if you only add and remove units from it:
Trigger:
  • actions
    • unit group - add (last created unit) to tempgroup
    • -------- do things with the unit group here --------
    • unit group - remove all units from tempgroup

This is the last thing you want to do, just so you know OP.
 
Ok, now i understand better
But how to make custom script? like
Trigger:
  • Custom Script - call DestroyGroup( udg_myUnitGroup )
 
General chit-chat
Help Users
  • The Helper The Helper:
    It is weird seeing a way more realistic users online number
  • The Helper The Helper:
    Happy Tuesday Night!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top