call RemoveGroup?

Icyculyr

I'm a Mac
Reaction score
68
How do I remove a unit group? I can do call RemoveLocation(), what about groups?

Kind Regards
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
call DestroyGroup(group)

However, destroying groups is usually not necessary. When using a group for instant enumerations, it's good to have a global group variable that is created group at initialization; Just use Clear Group (GroupClear(group) in Jass) on it when you're done.

If you get into Jass more, you can search for group utilities for recycling groups that you need to use for a duration.


Recycling groups is more efficient.
 

Icyculyr

I'm a Mac
Reaction score
68
Thanks guys,

Could I use it in this context?

Trigger:
  • UnitCircles
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
        • Loop - Actions
          • Set PN = ((Player number of (Picked player)) - 1)
          • Set ugGroups[4] = (Units owned by (Picked player) matching ((Unit-type of (Matching unit)) Equal to Circle Runner))
          • Unit Group - Pick every unit in ugGroups[4] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is An Ancient) Equal to True
                • Then - Actions
                  • Set pTPoints[3] = (Position of (Picked unit))
                  • Set pTPoints[4] = (pTPoints[3] offset by (Real((Custom value of (Picked unit)))) towards ((Facing of (Picked unit)) + 3.60) degrees)
                  • Unit - Move (Picked unit) instantly to pTPoints[4], facing ((Facing of (Picked unit)) + 3.60) degrees
                  • Custom script: call RemoveLocation(udg_pTPoints[3])
                  • Custom script: call RemoveLocation(udg_pTPoints[4])
                • Else - Actions
          • Custom script: call DestroyGroup(udg_ugGroups[4])


Kind Regards
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
I prefer the custom script

Both calling DestroyGroup and setting the bj_wantDestroyGroup global require Custom Script.

Hmm I see, is that better than clearing the group though?

Kind Regards

All the Pick every unit in <GROUP>... functions will automatically check bj_wantDestroyGroup to see if it is true just before the function ends. If it is, it will automatically call DestroyGroup. They do the exact same thing as you would do. Setting the global variable means that you don't have create a temp group variable of your own, however. It's personal preference, just know that EVERY function that uses groups does not automatically destroy the group if the global variable is true. Only the Pick every unit... functions do that (AFAIK).
 

Avaleirra

Is back. Probably.
Reaction score
128
I was referring to the post above my last post where he was asking whether clearing groups or using customscipt was better
 

Icyculyr

I'm a Mac
Reaction score
68
Can I use call GroupClear(udg_MyGroup)? is that better than using call DestroyGroup(udg_MyGroup)?

Kind Regards
 

Hellohihi

New Member
Reaction score
42
Can I use call GroupClear(udg_MyGroup)? is that better than using call DestroyGroup(udg_MyGroup)?

Kind Regards

I've seen people say that GroupClear leaves shadow units behind in the group.

So for me, i'll rather use the DestroyGroup function.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top