inAreaArray: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(alt syntax)
No edit summary
 
(70 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Command|=
{{RV|type=command
____________________________________________________________________________________________


| arma3dev |= Game
|game1= arma3
|version1= 1.66


|1.65|= Game Version (number surrounded by NO SPACES)
|gr1= Triggers


|arg= |= Multiplayer Arguments ("local" or "global")
|gr2= Markers


|eff= |= Multiplayer Effects ("local" or "global")
|gr3= Locations


|exec= |= Multiplayer Execution ("server" or empty)
|gr4= Positions
____________________________________________________________________________________________


| Filters given list of [[Object]]s and/or [[Position]]s in relation to the given area, defined by a trigger, marker, location or array. Returns array of [[Object]]s and/or [[Position]]s from the list that are inside the area |= Description
|descr= Returns given list of [[Object]]s and/or [[Position]]s that are in the given area, area defined by a trigger, marker, location or array.
____________________________________________________________________________________________


|positions '''inAreaArray''' trigger |= Syntax
{{Feature|important| By default all positions given as [[Array]] or as objects are treated as [[PositionAGL]]. Since {{GVI|arma3|2.20|size= 0.75}} there is an option to force them to [[PositionWorld]] format.}}


|p1= positions: [[Array]] - [[Object]]s and/or [[Position]]s to check|= Parameter 1
|s1= positions [[inAreaArray]] area


|p2= trigger: [[Object]] - trigger with given area |= Parameter 2
|p1= positions: [[Array]] of [[Object]]s and/or [[Position]]s


| [[Array]]: [[Object]]s and/or [[Position]]s inside the trigger area|= Return Value
|p2= area: [[Object]], [[Location]] or [[String]] - the defined area:
* [[Object]] - trigger
* [[Location]] - location
* [[String]] - marker name


|s2=positions '''inAreaArray''' marker |= Syntax
|r1= [[Array]]: [[Object]]s and/or [[Position]]s inside the trigger area


|p21= positions: [[Array]] - [[Object]]s and/or [[Position]]s to check|= Parameter 1
|s2= positions [[inAreaArray]] [centre, a, b, angle, isRectangle, c, usePosWorld]


|p22= marker: [[String]] - marker with given area |= Parameter 2
|p21= positions: [[Array]] - [[Object]]s and/or [[Position]]s to check. [[Position]]s must be [[Position#PositionAGL|PositionAGL]] if area is checked in 3D (see note in description)


|r2= [[Array]]: [[Object]]s and/or [[Position]]s inside the marker area|= Return Value
|p22= centre: [[Array]] format [[Position#Introduction|Position2D]] or [[Position#PositionAGL|PositionAGL]], {{GVI|arma3|2.14|size= 0.75}} [[Object]] or [[Group]]


|s3=positions '''inAreaArray''' location |= Syntax
|p23= a: [[Number]] - x axis (x / 2)


|p41= positions: [[Array]] - [[Object]]s and/or [[Position]]s to check|= Parameter 1
|p24= b: [[Number]] - y axis (y / 2)


|p42= location: [[Location]] - location with given area |= Parameter 2
|p25= angle: [[Number]] - (Optional, default 0) rotation angle


|r3= [[Array]]: [[Object]]s and/or [[Position]]s inside the location area|= Return Value
|p26= isRectangle: [[Boolean]] - (Optional, default [[false]]) [[true]] if rectangle, [[false]] if ellipse


|s4= positions '''inAreaArray''' [center, a, b, angle, isRectangle, c]|= Syntax
|p27= c: [[Number]] - (Optional, default -1: unlimited) z axis (z / 2)
|p61= positions: [[Array]] - [[Object]]s and/or [[Position]]s to check|= Parameter 1
|p62= [center, a, b, angle, isRectangle, c]: [[Array]]|= Parameter 2
|p63= center: [[Array]] or [[Object]] - center of the area in format [[Position3D]], [[Position2D]], [[Object]] or [[Group]] |= Parameter 2
|p64= a: [[Number]] - x axis (x / 2) |= Parameter 2
|p65= b: [[Number]] - y axis (y / 2) |= Parameter 2
|p66= angle (Optional): [[Number]] - rotation angle. Default: 0  |= Parameter 2
|p67= isRectangle (Optional): [[Boolean]] - [[true]] if rectangle, [[false]] if ellipse. Default: [[false]]|= Parameter 2
|p68= c (Optional): [[Number]] - z axis (z / 2). Default: -1 (unlimited)|= Parameter 2
|r4= [[Array]]: [[Object]]s and/or [[Position]]s inside the area |= Return value
____________________________________________________________________________________________


|x1= <code>[[vehicles]] [[inAreaArray]] trigger_1;</code> |= Example 1
|p28= usePosWorld: [[Boolean]] - (Optional, default [[false]]) set to [[true]] to treat all positions as [[PositionWorld]]
|x2= <code>[[allUnits]] [[inAreaArray]] marker_1;</code> |= Example 2
|p28since= Arma3 2.20
|x3= <code>[[allPlayers]] [[inAreaArray]] location_1;</code> |= Example 3
|x4= <code>[[allDead]] [[inAreaArray]] <nowiki>[</nowiki>[100, 100, 0], 20, 30, 45, [[false]], 10];</code>|=
____________________________________________________________________________________________


|mp= - |= Multiplayer Behaviour
|r2= [[Array]]: [[Object]]s and/or [[Position]]s inside the area


| [[inArea]], [[triggerArea]] |= See Also
|s3= positions [[inAreaArray]] [pos1, pos2, pos3,...]
|s3since= Arma3 2.20
|p41= positions: [[Array]] - [[Object]]s and/or [[Position]]s to check.
|p42 = posN: [[Position]] - polygon vertices in 2d or 3d format (see [[inPolygon]])
|r3= [[Array]]: [[Object]]s and/or [[Position]]s inside the area


}}
|x1= <sqf>vehicles inAreaArray myTrigger;</sqf>
 
|x2= <sqf>allUnits inAreaArray "myMarker";</sqf>


<dl class="command_description">
|x3= <sqf>allPlayers inAreaArray myLocation;</sqf>
<!-- BEGIN Note Section -->
<!-- END Note Section -->
</dl>


<h3 style="display:none">Bottom Section</h3>
|x4= <sqf>allDead inAreaArray [[100, 100, 0], 20, 30, 45, false, 10];</sqf>
<!-- Appropriate categories go here -->


[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
|seealso= [[inAreaArrayIndexes]] [[inArea]] [[triggerArea]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
}}
 
{{Note
|user= Tankbuster
|timestamp= 20170611213300
|text= The array you send the command can be filtered. For example:
<sqf>vehicles select { _x isKindOf "StaticWeapon" } inAreaArray "myMarker"</sqf>
Will return only the statics inside the given marker.
}}

Latest revision as of 22:37, 1 November 2024

Hover & click on the images for description

Description

Description:
Returns given list of Objects and/or Positions that are in the given area, area defined by a trigger, marker, location or array.
By default all positions given as Array or as objects are treated as PositionAGL. Since Arma 3 logo black.png2.20 there is an option to force them to PositionWorld format.
Groups:
TriggersMarkersLocationsPositions

Syntax 1

Syntax:
positions inAreaArray area
Parameters:
positions: Array of Objects and/or Positions
area: Object, Location or String - the defined area:
Return Value:
Array: Objects and/or Positions inside the trigger area

Syntax 2

Syntax:
positions inAreaArray [centre, a, b, angle, isRectangle, c, usePosWorld]
Parameters:
positions: Array - Objects and/or Positions to check. Positions must be PositionAGL if area is checked in 3D (see note in description)
centre: Array format Position2D or PositionAGL, Arma 3 logo black.png2.14 Object or Group
a: Number - x axis (x / 2)
b: Number - y axis (y / 2)
angle: Number - (Optional, default 0) rotation angle
isRectangle: Boolean - (Optional, default false) true if rectangle, false if ellipse
c: Number - (Optional, default -1: unlimited) z axis (z / 2)
since Arma 3 logo black.png2.20
usePosWorld: Boolean - (Optional, default false) set to true to treat all positions as PositionWorld
Return Value:
Array: Objects and/or Positions inside the area

Syntax 3

Syntax:
positions inAreaArray [pos1, pos2, pos3,...]
Parameters:
positions: Array - Objects and/or Positions to check.
posN: Position - polygon vertices in 2d or 3d format (see inPolygon)
Return Value:
Array: Objects and/or Positions inside the area

Examples

Example 1:
vehicles inAreaArray myTrigger;
Example 2:
allUnits inAreaArray "myMarker";
Example 3:
allPlayers inAreaArray myLocation;
Example 4:
allDead inAreaArray [[100, 100, 0], 20, 30, 45, false, 10];

Additional Information

See also:
inAreaArrayIndexes 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
Tankbuster - c
Posted on Jun 11, 2017 - 21:33 (UTC)
The array you send the command can be filtered. For example:
vehicles select { _x isKindOf "StaticWeapon" } inAreaArray "myMarker"
Will return only the statics inside the given marker.