Dynamic Groups – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Fix)
 
(24 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{GVI|A3|1.42|category}}
<div class="float-right">[[File:arma3_DynamicGroups.jpg|thumb|center|alt= Dynamic Groups|Dynamic Groups]]</div>
=<div class="center" style="width: auto; margin-left: auto; margin-right: auto;">DYNAMIC GROUPS</div>=
{{GVI|arma3|1.42}}


{{warning|
{{TOC}}
'''''This page contains basic informations about how to use the system in your missions.'''''


'''''This system is not considered done and it is still subject to change.'''''


'''''It may change rapidly, use it carefully on your own risk.'''''
== Installation ==
}}


[[File:-Arma 3- DynamicGroups.jpg|thumb|center|alt=Dynamic Groups|Dynamic Groups]]
To add the Dynamic Groups functionality to your mission do the following steps:


==Installation==
To add Dynamic Groups functionality to your mission do the following steps:


Create a file in the mission root directory named [[Event Scripts#initServer.sqf|initServer.sqf]] (if you don't have it there already).
This file is executed only on the server, when the mission starts.


Into this file, copy & paste one of these two lines to make the server initialise the Dynamic Groups framework:
<sqf>
["Initialize"] call BIS_fnc_dynamicGroups; // initialises the Dynamic Groups framework
// or
["Initialize", [true]] call BIS_fnc_dynamicGroups; // initialises the Dynamic Groups framework and groups led by a player at mission start will be registered
</sqf>


====InitServer.sqf====
Create a file in your mission root folder and name it '''initServer.sqf''' (if you don't have it there already). This file is executed only on the server, when the mission starts.
Onto this file, copy & paste the following line, which will make the server initialize the Dynamic Groups framework.


Option 1
Create another file in the mission root directory named [[Event Scripts#initPlayerLocal.sqf|initPlayerLocal.sqf]] (if you don't have it there already).
<syntaxhighlight lang="cpp">
This file is executed only by machines which have a human player when the mission starts (every machine  but a dedicated server or a [[Arma 3: Headless Client|headless client]] - see [[hasInterface]]).
["Initialize"] [[call]] [[BIS_fnc_dynamicGroups]]; // Initializes the Dynamic Groups framework
</syntaxhighlight>


Option 2
Into this file, copy & paste one of these two lines to make a client/player initialise the Dynamic Groups framework:
<syntaxhighlight lang="cpp">
<sqf>
["Initialize", [true]] [[call]] [[BIS_fnc_dynamicGroups]]; // Initializes the Dynamic Groups framework and groups led by a player at mission start will be registered
["InitializePlayer", [player]] call BIS_fnc_dynamicGroups; // initialises the player/client side Dynamic Groups framework
</syntaxhighlight>
// or
Note that, this function has no effect if called in a machine which is not the server.
["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups; // initialises the player/client side Dynamic Groups framework and registers the player group
</sqf>




== Dynamic Groups Interface Access ==


====InitPlayerLocal.sqf====
The Dynamic Groups interface is tied to the '''TeamSwitch''' action, and its default keybind is {{Controls|U}}.
Create another file in your mission root folder and name it '''initPlayerLocal.sqf'''. (if you don't have it there already). This file is executed only by machines which have a human player when the mission starts, which means everyone but a dedicated server, will actually execute this file.
Onto this file, copy & paste the following line, which will make a client/player initialize the Dynamic Groups framework.


Option 1:
<syntaxhighlight lang="cpp">
["InitializePlayer", <nowiki>[</nowiki>[[player]]<nowiki>]</nowiki>] [[call]] [[BIS_fnc_dynamicGroups]]; // Initializes the player/client side Dynamic Groups framework
</syntaxhighlight>


Option 2:
== Additional Functionality ==
<syntaxhighlight lang="cpp">
["InitializePlayer", <nowiki>[</nowiki>[[player, true]]<nowiki>]</nowiki>] [[call]] [[BIS_fnc_dynamicGroups]]; // Initializes the player/client side Dynamic Groups framework and registers the player group
</syntaxhighlight>


If you would like to register a group manually (same as a player clicking the '''CREATE''' button in the UI) use '''RegisterGroup'''.
Please note that the leader you pass must be the actual leader of the given group, for example:
<sqf>
if (isServer) then
{
private _group = group player;
private _leader = leader _group;
private _data = [nil, "Awesome Group", false]; // [<Insignia>, <Group Name>, <Private>]


["RegisterGroup", [_group, _leader, _data]] call BIS_fnc_dynamicGroups;
};
</sqf>


==Accessing the Dynamic Groups interface==
{{Feature|informative|See [[BIS_fnc_dynamicGroups]] in the Functions Viewer for more sub-functions and their parameters.}}
The Dynamic Groups interface is tied to '''TeamSwitch''' action, and it's default state keyboard key is '''T'''.
 
 
{{GameCategory|arma3|Editing}}
[[Category:Introduced with Arma 3 version 1.42]]

Latest revision as of 21:54, 27 May 2023

Dynamic Groups
Dynamic Groups

Arma 3 logo black.png1.42


Installation

To add the Dynamic Groups functionality to your mission do the following steps:


Create a file in the mission root directory named initServer.sqf (if you don't have it there already). This file is executed only on the server, when the mission starts.

Into this file, copy & paste one of these two lines to make the server initialise the Dynamic Groups framework:

["Initialize"] call BIS_fnc_dynamicGroups; // initialises the Dynamic Groups framework // or ["Initialize", [true]] call BIS_fnc_dynamicGroups; // initialises the Dynamic Groups framework and groups led by a player at mission start will be registered


Create another file in the mission root directory named initPlayerLocal.sqf (if you don't have it there already). This 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).

Into this file, copy & paste one of these two lines to make a client/player initialise the Dynamic Groups framework:

["InitializePlayer", [player]] call BIS_fnc_dynamicGroups; // initialises the player/client side Dynamic Groups framework // or ["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups; // initialises the player/client side Dynamic Groups framework and registers the player group


Dynamic Groups Interface Access

The Dynamic Groups interface is tied to the TeamSwitch action, and its default keybind is U.


Additional Functionality

If you would like to register a group manually (same as a player clicking the CREATE button in the UI) use RegisterGroup. Please note that the leader you pass must be the actual leader of the given group, for example:

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

See BIS_fnc_dynamicGroups in the Functions Viewer for more sub-functions and their parameters.