---
name: "countEnemy"
type: command
status: ok
groups: ["Sides", "Object Detection"]
arma3_since: "0.50"
locality: {"argument": "global", "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/countEnemy
revid: 379405
updated: 2026-10-31T00:02:09Z
---

# countEnemy

*Command · Sides, Object Detection · Arma 3 v0.50 · introduced in Operation Flashpoint v1.00*

Locality: arguments **global**

## Description

Count how many units in the array are considered enemy to the given unit.

## Syntax

```sqf
unit countEnemy others
```

**Parameters:**

- `unit`: [Object](../topics/Object.md)
- `others`: [Array](../topics/Array.md) of [Objects](../topics/Object.md)

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

## Examples

### Example 1

```sqf
_num = player countEnemy list _triggerOne;
```

## See also

[countFriendly](../commands/countFriendly.md) · [count](../commands/count.md) · [countUnknown](../commands/countUnknown.md) · [countSide](../commands/countSide.md) · [countType](../commands/countType.md)

## Community notes

**Hardrock** — 2006-08-03

*Notes from before the conversion:*

The countEnemy command seem to count the number of units from the array that are considered to be of the given type by the whole side, not just the specified unit.

---

**Kronzky** — 2006-12-15

The unit that's checking (left side of the command) needs a certain level of knowledge about the target (about .1) before the enemy units are actually counted. (OFP & ArmA)

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