{"name":"targets","title":"targets","type":"command","url":"https://community.bistudio.com/wiki/targets","revid":377208,"updated":"2026-01-01T11:46:32Z","groups":["Object Detection"],"status":"ok","games":{"arma3":"1.70"},"since":"arma3 1.70","arma3_since":"1.70","locality":{"argument":"global"},"description":"Retrieves list of given unit targets matching specified filter. If the filter is not specified, all targets are returned.\n\n> [!NOTE]\n> 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).","syntaxes":[{"syntax":"unitOrGroup targets [enemyOnly, maxDistance, sides, maxAge, alternateCenter]","params":[{"name":"unitOrGroup","type":"Object or Arma 3 v2.12 Group","description":"unit or group which target knowledge is retrieved","type_expr":"Object | Group"},{"name":"enemyOnly","type":"Boolean","optional":true,"default":"false","description":"true to include only enemy targets, false to include all targets","type_expr":"Boolean","text":"enemyOnly: Boolean - (Optional, default false) true to include only enemy targets, false to include all targets"},{"name":"maxDistance","type":"Number","optional":true,"default":"-1","description":"maximum **2D** distance based on target's expected position; use 0 to ignore the filter","type_expr":"Number","text":"maxDistance: Number - (Optional, default -1) maximum **2D** distance based on target's expected position; use 0 to ignore the filter"},{"name":"sides","type":"Array of Sides","optional":true,"default":"`[]`","description":"array of accepted sides; use `[]` to ignore the side filter","type_expr":"Array<Side>","text":"sides: Array of Sides - (Optional, default `[]`) array of accepted sides; use `[]` to ignore the side filter"},{"name":"maxAge","type":"Number","optional":true,"default":"0","description":"max. target age, targets that are known to unit for longer than maxAge are ignored; use 0 to ignore the maxAge filter","type_expr":"Number","text":"maxAge: Number - (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"},{"name":"alternateCenter","type":"Array","optional":true,"default":"unitOrGroup's position","description":"alternate (2D or 3D) position used for **2D** distance check","type_expr":"Array","text":"alternateCenter: Array - (Optional, default *unitOrGroup*'s position) alternate (2D or 3D) position used for **2D** distance check"}],"returns":{"type":"Array","type_expr":"Array","description":"unitOrGroup's targets matching the criteria","text":"Array - *unitOrGroup*'s targets matching the criteria"},"form":"binary","left":{"text":"unitOrGroup"},"right":{"text":"[enemyOnly, maxDistance, sides, maxAge, alternateCenter]"}}],"examples":[{"code":["private _targets = _unit targets [false, 300, [east, sideEnemy]]; // all targets of east or renegade side in 300m"]},{"code":["private _targets = _unit targets [true, 300]; // enemy targets in 300m"]},{"code":["private _targets = _unit targets []; // all targets"]}],"see_also":["targetsQuery","nearTargets","targetsAggregate","targetKnowledge","knowsAbout","reveal","forgetTarget","setTargetAge","getHideFrom","side"]}