nearestLocation: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Take[ _]On[ _]Helicopters(\|.*)?\]\]" to "{{GameCategory|tkoh|Scripting Commands}}")
m (Text replacement - "_{10,} " to "")
Line 1: Line 1:
{{Command|Comments=
{{Command|Comments=
____________________________________________________________________________________________


| arma1 |Game name=
| arma1 |Game name=
Line 7: Line 6:


|gr1= Locations |GROUP1=
|gr1= Locations |GROUP1=
____________________________________________________________________________________________


| Return the closest location of specified class to a given position.<br>Checked range is unlimited (i.e. covers the whole map). |DESCRIPTION=
| Return the closest location of specified class to a given position.<br>Checked range is unlimited (i.e. covers the whole map). |DESCRIPTION=
____________________________________________________________________________________________


| [[nearestLocation]] [position, locationClass] |SYNTAX=
| [[nearestLocation]] [position, locationClass] |SYNTAX=
Line 21: Line 18:


| [[Location]] |RETURNVALUE=
| [[Location]] |RETURNVALUE=
____________________________________________________________________________________________
   
   
|x1= <code>_nearestCity = [[nearestLocation]] [<nowiki/>[[getPos]] [[player]], "nameCity"];</code> |EXAMPLE1=
|x1= <code>_nearestCity = [[nearestLocation]] [<nowiki/>[[getPos]] [[player]], "nameCity"];</code> |EXAMPLE1=


|x2= <code>_anyNearestLocation = [[nearestLocation]] [<nowiki/>[[player]], ""];</code> |EXAMPLE2=
|x2= <code>_anyNearestLocation = [[nearestLocation]] [<nowiki/>[[player]], ""];</code> |EXAMPLE2=
____________________________________________________________________________________________


| [[findNearestEnemy]], [[nearestBuilding]], [[nearestObject]], [[nearestObjects]], [[nearObjects]], [[nearEntities]], [[nearTargets]], [[nearSupplies]], [[nearestLocationWithDubbing]], [[nearObjectsReady]], [[nearRoads]], [[Location#Location Types|Location Types]], [[locationPosition]], [[nearestLocations]], [[createLocation]] |SEEALSO=
| [[findNearestEnemy]], [[nearestBuilding]], [[nearestObject]], [[nearestObjects]], [[nearObjects]], [[nearEntities]], [[nearTargets]], [[nearSupplies]], [[nearestLocationWithDubbing]], [[nearObjectsReady]], [[nearRoads]], [[Location#Location Types|Location Types]], [[locationPosition]], [[nearestLocations]], [[createLocation]] |SEEALSO=

Revision as of 01:55, 17 January 2021

Hover & click on the images for description

Description

Description:
Return the closest location of specified class to a given position.
Checked range is unlimited (i.e. covers the whole map).
Groups:
Locations

Syntax

Syntax:
nearestLocation [position, locationClass]
Parameters:
[position, locationClass]: Array
position: Object or Array in format PositionAGL or Position2D
locationClass: String of a location class name. If "" is supplied, any nearest location is returned. See Location Types
Return Value:
Location

Examples

Example 1:
_nearestCity = nearestLocation [getPos player, "nameCity"];
Example 2:
_anyNearestLocation = nearestLocation [player, ""];

Additional Information

See also:
findNearestEnemynearestBuildingnearestObjectnearestObjectsnearObjectsnearEntitiesnearTargetsnearSuppliesnearestLocationWithDubbingnearObjectsReadynearRoadsLocation TypeslocationPositionnearestLocationscreateLocation

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

Bottom Section