---
name: "BIS_fnc_EXP_camp_balanceGroup"
type: function
status: ok
groups: ["Campaign"]
arma3_since: "1.62"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_EXP_camp_balanceGroup
revid: 379562
updated: 2026-10-31T13:53:31Z
---

# BIS_fnc_EXP_camp_balanceGroup

*Function · Campaign · Arma 3 v1.62*

## Description

Reduces the size of a [group](../commands/group.md) depending on the number of connected players, assuming the Apex campaign's maximum of 4 players.
The wanted unit count is `ceil (unitCount * playerCount / 4)` (players counted with [BIS_fnc_listPlayers](../functions/BIS_fnc_listPlayers.md)). The last `minCount max (unitCount - wantedCount)` units of the group are selected for deletion, skipping the group leader and, if *excludeVehicleRoles* is [true](../commands/true.md), units that are the driver, gunner or commander of their vehicle; skipped units are not replaced by others. The selected units are deleted with [deleteVehicle](../commands/deleteVehicle.md) (units in a vehicle are first moved to [-100, -100, 0] ASL), stopping as soon as the group has *minCount* units or fewer.

The function shows an error and does nothing if the group is null, has no living, non-fleeing unit, or has fewer than *minCount* units.

The Apex campaign missions call it from `initServer.sqf` and their mission flow FSMs, always as `[_group, 2, true]`.

> [!NOTE]
> Because *minCount* is also the smallest number of units selected for deletion, a group with more than *minCount* units loses units even when 4 players are connected (unless the selected units are all skipped).

## Syntax

```sqf
[group, minCount, excludeVehicleRoles] call BIS_fnc_EXP_camp_balanceGroup
```

**Parameters:**

- `group`: [Group](../topics/Group.md) - the group to balance
- `minCount`: [Number](../topics/Number.md) - (Optional, default 1) the number of units the group must keep
- `excludeVehicleRoles`: [Boolean](../topics/Boolean.md) - (Optional, default [true](../commands/true.md)) [true](../commands/true.md) to never delete units that are the driver, gunner or commander of a vehicle

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
// on the server, as in the Apex campaign
{
    [_x, 2, true] call BIS_fnc_EXP_camp_balanceGroup;
} forEach [BIS_grp_AA_1, BIS_grp_AA_2, BIS_grp_AA_3];
```

## See also

[BIS_fnc_listPlayers](../functions/BIS_fnc_listPlayers.md) · [deleteVehicle](../commands/deleteVehicle.md)

<sub>Source: [BI Community Wiki — BIS fnc EXP camp balanceGroup](https://community.bistudio.com/wiki/BIS_fnc_EXP_camp_balanceGroup) (revision 379562).</sub>
