Jump to content
Sign in to follow this  
wyattwic

Changing sides snipplet

Recommended Posts

The 144 group limit got to me on a script I was working on, and I just wanted to share the fruits of my labor.

_temp = createGroup EAST;  //Create a EAST group.  Replace with variable as needed.
[this] joinSilent _temp;  //Join the newly created group.
[this] joinSilent grpNull; //Get out of the newly created group
deleteGroup _temp; //KILL THE NEWLY CREATED GROUP!

This allows you to change the sides of players and AI without fear of sooner or later hitting the max group limit, and without actually grouping people for AI/command purposes.  In my situation large groups of roaming AI caused issues, this took care of it.

 

 

If anyone can think of a better way, im all ears, otherwise I hope it helps someone.   It took me longer than I care to admit to come up with this.

Share this post


Link to post
Share on other sites
    if (count units _x == 0) then
            {
                deleteGroup _x;
            };
        } forEach allGroups;

You can also do something like this in order to get rid of all empty groups. Reaching the 144 group limit with frequently delete the empty groups will be pretty hard in my expierience.

Share this post


Link to post
Share on other sites
    if (count units _x == 0) then
            {
                deleteGroup _x;
            };
        } forEach allGroups;

You can also do something like this in order to get rid of all empty groups. Reaching the 144 group limit with frequently delete the empty groups will be pretty hard in my expierience.

 

 

Like you said, that's probably the easiest way to achieve proper deletion of empty groups.

Here's my attempt running in a loop able to check for groups that are protected from deletion (to temporary save waypoints using the copyWaypoints command etc.):

nul = [] spawn {
_oldcount = count allGroups;
while {alive player} do {


waituntil {!(count allGroups isEqualto _oldcount)};

{
    if (units _x isEqualTo [] AND !(_x getvariable ["NODELETE",false])) then
            {
                deleteGroup _x;
            };
} forEach allGroups;
_oldcount = count allGroups;

};
};

This will check for empty groups once the group count has changed, and will not delete groups that have a variable named "NODELETE" set to true.

 

Cheers

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×