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

# targetsAggregate

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

## Description

Aggregate candidates.

## Syntax

```sqf
[speaker, side, classname, position, timeMax] targetsAggregate candidates
```

**Parameters:**

- `speaker`: [Object](../topics/Object.md)
- `side`: [Side](../topics/Side.md) - if provided, a target with a side matching *side* will see it replaced by `"$"`
- `classname`: [String](../topics/String.md) - `CfgVehicles` classname - if provided, a target with a type matching *classname* will see it replaced by `"$"`
- `position`: [Position](../topics/Position.md) (Z-value is ignored) - centre of a hardcoded 200m radius
- `timeMax`: [Number](../topics/Number.md) - max age of the target
- `candidates`: [Array](../topics/Array.md) of [Array](../topics/Array.md)s with [accuracy, target, targetSide, targetType, targetPosition, targetAge]
  - accuracy: [Number](../topics/Number.md) - a coefficient, which reflects how close the returned result to the query filter. Range: 0..1, 1 being the 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: [Position2D](../topics/Position.md#introduction) - [x,y] of the target
  - targetAge: [Number](../topics/Number.md) - the actual target age in seconds (can be negative)

  > [!NOTE]
  > See [targetsQuery](../commands/targetsQuery.md) format.

**Returns:** [Array](../topics/Array.md) with [countInfo, sideInfo, unitInfo, placeInfo, timeInfo, uCountInfo, uTypeInfo]
- countInfo: [Array](../topics/Array.md) - [[format](../commands/format.md) ["COUNT%1", index], count on index]
- sideInfo: [Array](../topics/Array.md) - [[format](../commands/format.md) ["SIDE%1", index], side or string] if string then $ == "equal to queried"
- unitInfo: [Array](../topics/Array.md) - [[format](../commands/format.md) ["UNIT%1", index], string]  $ == "equal to queried", otherwise the "type" of the unit? Should be CfgVehicles config type I think
- placeInfo: [Array](../topics/Array.md) - [[format](../commands/format.md) ["PLACE%1", index], [[centerX, centerY], radius]]
- timeInfo: [Array](../topics/Array.md) - [[format](../commands/format.md) ["TIME%1", index], string or array] if string then $ == "equal to queried", otherwise [timeMin, timeMax]
- uCountInfo: [Array](../topics/Array.md) - [[format](../commands/format.md) ["UCOUNT%1", index], scalar count]
- uTypeInfo: [Array](../topics/Array.md) - [[format](../commands/format.md) ["UTYPE%1", index], string name] a classname? Will be format ["*%1", classname] if count > 1

## Examples

### Example 1

```sqf
_aggregation = [player, sideEnemy, "", [], 0] targetsAggregate (player targetsQuery [objNull, sideUnknown, "", [], 0]);
/*
    returns e.g
    [
        [
            ["COUNT0", 1],
            ["SIDE0", WEST],
            ["UNIT0", "B_Soldier_F"],
            ["PLACE0", [[<null>,<null>], 0, <null>]],
            ["TIME0", [-0.9, -0.9]],
            ["UCOUNT0", 1],
            ["UTYPE0", ...
        ]
    ]
*/
```

with e.g
- one Orca Helicopter
- one T-100 Varsuk tank
- one T-140K Angara tank
- one MBT-52 Kuma tank (independent, set as enemy to blufor)

```sqf
/*
    [
        [["COUNT0",1],["SIDE0",EAST],["UNIT0","O_Heli_Light_02_dynamicLoadout_F"],["PLACE0",[[<null>,<null>],0,<null>]],["TIME0",[-0.982,-0.982]],["UCOUNT0",1],["UTYPE0","O_Heli_Light_02_dynamicLoadout_F"]],
        [["COUNT1",1],["SIDE1",GUER],["UNIT1","I_MBT_03_cannon_F"],["PLACE1",[[<null>,<null>],0,<null>]],["TIME1",[-0.982,-0.982]],["UCOUNT1",1],["UTYPE1","I_MBT_03_cannon_F"]],
        [["COUNT2",2],["SIDE2",EAST],["UNIT2","*Tank_F"],["PLACE2",[[<null>,<null>],4.34554,<null>]],["TIME2",[-0.982,-0.982]],["UCOUNT2",2],["UTYPE2","*O_MBT_02_cannon_F"]]]
    [
        [["COUNT0",1],["SIDE0",EAST],["UNIT0","O_Heli_Light_02_dynamicLoadout_F"],["PLACE0",[[<null>,<null>],0,<null>]],["TIME0",[-1,-1]],["UCOUNT0",1],["UTYPE0","O_Heli_Light_02_dynamicLoadout_F"]],
        [["COUNT1",1],["SIDE1",GUER],["UNIT1","I_MBT_03_cannon_F"],["PLACE1",[[<null>,<null>],0,<null>]],["TIME1",[-1,-1]],["UCOUNT1",1],["UTYPE1","I_MBT_03_cannon_F"]],
        [["COUNT2",2],["SIDE2",EAST],["UNIT2","*Tank_F"],["PLACE2",[[<null>,<null>],4.34565,<null>]],["TIME2",[-1,-1]],["UCOUNT2",2],["UTYPE2","*O_MBT_02_cannon_F"]]
    ]
*/
```

## See also

[targets](../commands/targets.md) · [targetsQuery](../commands/targetsQuery.md) · [nearTargets](../commands/nearTargets.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 — targetsAggregate](https://community.bistudio.com/wiki/targetsAggregate) (revision 377663).</sub>
