BIS fnc nearestPosition: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) (Page filling) |
m (template:command argument fix) |
||
Line 7: | Line 7: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Function to find the nearest Object or position from a list, when compared to a given reference. |= | | Function to find the nearest Object or position from a list, when compared to a given reference. |DESCRIPTION= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [items, origin] call [[BIS_fnc_nearestPosition]] |= | | [items, origin] call [[BIS_fnc_nearestPosition]] |SYNTAX= | ||
|p1= items: [[Array]] of [[Object]], [[Location]], [[Group]], [[String]] (marker) '''and/or''' [[Position]] - note that for a group, '''leader's position''' is used |= | |p1= items: [[Array]] of [[Object]], [[Location]], [[Group]], [[String]] (marker) '''and/or''' [[Position]] - note that for a group, '''leader's position''' is used |PARAMETER1= | ||
|p2= origin: [[Object]], [[Location]], [[Group]], [[String]] (marker) or [[Position]] |= | |p2= origin: [[Object]], [[Location]], [[Group]], [[String]] (marker) or [[Position]] |PARAMETER2= | ||
| [[Object]], [[Location]], [[Group]], [[String]] (marker) or [[Position]] - the closest from ''items'' |= | | [[Object]], [[Location]], [[Group]], [[String]] (marker) or [[Position]] - the closest from ''items'' |RETURNVALUE= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <code>{{codecomment|// Find the nearest marker from player}} | |x1= <code>{{codecomment|// Find the nearest marker from player}} | ||
_nearestMarker = <nowiki>[</nowiki>[[allMapMarkers]], [[player]]] [[call]] [[BIS_fnc_nearestPosition]];</code> |= | _nearestMarker = <nowiki>[</nowiki>[[allMapMarkers]], [[player]]] [[call]] [[BIS_fnc_nearestPosition]];</code> |EXAMPLE1= | ||
|x2= <code>{{codecomment|// Find the nearest marker to trigger using trigger onActivation code}} | |x2= <code>{{codecomment|// Find the nearest marker to trigger using trigger onActivation code}} | ||
_nearestMarker = <nowiki>[</nowiki>[[allMapMarkers]], [[thisTrigger]]] [[call]] [[BIS_fnc_nearestPosition]];</code> |= | _nearestMarker = <nowiki>[</nowiki>[[allMapMarkers]], [[thisTrigger]]] [[call]] [[BIS_fnc_nearestPosition]];</code> |EXAMPLE1= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[nearObjects]], [[nearestObject]], [[nearestObjects]], [[BIS_fnc_nearestPoint]], [[BIS_fnc_nearestNum]], [[BIS_fnc_nearestRoad]], [[BIS_fnc_nearestHelipad]], [[BIS_fnc_isPosBlacklisted]] |= | | [[nearObjects]], [[nearestObject]], [[nearestObjects]], [[BIS_fnc_nearestPoint]], [[BIS_fnc_nearestNum]], [[BIS_fnc_nearestRoad]], [[BIS_fnc_nearestHelipad]], [[BIS_fnc_isPosBlacklisted]] |SEEALSO= | ||
}} | }} | ||
Revision as of 14:32, 7 April 2019
Description
- Description:
- Function to find the nearest Object or position from a list, when compared to a given reference.
- Execution:
- call
- Groups:
- Uncategorised
Syntax
- Syntax:
- [items, origin] call BIS_fnc_nearestPosition
- Parameters:
- items: Array of Object, Location, Group, String (marker) and/or Position - note that for a group, leader's position is used
- origin: Object, Location, Group, String (marker) or Position
- Return Value:
- Object, Location, Group, String (marker) or Position - the closest from items
Examples
- Example 1:
// Find the nearest marker from player _nearestMarker = [allMapMarkers, player] call BIS_fnc_nearestPosition;
- Example 2:
// Find the nearest marker to trigger using trigger onActivation code _nearestMarker = [allMapMarkers, thisTrigger] call BIS_fnc_nearestPosition;
Additional Information
- See also:
- nearObjectsnearestObjectnearestObjectsBIS_fnc_nearestPointBIS_fnc_nearestNumBIS_fnc_nearestRoadBIS_fnc_nearestHelipadBIS_fnc_isPosBlacklisted
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