{"name":"Arma 3: Dynamic Groups","title":"Arma 3: Dynamic Groups","type":"topic","url":"https://community.bistudio.com/wiki/Arma_3:_Dynamic_Groups","revid":341445,"updated":"2023-05-27T19:54:35Z","aliases":["Arma 3 Dynamic Groups","Dynamic Groups"],"markdown":"Arma 3 v1.42\n\n### Installation\n\nTo add the Dynamic Groups functionality to your mission do the following steps:\n\nCreate a file in the mission root directory named initServer.sqf (if you don't have it there already).\nThis file is executed only on the server, when the mission starts.\n\nInto this file, copy & paste one of these two lines to make the server initialise the Dynamic Groups framework:\n\n```sqf\n[\"Initialize\"] call BIS_fnc_dynamicGroups;            // initialises the Dynamic Groups framework\n// or\n[\"Initialize\", [true]] call BIS_fnc_dynamicGroups;    // initialises the Dynamic Groups framework and groups led by a player at mission start will be registered\n```\n\nCreate another file in the mission root directory named initPlayerLocal.sqf (if you don't have it there already).\nThis file is executed only by machines which have a human player when the mission starts (every machine but a dedicated server or a headless client - see hasInterface).\n\nInto this file, copy & paste one of these two lines to make a client/player initialise the Dynamic Groups framework:\n\n```sqf\n[\"InitializePlayer\", [player]] call BIS_fnc_dynamicGroups;            // initialises the player/client side Dynamic Groups framework\n// or\n[\"InitializePlayer\", [player, true]] call BIS_fnc_dynamicGroups;    // initialises the player/client side Dynamic Groups framework and registers the player group\n```\n\n### Dynamic Groups Interface Access\n\nThe Dynamic Groups interface is tied to the **TeamSwitch** action, and its default keybind is <kbd>U</kbd>.\n\n### Additional Functionality\n\nIf you would like to register a group manually (same as a player clicking the **CREATE** button in the UI) use **RegisterGroup**.\nPlease note that the leader you pass must be the actual leader of the given group, for example:\n\n```sqf\nif (isServer) then\n{\n    private _group = group player;\n    private _leader = leader _group;\n    private _data = [nil, \"Awesome Group\", false]; // [<Insignia>, <Group Name>, <Private>]\n\n    [\"RegisterGroup\", [_group, _leader, _data]] call BIS_fnc_dynamicGroups;\n};\n```\n\n> [!NOTE]\n> See BIS_fnc_dynamicGroups in the Functions Viewer for more sub-functions and their parameters.","sections":[{"heading":null,"level":1,"markdown":"Arma 3 v1.42"},{"heading":"Installation","level":3,"markdown":"To add the Dynamic Groups functionality to your mission do the following steps:\n\nCreate a file in the mission root directory named initServer.sqf (if you don't have it there already).\nThis file is executed only on the server, when the mission starts.\n\nInto this file, copy & paste one of these two lines to make the server initialise the Dynamic Groups framework:\n\n```sqf\n[\"Initialize\"] call BIS_fnc_dynamicGroups;            // initialises the Dynamic Groups framework\n// or\n[\"Initialize\", [true]] call BIS_fnc_dynamicGroups;    // initialises the Dynamic Groups framework and groups led by a player at mission start will be registered\n```\n\nCreate another file in the mission root directory named initPlayerLocal.sqf (if you don't have it there already).\nThis file is executed only by machines which have a human player when the mission starts (every machine but a dedicated server or a headless client - see hasInterface).\n\nInto this file, copy & paste one of these two lines to make a client/player initialise the Dynamic Groups framework:\n\n```sqf\n[\"InitializePlayer\", [player]] call BIS_fnc_dynamicGroups;            // initialises the player/client side Dynamic Groups framework\n// or\n[\"InitializePlayer\", [player, true]] call BIS_fnc_dynamicGroups;    // initialises the player/client side Dynamic Groups framework and registers the player group\n```"},{"heading":"Dynamic Groups Interface Access","level":3,"markdown":"The Dynamic Groups interface is tied to the **TeamSwitch** action, and its default keybind is <kbd>U</kbd>."},{"heading":"Additional Functionality","level":3,"markdown":"If you would like to register a group manually (same as a player clicking the **CREATE** button in the UI) use **RegisterGroup**.\nPlease note that the leader you pass must be the actual leader of the given group, for example:\n\n```sqf\nif (isServer) then\n{\n    private _group = group player;\n    private _leader = leader _group;\n    private _data = [nil, \"Awesome Group\", false]; // [<Insignia>, <Group Name>, <Private>]\n\n    [\"RegisterGroup\", [_group, _leader, _data]] call BIS_fnc_dynamicGroups;\n};\n```\n\n> [!NOTE]\n> See BIS_fnc_dynamicGroups in the Functions Viewer for more sub-functions and their parameters."}],"categories":["Arma 3: Editing","Introduced with Arma 3 version 1.42"],"groups":["General"]}