targets: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|= |p3=" to "|Parameter2= |p3=")
(Add default values)
 
(41 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma3 |Game name=
|game1= arma3
|version1= 1.70


|1.70|Game version=
|arg= global


|arg= global|=
|gr1= Object Detection
____________________________________________________________________________________________


| Retrives list of given unit targets matching specified filter. If the filter is not specified, all targets are returned.|=
|descr= Retrieves list of given unit targets matching specified filter. If the filter is not specified, all targets are returned.
____________________________________________________________________________________________
{{Feature|informative|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).}}


| unit '''targets''' [enemyOnly, maxDistance, sides, maxAge, alternateCenter] |SYNTAX=
|s1= unitOrGroup [[targets]] [enemyOnly, maxDistance, sides, maxAge, alternateCenter]


|p1= unit: [[Object]] - unit which target knowledge is retrieved|=
|p1= unitOrGroup: [[Object]] or {{GVI|arma3|2.12|size= 0.75}} [[Group]] - unit or group which target knowledge is retrieved
|p2= [enemyOnly, maxDistance, sides, maxAge, alternateCenter]: [[Array]]|Parameter2=


|p3= enemyOnly (Optional): [[Boolean]] - [[true]] to include only enemy targets, [[false]] to include all targets |=
|p2= enemyOnly: [[Boolean]] - (Optional, default [[false]]) [[true]] to include only enemy targets, [[false]] to include all targets
|p4= maxDistance (Optional): [[Number]] - max. distance based on target's expected position ''(distance is measured in 2D)''; use 0 to ignore the maxDistance filter |=
|p5= sides (Optional): [[Array]] - array of accepted sides; use [] to ignore the side filter |=
|p6= maxAge (Optional): [[Number]] - max. target age, targets that are known to unit for longer then maxAge are ignored; use 0 to ignore the maxAge filter |=
|p7= alternateCenter (Optional): [[Array]] - alternate (2D or 3D) position used for distance check ''(distance is measured in 2D)''; if not specified unit position is being used |=


| [[Array]] - unit's targets matching the criteria |=
|p3= maxDistance: [[Number]] - (Optional, default -1) maximum '''2D''' distance based on target's expected position; use 0 to ignore the filter


____________________________________________________________________________________________
|p4= sides: [[Array]] - (Optional, default {{hl|[]}}) array of accepted sides; use {{hl|[]}} to ignore the side filter


|x1= <code>_targets = _unit [[targets]] [false, 300, <nowiki>[east,sideEnemy]</nowiki>]; //all targets of east or renegade side in 300m</code> |Example1=
|p5= 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
|x2= <code>_targets = _unit [[targets]] [true, 300]; //enemy targets in 300m</code> |Example2=


|x3= <code>_targets = _unit [[targets]] []; //all targets</code> |=
|p6= alternateCenter: [[Array]] - (Optional, default ''unitOrGroup''<nowiki/>'s position) alternate (2D or 3D) position used for '''2D''' distance check
____________________________________________________________________________________________


| [[nearTargets]], [[targetsQuery]], [[reveal]], [[side]] |SEEALSO=
|r1= [[Array]] - ''unitOrGroup''<nowiki/>'s targets matching the criteria


}}
|x1= <sqf>private _targets = _unit targets [false, 300, [east, sideEnemy]]; // all targets of east or renegade side in 300m</sqf>


<h3 style="display:none">Notes</h3>
|x2= <sqf>private _targets = _unit targets [true, 300]; // enemy targets in 300m</sqf>
<dl class="command_description">


</dl>
|x3= <sqf>private _targets = _unit targets []; // all targets</sqf>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[targetsQuery]] [[nearTargets]] [[targetsAggregate]] [[targetKnowledge]] [[knowsAbout]] [[reveal]] [[forgetTarget]] [[setTargetAge]] [[getHideFrom]] [[side]]
 
}}
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

Latest revision as of 22:20, 30 March 2024

Hover & click on the images for description

Description

Description:
Retrieves list of given unit targets matching specified filter. If the filter is not specified, all targets are returned.
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).
Groups:
Object Detection

Syntax

Syntax:
unitOrGroup targets [enemyOnly, maxDistance, sides, maxAge, alternateCenter]
Parameters:
unitOrGroup: Object or Arma 3 logo black.png2.12 Group - unit or group which target knowledge is retrieved
enemyOnly: Boolean - (Optional, default false) true to include only enemy targets, false to include all targets
maxDistance: Number - (Optional, default -1) maximum 2D distance based on target's expected position; use 0 to ignore the filter
sides: Array - (Optional, default []) array of accepted sides; use [] to ignore the side filter
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
alternateCenter: Array - (Optional, default unitOrGroup's position) alternate (2D or 3D) position used for 2D distance check
Return Value:
Array - unitOrGroup's targets matching the criteria

Examples

Example 1:
private _targets = _unit targets [false, 300, [east, sideEnemy]]; // all targets of east or renegade side in 300m
Example 2:
private _targets = _unit targets [true, 300]; // enemy targets in 300m
Example 3:
private _targets = _unit targets []; // all targets

Additional Information

See also:
targetsQuery nearTargets targetsAggregate targetKnowledge knowsAbout reveal forgetTarget setTargetAge getHideFrom side

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