targets: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<h3 style="display:none">Bottom Section</h3> " to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame( +[0-9])?|Game [Vv]ersion( +[0-9])?|Game Version \(number surrounded by NO SPACES\)|Arguments in MP|MP[Aa]rg|Multiplayer Arguments( \("local" or "global"\))?|Effects|Execution|Effects...)
Line 1: Line 1:
{{Command|Comments=
{{Command


| arma3 |Game name=
| arma3


|1.70|Game version=
|1.70


|arg= global|arguments=
|arg= global|arguments=


|gr1= Object Detection |GROUP1=
|gr1= Object Detection


| Retrives list of given unit targets matching specified filter. If the filter is not specified, all targets are returned.
| Retrives list of given unit targets matching specified filter. If the filter is not specified, all targets are returned.


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


|p1= unit: [[Object]] - unit which target knowledge is retrieved|Parameter1=
|p1= unit: [[Object]] - unit which target knowledge is retrieved
|p2= [enemyOnly, maxDistance, sides, maxAge, alternateCenter]: [[Array]]|Parameter2=
|p2= [enemyOnly, maxDistance, sides, maxAge, alternateCenter]: [[Array]]


|p3= enemyOnly (Optional): [[Boolean]] - [[true]] to include only enemy targets, [[false]] to include all targets |PARAMETER3=
|p3= enemyOnly (Optional): [[Boolean]] - [[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 |PARAMETER4=
|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 |PARAMETER5=
|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 |PARAMETER6=
|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 |PARAMETER7=
|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 |RETURNVALUE=
| [[Array]] - unit's targets matching the criteria




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


|x3= <code>_targets = _unit [[targets]] []; //all targets</code> |EXAMPLE3=
|x3= <code>_targets = _unit [[targets]] []; //all targets</code>


| [[nearTargets]], [[targetsQuery]], [[reveal]], [[side]] |SEEALSO=
| [[nearTargets]], [[targetsQuery]], [[reveal]], [[side]]


}}
}}

Revision as of 12:25, 18 January 2021

Hover & click on the images for description

Description

Description:
Retrives list of given unit targets matching specified filter. If the filter is not specified, all targets are returned.
Groups:
Object Detection

Syntax

Syntax:
unit targets [enemyOnly, maxDistance, sides, maxAge, alternateCenter]
Parameters:
unit: Object - unit which target knowledge is retrieved
[enemyOnly, maxDistance, sides, maxAge, alternateCenter]: Array
enemyOnly (Optional): Boolean - true to include only enemy targets, false to include all targets
maxDistance (Optional): Number - max. distance based on target's expected position (distance is measured in 2D); use 0 to ignore the maxDistance filter
sides (Optional): Array - array of accepted sides; use [] to ignore the side filter
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
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
Return Value:
Array - unit's targets matching the criteria

Examples

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

Additional Information

See also:
nearTargetstargetsQueryrevealside

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

Notes