inAreaArrayIndexes: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "{{RV|type=command |game1= arma3 |version1= 2.14 |branch= dev |gr1= Triggers |gr2= Markers |gr3= Locations |gr4= Positions |descr= Checks if positions given in Array...")
 
m (Text replacement - " |version1= 2.14 |branch= dev" to " |version1= 2.14")
 
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:
|game1= arma3
|game1= arma3
|version1= 2.14
|version1= 2.14
|branch= dev


|gr1= Triggers
|gr1= Triggers
Line 13: Line 12:
|gr4= Positions
|gr4= Positions


|descr= Checks if positions given in [[Array]] of positions are within the given area and returns the indexes of matching elements.
|gr5= Groups
 
|descr= Returns positions' indices that are within the provided area.


|s1= positions [[inAreaArrayIndexes]] area
|s1= positions [[inAreaArrayIndexes]] area
Line 22: Line 23:
* [[Location]]s - locations
* [[Location]]s - locations
* [[String]]s - markers
* [[String]]s - markers
* [[Group]]s - AI groups, the position is the [[leader]] position
* [[Group]]s - AI groups, the position is the [[leader]]'s position


|p2= area: [[Array]] or [[Object]] or [[Location]] or [[String]], where:
|p2= area: [[Array]] or [[Object]] or [[Location]] or [[String]], where:
* [[Array]] - in format [center, a, b, angle, isRectangle, c] or polygon in format [point1, point2, point2,...]
* [[Array]] - in format [center, a, b, angle, isRectangle, c] or polygon in format [point1, point2, point2, ...]
* [[Object]] - trigger
* [[Object]] - trigger
* [[Location]] - location
* [[Location]] - location
* [[String]] - marker
* [[String]] - marker


|r1= [[Array]] of [[Number]]s - indexes of matching elements in 'positions' [[Array]]
|r1= [[Array]] of [[Number]]s - indices of ''positions''<nowiki/>'s matching elements
 
|x1= <sqf>allUnits inAreaArrayIndexes myTrigger;</sqf>
 
|x2= <sqf>allMapMarkers inAreaArrayIndexes "myMarker";</sqf>
 
|x3= <sqf>allPlayers inAreaArrayIndexes myLocation;</sqf>
 
|x4= <sqf>allGroups inAreaArrayIndexes [[100, 100, 0], 20, 30, 45, false, 10];</sqf>


|x1= <sqf>
private _players = call BIS_fnc_listPlayers;
private _indices = _players inAreaArrayIndexes _marker;
{
private _player = _players select _x;
["You are in the marker!"] remoteExec ["hint", _player];
} forEach _indices;
</sqf>


|seealso= [[inAreaArray]] [[inArea]] [[triggerArea]]
|seealso= [[inAreaArray]] [[inArea]] [[triggerArea]]
}}
}}

Latest revision as of 19:11, 5 September 2023

Hover & click on the images for description

Description

Description:
Returns positions' indices that are within the provided area.
Groups:
TriggersMarkersLocationsPositionsGroups

Syntax

Syntax:
positions inAreaArrayIndexes area
Parameters:
positions: Array of Objects and/or Positions and/or Locations and/or Strings and/or Groups, where:
area: Array or Object or Location or String, where:
  • Array - in format [center, a, b, angle, isRectangle, c] or polygon in format [point1, point2, point2, ...]
  • Object - trigger
  • Location - location
  • String - marker
Return Value:
Array of Numbers - indices of positions's matching elements

Examples

Example 1:
private _players = call BIS_fnc_listPlayers; private _indices = _players inAreaArrayIndexes _marker; { private _player = _players select _x; ["You are in the marker!"] remoteExec ["hint", _player]; } forEach _indices;

Additional Information

See also:
inAreaArray inArea triggerArea

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