---
name: "targetsQuery"
type: command
status: ok
groups: ["Object Detection"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/targetsQuery
revid: 377711
updated: 2026-01-02T09:03:51Z
---

# targetsQuery

*Command · Object Detection · Arma 3 v0.50 · introduced in Arma 2 v1.00*

## Description

Returns sorted array of targets, **known** to the enquirer (including own troops), where the accuracy coefficient reflects how close the result matches the query. This command could be CPU intensive.

## Syntax

```sqf
enquirer targetsQuery [targetIgnore, targetSide, targetType, targetPosition, targetMaxAge]
```

**Parameters:**

- `enquirer`: [Object](../topics/Object.md) - for whom the query will be made
- `targetIgnore`: [Object](../topics/Object.md) - target object to exclude from results. [objNull](../commands/objNull.md) - return every target
- `targetSide`: [Side](../topics/Side.md) - desired side of the target. [sideUnknown](../commands/sideUnknown.md) - any side
- `targetType`: [String](../topics/String.md) - desired target [typeOf](../commands/typeOf.md). "" - any type
- `targetPosition`: [Position2D](../topics/Position.md#introduction) or [Position3D](../topics/Position.md#introduction) - desired target position (only [x,y] is considered). Position tolerance is 200m from the actual position of the target. [] - any position
- `targetMaxAge`: [Number](../topics/Number.md) - desired max age of the target. This will limit returned results to the targets younger than specified age. 0 - any age

**Returns:** [Array](../topics/Array.md) of [Array](../topics/Array.md)s with [accuracy, target, targetSide, targetType, targetPosition, targetAge]
- accuracy: [Number](../topics/Number.md) in range 0..1 - a coefficient, which reflects how close the returned result to the query filter. (1 - best match)
- target: [Object](../topics/Object.md) - the actual target object
- targetSide: [Side](../topics/Side.md) - side of the target
- targetType: [String](../topics/String.md) - target [typeOf](../commands/typeOf.md)
- targetPosition: [Array](../topics/Array.md) - [x,y] of the target
- targetAge: [Number](../topics/Number.md) - the actual target age in seconds (can be negative)

## Examples

### Example 1

Return all known targets for player:

```sqf
_targets = player targetsQuery [objNull, sideUnknown, "", [], 0];
```

### Example 2

Prioritise all known OPFOR targets and return targets less than 10 seconds old:

```sqf
_targets = player targetsQuery [objNull, east, "", [], 10];
```

## See also

[targets](../commands/targets.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)

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