Jump to content

Dynamic Groups: Check if group is already registered and assign player to it

Recommended Posts


I'm using https://community.bistudio.com/wiki/Dynamic_Groups and I want to make a script which checks if a group with a certain name already exists and if not create it and assigns the player to it. In case the group already exists it should assign the player to this group. Does anyone have an idea how to do this?



Share this post

Link to post
Share on other sites

Hey mate.

The BIKI entry about dynamic groups that you have linked above already gives you a good amount of information about the system.

Have a look at this snippet, as presented on the BIKI page:

Create a group inside the dynamic groups system.
From: https://community.bistudio.com/wiki/Dynamic_Groups#Additional_Functionality

if (isServer) then
   private ["_group", "_leader", "_data"];
   _group  = group player;
   _leader = leader _group;
   _data   = [nil, "Awesome Group", false]; // [<Insignia>, <Group Name>, <Private>]
   ["RegisterGroup", [_group, _leader, _data]] call BIS_fnc_dynamicGroups;

Here you can see the "register group" command in action. It takes a few parameters, as you can see above:

    	0: (Engine) Group to be assigned as dynamic group <GROUP>
        1: Leader of the (engine) group to be assigned <UNIT/GROUP LEADER>
        2: Data array, as follows: <ARRAY>
        	0: Insignia of the group's members <INSIGNIA>
            	1: Name of the group <STRING>
            	2: Private group <BOOL>


You also have a command available, that grants you access to all groups that are currently in existence:

_allGroups = ["GetAllGroups"] call BIS_fnc_dynamicGroups;


This could help you with writing a check for groups with a specific name and write a function that creates the according function if the name(s) have not yet been used.

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