---
name: "targets"
type: command
status: ok
groups: ["Object Detection"]
arma3_since: "1.70"
locality: {"argument": "global", "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/targets
revid: 377208
updated: 2026-01-01T11:46:32Z
---

# targets

*Command · Object Detection · Arma 3 v1.70*

Locality: arguments **global**

## Description

Retrieves list of given unit targets matching specified filter. If the filter is not specified, all targets are returned.

> [!NOTE]
> If a unit is provided, the unit itself will be excluded from results. If a group is provided, its units will be excluded (even if renegades).

## Syntax

```sqf
unitOrGroup targets [enemyOnly, maxDistance, sides, maxAge, alternateCenter]
```

**Parameters:**

- `unitOrGroup`: [Object](../topics/Object.md) or Arma 3 v2.12 [Group](../topics/Group.md) - unit or group which target knowledge is retrieved
- `enemyOnly`: [Boolean](../topics/Boolean.md) - (Optional, default [false](../commands/false.md)) [true](../commands/true.md) to include only enemy targets, [false](../commands/false.md) to include all targets
- `maxDistance`: [Number](../topics/Number.md) - (Optional, default -1) maximum **2D** distance based on target's expected position; use 0 to ignore the filter
- `sides`: [Array](../topics/Array.md) of [Side](../topics/Side.md)s - (Optional, default `[]`) array of accepted sides; use `[]` to ignore the side filter
- `maxAge`: [Number](../topics/Number.md) - (Optional, default 0) max. target age, targets that are known to unit for longer than maxAge are ignored; use 0 to ignore the maxAge filter
- `alternateCenter`: [Array](../topics/Array.md) - (Optional, default *unitOrGroup**s position) alternate (2D or 3D) position used for** 2D*' distance check

**Returns:** [Array](../topics/Array.md) - *unitOrGroup*'s targets matching the criteria

## Examples

### Example 1

```sqf
private _targets = _unit targets [false, 300, [east, sideEnemy]]; // all targets of east or renegade side in 300m
```

### Example 2

```sqf
private _targets = _unit targets [true, 300]; // enemy targets in 300m
```

### Example 3

```sqf
private _targets = _unit targets []; // all targets
```

## See also

[targetsQuery](../commands/targetsQuery.md) · [nearTargets](../commands/nearTargets.md) · [targetsAggregate](../commands/targetsAggregate.md) · [targetKnowledge](../commands/targetKnowledge.md) · [knowsAbout](../commands/knowsAbout.md) · [reveal](../commands/reveal.md) · [forgetTarget](../commands/forgetTarget.md) · [setTargetAge](../commands/setTargetAge.md) · [getHideFrom](../commands/getHideFrom.md) · [side](../commands/side.md)

<sub>Source: [BI Community Wiki — targets](https://community.bistudio.com/wiki/targets) (revision 377208).</sub>
