targets: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Some wiki formatting)
m (Some wiki formatting)
Line 14: Line 14:
|p1= unit: [[Object]] - unit which target knowledge is retrieved
|p1= unit: [[Object]] - unit which target knowledge is retrieved


|p2= enemyOnly (Optional): [[Boolean]] - [[true]] to include only enemy targets, [[false]] to include all targets
|p2= enemyOnly: [[Boolean]] - (Optional) [[true]] to include only enemy targets, [[false]] to include all targets


|p3= maxDistance (Optional): [[Number]] - max. distance based on target's expected position ''(distance is measured in 2D)''; use 0 to ignore the maxDistance filter
|p3= maxDistance: [[Number]] - (Optional) max. distance based on target's expected position ''(distance is measured in 2D)''; use 0 to ignore the maxDistance filter


|p4= sides (Optional): [[Array]] - array of accepted sides; use [] to ignore the side filter
|p4= sides: [[Array]] - (Optional) array of accepted sides; use [] to ignore the side filter


|p5= 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
|p5= maxAge: [[Number]] - (Optional) max. target age, targets that are known to unit for longer then maxAge are ignored; use 0 to ignore the maxAge filter


|p6= 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
|p6= alternateCenter: [[Array]] - (Optional) alternate (2D or 3D) position used for distance check ''(distance is measured in 2D)''; if not specified unit position is being used


|r1= [[Array]] - unit's targets matching the criteria
|r1= [[Array]] - unit'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>
|x1= <sqf>private _targets = _unit targets [false, 300, [east,sideEnemy]]; // all targets of east or renegade side in 300m</sqf>


|x2= <sqf>private _targets = _unit targets [true, 300]; //enemy targets in 300m</sqf>
|x2= <sqf>private _targets = _unit targets [true, 300]; // enemy targets in 300m</sqf>


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


|seealso= [[nearTargets]] [[targetsQuery]] [[reveal]] [[side]]
|seealso= [[nearTargets]] [[targetsQuery]] [[reveal]] [[side]]
}}
}}

Revision as of 03:31, 1 August 2022

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: Boolean - (Optional) true to include only enemy targets, false to include all targets
maxDistance: Number - (Optional) max. distance based on target's expected position (distance is measured in 2D); use 0 to ignore the maxDistance filter
sides: Array - (Optional) array of accepted sides; use [] to ignore the side filter
maxAge: Number - (Optional) max. target age, targets that are known to unit for longer then maxAge are ignored; use 0 to ignore the maxAge filter
alternateCenter: Array - (Optional) 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:
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:
nearTargets targetsQuery reveal 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