{"name":"targets","operator":null,"title":"targets","type":"command","url":"https://community.bistudio.com/wiki/targets","revid":377208,"updated":"2026-01-01T11:46:32Z","groups":["Object Detection"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.70"}],"since":{"game":"arma3","name":"Arma 3","version":"1.70"},"arma3_since":"1.70","branch":null,"locality":{"argument":"global","effect":null,"server_exec":false},"exec":null,"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]","since":null,"effect":null,"exec":null,"params":[{"name":"unitOrGroup","type":"Object or Arma 3 v2.12 Group","optional":false,"default":null,"description":"unit or group which target knowledge is retrieved","types":["Object","Group"],"since":null,"text":"unitOrGroup: Object or Arma 3 v2.12 Group - unit or group which target knowledge is retrieved"},{"name":"enemyOnly","type":"Boolean","optional":true,"default":"false","description":"true to include only enemy targets, false to include all targets","types":["Boolean"],"since":null,"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","types":["Number"],"since":null,"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","types":["Array","Side"],"since":null,"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","types":["Number"],"since":null,"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":"unitOrGroups position","description":"alternate (2D or 3D) position used for** 2D*' distance check","types":["Array"],"since":null,"text":"alternateCenter: Array - (Optional, default *unitOrGroup**s position) alternate (2D or 3D) position used for** 2D*' distance check"}],"returns":{"type":"Array","types":["Array"],"description":"unitOrGroup's targets matching the criteria","text":"Array - *unitOrGroup*'s targets matching the criteria"},"form":"binary","operator":null,"left":{"text":"unitOrGroup","types":["Object","Group"]},"right":{"text":"[enemyOnly, maxDistance, sides, maxAge, alternateCenter]","types":["Array"]}}],"examples":[{"text":"```sqf\nprivate _targets = _unit targets [false, 300, [east, sideEnemy]]; // all targets of east or renegade side in 300m\n```","code":["private _targets = _unit targets [false, 300, [east, sideEnemy]]; // all targets of east or renegade side in 300m"]},{"text":"```sqf\nprivate _targets = _unit targets [true, 300]; // enemy targets in 300m\n```","code":["private _targets = _unit targets [true, 300]; // enemy targets in 300m"]},{"text":"```sqf\nprivate _targets = _unit targets []; // all targets\n```","code":["private _targets = _unit targets []; // all targets"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["targetsQuery","nearTargets","targetsAggregate","targetKnowledge","knowsAbout","reveal","forgetTarget","setTargetAge","getHideFrom","side"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Detection","Introduced with Arma 3 version 1.70","Scripting Commands"]}