Arma 3 Scripting

Command in Groups, Object Detection

units

Also available as Markdown and JSON, or read the original wiki page.

Description

Returns an array with all the units in the group or unit's group, or all units belonging to a certain side.

Syntax

units type

Parameters:

Returns: Array of Objects - if type is a destroyed object, an empty array is returned

Examples

Example 1

_myUnitCount = count units player;

Example 2

_isInMyGroup = _soldier1 in units player;

Example 3

private _unitsEast = units opfor;

Example 4

// both methods are the same, the latter is preferred for performance reason
units group player;        // [B Alpha 1-1:1 (R3vo), B Alpha 1-1:2, B Alpha 1-1:3, B Alpha 1-1:4, B Alpha 1-1:5, B Alpha 1-1:6, B Alpha 1-1:7, B Alpha 1-1:8]
units player;            // [B Alpha 1-1:1 (R3vo), B Alpha 1-1:2, B Alpha 1-1:3, B Alpha 1-1:4, B Alpha 1-1:5, B Alpha 1-1:6, B Alpha 1-1:7, B Alpha 1-1:8]

See also

group · allGroups · groups · allUnits · playableUnits · switchableUnits · vehicles

Community notes

Kronzky

The returned array on MP clients is not updated when team members die (only when they are deleted). (Tested on VBS2)

Ilias38rus

Seems to always return a list with the same order as the leader's squad menu.