nearestMines: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "{{RV|type=command |game1= arma3 |version1= 2.10 |branch= dev |gr1= Object Detection |descr= Returns a list of nearest mines of the given types to the given position or obje...")
 
m (Some wiki formatting)
Line 7: Line 7:
|gr1= Object Detection
|gr1= Object Detection


|descr= Returns a list of nearest mines of the given types to the given position or object, within the specified distance. If more than one mine is found they will be ordered by proximity by default, the closest one will be first in the array. The sorting could be turned off.
|descr= Returns a list of nearest mines of the given types to the given position or object, within the specified distance.
If more than one mine are found they will be ordered by proximity by default, the closest one will be first in the array. The sorting can be turned off.


|s1= [[nearestMines]] [position, types, radius, sort, 2Dmode]
|s1= [[nearestMines]] [position, types, radius, sort, 2Dmode]


|p1= position:  [[Object]] or [[Array]] in format [[Position#PositionAGL|PositionAGL]] or [[Position#Introduction|Position2D]] - Where to find objects, center position.
|p1= position:  [[Object]] or [[Array]] in format [[Position#PositionAGL|PositionAGL]] or [[Position#Introduction|Position2D]] - search position centre


|p2= types: [[Array]] - List of class name of the objects to search for (uses [[isKindOf]] comparison instead of direct class name == comparison). Use an empty array {{ic|[]}} to search for all classes.
|p2= types: [[Array]] - list of class name of the objects to search for (uses [[isKindOf]] comparison instead of direct class name == comparison). Use an empty array {{ic|[]}} to search for all classes


|p3= radius: [[Number]] - Search range.
|p3= radius: [[Number]] - search range


|p5= sort: [[Boolean]] - (Optional, default [[true]]) [[true]] - to sort the results closest first, [[false]] - to turn off sorting.
|p5= sort: [[Boolean]] - (Optional, default [[true]]) [[true]] to sort the results closest first, [[false]] to turn off sorting


|p6= 2Dmode: [[Boolean]] - (Optional, default [[false]]) [[true]] for 2D distance, [[false]] for 3D distance comparison
|p6= 2Dmode: [[Boolean]] - (Optional, default [[false]]) [[true]] for 2D distance, [[false]] for 3D distance comparison


|r1= [[Array]] - found mines as array of [[Object]]s
|r1= [[Array]] - found mines as array of [[Object]]s


|x1= <code>[[nearestMines]] [<nowiki/>[[player]], ["MineBase"], 20];</code>
|x1= <sqf>nearestMines [player, ["MineBase"], 20];</sqf>


|x2= <code>[[nearestMines]] [<nowiki/>[[position]] [[player]], ["DirectionalBombBase"], 500, [[true]]];</code>
|x2= <sqf>nearestMines [position player, ["DirectionalBombBase"], 500, true];</sqf>


|x3= <code>[[nearestMines]] [<nowiki/>[2716,2949,0], ["APERSTripMine_Wire_Ammo", "APERSMine_Range_Ammo"], 100, [[false]], [[true]]];</code>
|x3= <sqf>nearestMines [[2716,2949,0], ["APERSTripMine_Wire_Ammo", "APERSMine_Range_Ammo"], 100, false, true];</sqf>


|x4= Return every mine in 50 metres radius around player sorted by distance:<code>[[nearestMines]] [<nowiki/>[[player]], [], 50];</code>
|x4= Return every mine in 50 metres radius around player sorted by distance:
<sqf>nearestMines [player, [], 50];</sqf>


|seealso= [[nearestTerrainObjects]] [[findNearestEnemy]] [[nearestBuilding]] [[nearestObject]] [[nearObjects]] [[nearestLocation]] [[nearEntities]] [[nearTargets]] [[nearSupplies]] [[nearestLocationWithDubbing]] [[nearObjectsReady]] [[nearRoads]] [[nearestObjects]]
|seealso= [[nearestTerrainObjects]] [[findNearestEnemy]] [[nearestBuilding]] [[nearestObject]] [[nearObjects]] [[nearestLocation]] [[nearEntities]] [[nearTargets]] [[nearSupplies]] [[nearestLocationWithDubbing]] [[nearObjectsReady]] [[nearRoads]] [[nearestObjects]]
}}
}}

Revision as of 11:02, 3 May 2022

Hover & click on the images for description
Only available in Development branch(es) until its release with Arma 3 patch v2.10.

Description

Description:
Returns a list of nearest mines of the given types to the given position or object, within the specified distance. If more than one mine are found they will be ordered by proximity by default, the closest one will be first in the array. The sorting can be turned off.
Groups:
Object Detection

Syntax

Syntax:
nearestMines [position, types, radius, sort, 2Dmode]
Parameters:
position: Object or Array in format PositionAGL or Position2D - search position centre
types: Array - list of class name of the objects to search for (uses isKindOf comparison instead of direct class name == comparison). Use an empty array [] to search for all classes
radius: Number - search range
sort: Boolean - (Optional, default true) true to sort the results closest first, false to turn off sorting
2Dmode: Boolean - (Optional, default false) true for 2D distance, false for 3D distance comparison
Return Value:
Array - found mines as array of Objects

Examples

Example 1:
nearestMines [player, ["MineBase"], 20];
Example 2:
nearestMines [position player, ["DirectionalBombBase"], 500, true];
Example 3:
nearestMines [[2716,2949,0], ["APERSTripMine_Wire_Ammo", "APERSMine_Range_Ammo"], 100, false, true];
Example 4:
Return every mine in 50 metres radius around player sorted by distance:
nearestMines [player, [], 50];

Additional Information

See also:
nearestTerrainObjects findNearestEnemy nearestBuilding nearestObject nearObjects nearestLocation nearEntities nearTargets nearSupplies nearestLocationWithDubbing nearObjectsReady nearRoads nearestObjects

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