Jump to content
Sign in to follow this  
Benny.

Join command deleting the group if the unit is alone

Recommended Posts

Actually if you use "Join" over a group which has only 1 unit, the group itself will be deleted (which is somewhat logical).

I'm currently building a squad join/leave system but before going any further, i'd like to know if anyone know a way to keep the group without having to create an extra unit before leaving the group (and deleting afterward)

Share this post


Link to post
Share on other sites

Don't think you have a choice really....but someone else may know better.

EDIT: After answering this question here.... http://forums.bistudio.com/showthread.php?p=2090749#post2090749

I think you just save the group name....and then maybe you can rejoin it again...even if the group is empty. If not...you should be able to recreate the group once you have a name. Worth a try.

Edited by twirly

Share this post


Link to post
Share on other sites

I'll do some test but i think that the original group and it's variable is gone (null), i think i'll have to stick to the createUnit / join / deleteVehicle process :p

Share this post


Link to post
Share on other sites
I'll do some test but i think that the original group and it's variable is gone (null), i think i'll have to stick to the createUnit / join / deleteVehicle process :p

Alternatively, you can recreate the group just after leaving it. Empty groups don't (appear to) get deleted until a unit joins and the leaves again.

Share this post


Link to post
Share on other sites
Alternatively, you can recreate the group just after leaving it. Empty groups don't (appear to) get deleted until a unit joins and the leaves again.

The problem is that the net stored variables are gone (which i'm trying to avoid :p), in the worst case scenario i can always copy paste the variables, but i think that it's a bit messy especially with broadcasted setVariables.

Something ideal (for me) would be an optionnal true/false param to select whether to delete the group or not if no units remain:

[unit1] join [_grp, false]

Share this post


Link to post
Share on other sites
The problem is that the net stored variables are gone (which i'm trying to avoid :p)

As in you've SetVariable-d on the groups?

If so, it looks like the only way to do it is to create a dummy unit before you leave the group.

Either that, or refactor things so that you don't rely on SetVariable-ing a group that may be deleted. (but this depends on how complex the things you're setting are..)

Something ideal (for me) would be an optionnal true/false param to select whether to delete the group or not if no units remain:

[unit1] join [_grp, false]

It might be cleaner to have a per group flag set,

_group disableAutoGroupDelete true;

or such. But you'll probably need to push a CIT ticket pretty hard to get it implemented, especially when there's almost always going to be a usable workaround.

Share this post


Link to post
Share on other sites

Store what you need to store in an array that's named after the group. That won't go away!

If you're feeling adventurous test this... I haven't tested it.

To store the items....

_items = [_item1,_item2,_item3];

for "_i" from 0 to (count items)-1 do {
   call compile format ["%1_Group_Array set [count %1_Group_Array,_items select _i]",_group];
   sleep 0.01;
};

To retrieve them....

call compile format ["_array = %1_Group_Array",_group];

_item1 = _array select 0;
_item2 = _array select 1;
_item3 = _array select 2;

Edited by twirly

Share this post


Link to post
Share on other sites
Store what you need to store in an array that's named after the group. That won't go away!

The idea is to have dynamic groups (nonamed > synced in editor > stored in an array on the server > pushed to clients), i'll see which is more network consuming (recreating a group & setting the var or respawning a unit in the group and deleting it), thanks for the help still :)

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  

×