Dynamic Groups – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{GVI|A3|" to "{{GVI|arma3|")
m (Some wiki formatting)
Line 1: Line 1:
{{TOC|side}}
{{TOC|side}}
{{GVI|arma3|1.42}}
{{GVI|arma3|1.42}}
=<div class="center" style="width: auto; margin-left: auto; margin-right: auto;">DYNAMIC GROUPS</div>=
= <div class="center">DYNAMIC GROUPS</div> =


[[File:-Arma 3- DynamicGroups.jpg|thumb|center|alt=Dynamic Groups|Dynamic Groups]]
[[File:-Arma 3- DynamicGroups.jpg|thumb|center|alt=Dynamic Groups|Dynamic Groups]]


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


==== InitServer.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.
Create a file in your mission root folder and name it [[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.
Onto this file, copy & paste the following line, which will make the server initialize the Dynamic Groups framework.
Onto this file, copy & paste the following line, which will make the server initialize the Dynamic Groups framework.


Option 1
Option 1
<syntaxhighlight lang="cpp">
<sqf>["Initialize"] call BIS_fnc_dynamicGroups; // Initializes the Dynamic Groups framework</sqf>
["Initialize"] call BIS_fnc_dynamicGroups; // Initializes the Dynamic Groups framework
</syntaxhighlight>


Option 2
Option 2
<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</sqf>
["Initialize", [true]] call BIS_fnc_dynamicGroups; // Initializes the Dynamic Groups framework and groups led by a player at mission start will be registered
Note that this function has no effect if called on a machine which is not the server.
</syntaxhighlight>
Note that, this function has no effect if called in a machine which is not the server.
 
 


==== InitPlayerLocal.sqf ====
==== InitPlayerLocal.sqf ====
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.
Create another file in your mission root folder and name it [[Event Scripts#initPlayerLocal.sqf|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.
Onto this file, copy & paste the following line, which will make a client/player initialize the Dynamic Groups framework.


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


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




== Accessing the Dynamic Groups interface ==
== Accessing the Dynamic Groups interface ==
The Dynamic Groups interface is tied to '''TeamSwitch''' action, and it is default keybind is '''U'''.


The Dynamic Groups interface is tied to the '''TeamSwitch''' action, and it is default keybind is {{Controls|U}}.




Line 51: Line 39:


If you would like to register a group manually (same as a player clicking '''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 you would like to register a group manually (same as a player clicking '''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:
<syntaxhighlight lang="cpp">
<sqf>
if (isServer) then
if (isServer) then
{
{
  private _group = group player;
private _group = group player;
  private _leader = leader _group;
private _leader = leader _group;
  private _data = [nil, "Awesome Group", false]; // [<Insignia>, <Group Name>, <Private>]
private _data = [nil, "Awesome Group", false]; // [<Insignia>, <Group Name>, <Private>]


  ["RegisterGroup", [_group, _leader, _data]] call BIS_fnc_dynamicGroups;
["RegisterGroup", [_group, _leader, _data]] call BIS_fnc_dynamicGroups;
};
};
</syntaxhighlight>
</sqf>
 
See [[BIS_fnc_dynamicGroups]] in the Functions Viewer for more sub-functions and their parameters.


See '''BIS_fnc_dynamicGroups''' in Functions Viewer or [[BIS_fnc_dynamicGroups]] for more sub-functions and their parameters:


{{GameCategory|arma3|Editing}}
{{GameCategory|arma3|Editing}}
[[Category:Introduced with Arma 3 version 1.42]]
[[Category:Introduced with Arma 3 version 1.42]]

Revision as of 23:21, 30 January 2023

Arma 3 logo black.png1.42

DYNAMIC GROUPS

Dynamic Groups
Dynamic Groups

Installation

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

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

["Initialize"] call BIS_fnc_dynamicGroups; // Initializes the Dynamic Groups framework

Option 2

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

Note that this function has no effect if called on a machine which is not the server.

InitPlayerLocal.sqf

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:

["InitializePlayer", [player]] call BIS_fnc_dynamicGroups; // Initializes the player/client side Dynamic Groups framework

Option 2:

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


Accessing the Dynamic Groups interface

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


Additional Functionality

If you would like to register a group manually (same as a player clicking 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.