zapat 56 Posted November 14, 2012 I am wondering about the rules of empty groups. I have made some experiments, but as always I got some not-fully-satisfying answers. I have a group O-1-1:A. It has one alive man. Unit count is 1. Alive unit count is 1. Group exists. I shoot the man: Unit count is 1. Alive unit count is 0. Group exists. I add a man: Unit count is 2. Alive unit count is 1. Group exists. After 2 seconds: Unit count is 1. Alive unit count is 1. Group exists. I shoot the man: Unit count is 1. Alive unit count is 0. Group exists. After like 30 seconds: Unit count is 0. Group exists. I didn't have patience to wait if group disappears. :) So my question is: what are the current rules for empty groups? I know that the group for a dead man is always grpNull. But how is it the other way around? -when do the dead units get deleted from unit list? (If I added another unit to the group consisting of one dead, the dead got deleted after 2 seconds instead of like 30) -when does the empty group get deleted? Does it get deleted at all? Or is it recycled? What if the group is referenced later on? Then the always lingering question: why do I need this? I am working on a some sort of unit cacheing method, where one unit is always on. Now I need to know for how long can I refill the same group with men... Share this post Link to post Share on other sites
seba1976 98 Posted November 14, 2012 The group is never deleted unless you do it. That's why garbage collector's techniques delete groups with no alive units. Share this post Link to post Share on other sites
kylania 568 Posted November 14, 2012 The group exists until you delete the group even if it has no units in it. That's why if you're going to make a ridiculous amount of groups part of your body removal system should be to delete the group using deleteGroup. Share this post Link to post Share on other sites
zapat 56 Posted November 14, 2012 Thanks guys, I did not know this. I mean I wasn't aware of it: I always use deleteGroup after deleting a group. :) Kylania: and what happens, if I do make a ridiculous amount of groups? (AFAIK there's been no group limit recently) I mean do I HAVE TO delete them, or it just costs some memory, and CPU when allGroups is used? Maybe I should try it, right? :) Share this post Link to post Share on other sites
kylania 568 Posted November 14, 2012 You can only have 144 groups per side I think it is. I think they just don't create after that? Not sure, usually if you have that many groups it's so laggy and chaotic it's just not fun. :) So yeah, if you have too many groups you must delete them to make more, or reuse them! :) Share this post Link to post Share on other sites
[frl]myke 14 Posted November 14, 2012 (AFAIK there's been no group limit recently) Hmm...if i'm not wrong there is a group limit of 144 groups per side (not faction). Share this post Link to post Share on other sites
zapat 56 Posted November 14, 2012 Yes, you are right: I must've misread something somewhere. Just tried it and group limit is really 144 per side. After that no group is created, and nullGrp is returned for "created" group. 288 groups don't cause any lag tho, if all are empty. So it is only administration. :) I need to keep an eye on this then: I am planning a long mission. Share this post Link to post Share on other sites
roguetrooper 2 Posted November 15, 2012 Doesn't the game automatically (without any modules) delete empty groups after a few minutes? Share this post Link to post Share on other sites
seba1976 98 Posted November 15, 2012 Doesn't the game automatically (without any modules) delete empty groups after a few minutes? Nope, that's exactly the opposite of what we're saying :). Share this post Link to post Share on other sites
Sarge 1 Posted March 29, 2013 Might be worth to mention here that the game DOES make the group a nul group when all units have been removed. Group is still existing, but cant be addressed anymore by its name. count allGroups returns the number of "valid" groups. If you try to access allGroups select (count allGroups), you get a null value, if you try allGroups select ((count allGroups) +1) you get a division by zero. I might stand corrected, but that's what my test missions seem to do. Anybody knows a way to address an empty group AFTER the last unit left it? Share this post Link to post Share on other sites
zapat 56 Posted March 29, 2013 (edited) I am seeing this behaviour in A3 although I did reference the empty group earlier in A2. And it seemed to be working. It is working now. See the following script: _grp = createGroup west; _grp createUnit ["USMC_Soldier" , getPos player, [], 5,"FORM"]; player sidechat str _grp; waitUntil{sleep 0.1; {alive _x} count units _grp == 0}; player sidechat "alldead- "+str _grp; sleep 5; _grp createUnit ["USMC_Soldier" , getPos player, [], 5,"FORM"]; player sidechat "fresh- "+str _grp; Works all right, group is recycleable. Edited March 29, 2013 by zapat Share this post Link to post Share on other sites
seba1976 98 Posted March 30, 2013 The group exists until you delete the group even if it has no units in it. That's why if you're going to make a ridiculous amount of groups part of your body removal system should be to delete the group using deleteGroup. That's the rule, gents. Share this post Link to post Share on other sites
Sarge 1 Posted April 13, 2013 I am seeing this behaviour in A3 although I did reference the empty group earlier in A2. And it seemed to be working.It is working now. See the following script: _grp = createGroup west; _grp createUnit ["USMC_Soldier" , getPos player, [], 5,"FORM"]; player sidechat str _grp; waitUntil{sleep 0.1; {alive _x} count units _grp == 0}; player sidechat "alldead- "+str _grp; sleep 5; _grp createUnit ["USMC_Soldier" , getPos player, [], 5,"FORM"]; player sidechat "fresh- "+str _grp; Works all right, group is recycleable. Only as long as you have stored the group object somewhere. Try to address that group via allgroups .... Share this post Link to post Share on other sites