targetsQuery: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *T([a-z ])" to "$1 - t$2")
 
(58 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma2 |= Game name
|game1= arma2
|version1= 1.00


|1.00|= Game version
|game2= arma2oa
____________________________________________________________________________________________
|version2= 1.50


| Find all targets known to sender matching given query. |= Description
|game3= tkoh
____________________________________________________________________________________________
|version3= 1.00


| speaker '''targetsQuery''' [receiver,side,unit,place,time] |= Syntax
|game4= arma3
|version4= 0.50


|p1= speaker: [[Object]] -  |= PARAMETER1
|gr1= Object Detection


|p2= [receiver,side,unit,place,time]: [[Array]] -  |= PARAMETER2
|descr= 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.


|p3= |= PARAMETER3
|s1= enquirer [[targetsQuery]] [targetIgnore, targetSide, targetType, targetPosition, targetMaxAge]


| [[Array]] |= RETURNVALUE
|p1= enquirer: [[Object]] - for whom the query will be made


|p2= targetIgnore: [[Object]] - target object to exclude from results. [[objNull]] - return every target


|x1= <pre>_candidates = _this targetsQuery [_from,_enemySide,"","",""];//ca\characters\scripts\reactCore_Full.fsm</pre>|= EXAMPLE1
|p3= targetSide: [[Side]] - desired side of the target. [[sideUnknown]] - any side


____________________________________________________________________________________________
|p4= targetType: [[String]] - desired target [[typeOf]]. "" - any type


| [[targetsAggregate]] |= SEEALSO
|p5= targetPosition: [[Array]] - desired target position in format of [[Position#Introduction|Position2D]] or [[Position#Introduction|Position3D]] (only [x,y] is considered). Position tolerance is 200m from the actual position of the target. [] - any position


| |= MPBEHAVIOUR
|p6= targetMaxAge: [[Number]] - desired max age of the target. This will limit returned results to the targets younger than specified age. 0 - any age
____________________________________________________________________________________________
}}


<h3 style='display:none'>Notes</h3>
|r1= [[Array]] - '''sorted''' array of returned targets in the following format:
<dl class='command_description'>
<nowiki>[</nowiki>[accuracy, target, targetSide, targetType, targetPosition, targetAge],...] where:
<!-- Note Section BEGIN -->
* accuracy: [[Number]] - a coefficient, which reflects how close the returned result to the query filter. Range: 0 - 1 (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)


<!-- Note Section END -->
|x1= Return all known targets for player:
</dl>
<sqf>_targets = player targetsQuery [objNull, sideUnknown, "", [], 0];</sqf>
|x2= Prioritise all known OPFOR targets and return targets less than 10 seconds old:
<sqf>_targets = player targetsQuery [objNull, east, "", [], 10];</sqf>


<h3 style='display:none'>Bottom Section</h3>
|seealso= [[targets]] [[nearTargets]] [[targetsAggregate]] [[targetKnowledge]] [[knowsAbout]] [[reveal]] [[forgetTarget]] [[setTargetAge]] [[getHideFrom]]
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
}}
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

Latest revision as of 16:50, 8 November 2023

Hover & click on the images for description

Description

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.
Groups:
Object Detection

Syntax

Syntax:
enquirer targetsQuery [targetIgnore, targetSide, targetType, targetPosition, targetMaxAge]
Parameters:
enquirer: Object - for whom the query will be made
targetIgnore: Object - target object to exclude from results. objNull - return every target
targetSide: Side - desired side of the target. sideUnknown - any side
targetType: String - desired target typeOf. "" - any type
targetPosition: Array - desired target position in format of Position2D or Position3D (only [x,y] is considered). Position tolerance is 200m from the actual position of the target. [] - any position
targetMaxAge: Number - desired max age of the target. This will limit returned results to the targets younger than specified age. 0 - any age
Return Value:
Array - sorted array of returned targets in the following format: [[accuracy, target, targetSide, targetType, targetPosition, targetAge],...] where:
  • accuracy: Number - a coefficient, which reflects how close the returned result to the query filter. Range: 0 - 1 (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)

Examples

Example 1:
Return all known targets for player:
_targets = player targetsQuery [objNull, sideUnknown, "", [], 0];
Example 2:
Prioritise all known OPFOR targets and return targets less than 10 seconds old:
_targets = player targetsQuery [objNull, east, "", [], 10];

Additional Information

See also:
targets nearTargets targetsAggregate targetKnowledge knowsAbout reveal forgetTarget setTargetAge getHideFrom

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note