{"name":"targetsQuery","title":"targetsQuery","type":"command","url":"https://community.bistudio.com/wiki/targetsQuery","revid":377711,"updated":"2026-01-02T09:03:51Z","groups":["Object Detection"],"status":"ok","games":{"arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.00","arma3_since":"0.50","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.","syntaxes":[{"syntax":"enquirer targetsQuery [targetIgnore, targetSide, targetType, targetPosition, targetMaxAge]","params":[{"name":"enquirer","type":"Object","description":"for whom the query will be made","type_expr":"Object"},{"name":"targetIgnore","type":"Object","description":"target object to exclude from results. objNull - return every target","type_expr":"Object"},{"name":"targetSide","type":"Side","description":"desired side of the target. sideUnknown - any side","type_expr":"Side"},{"name":"targetType","type":"String","description":"desired target typeOf. \"\" - any type","type_expr":"String"},{"name":"targetPosition","type":"Position2D or Position3D","description":"desired target position (only [x,y] is considered). Position tolerance is 200m from the actual position of the target. [] - any position","type_expr":"Position2D | Position3D"},{"name":"targetMaxAge","type":"Number","description":"desired max age of the target. This will limit returned results to the targets younger than specified age. 0 - any age","type_expr":"Number"}],"returns":{"type":"Array of Arrays","type_expr":"Array<Array>","description":"with [accuracy, target, targetSide, targetType, targetPosition, targetAge]\n- accuracy: Number in range 0..1 - a coefficient, which reflects how close the returned result to the query filter. (1 - best match) - target: Object - the actual target object - targetSide: Side - side of the target - targetType: String - target typeOf - targetPosition: Array - [x,y] of the target - targetAge: Number - the actual target age in seconds (can be negative)","text":"Array of Arrays with [accuracy, target, targetSide, targetType, targetPosition, targetAge]\n\n- accuracy: Number in range 0..1 - a coefficient, which reflects how close the returned result to the query filter. (1 - best match)\n- target: Object - the actual target object\n- targetSide: Side - side of the target\n- targetType: String - target typeOf\n- targetPosition: Array - [x,y] of the target\n- targetAge: Number - the actual target age in seconds (can be negative)"},"form":"binary","left":{"text":"enquirer"},"right":{"text":"[targetIgnore, targetSide, targetType, targetPosition, targetMaxAge]"}}],"examples":[{"text":"Return all known targets for player:\n\n```sqf\n_targets = player targetsQuery [objNull, sideUnknown, \"\", [], 0];\n```","code":["_targets = player targetsQuery [objNull, sideUnknown, \"\", [], 0];"]},{"text":"Prioritise all known OPFOR targets and return targets less than 10 seconds old:\n\n```sqf\n_targets = player targetsQuery [objNull, east, \"\", [], 10];\n```","code":["_targets = player targetsQuery [objNull, east, \"\", [], 10];"]}],"see_also":["targets","nearTargets","targetsAggregate","targetKnowledge","knowsAbout","reveal","forgetTarget","setTargetAge","getHideFrom"]}