BIS fnc nearestPosition: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\{\{ *codecomment *\| *\/\/ *([^ ]+) *\}\} " to "{{cc|$1}}") |
Lou Montana (talk | contribs) m (revert + fix) |
||
Line 1: | Line 1: | ||
{{RV|type=function | {{RV|type=function | ||
| arma2 | |game1= arma2 | ||
|1.00 | |version1= 1.00 | ||
|gr1 = Positions | |gr1= Positions | ||
| Function to find the nearest Object or position from a list, when compared to a given reference. | |descr= Function to find the nearest Object or position from a list, when compared to a given reference. | ||
| [items, origin] call [[BIS_fnc_nearestPosition]] | |s1= [items, origin] call [[BIS_fnc_nearestPosition]] | ||
|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 | ||
Line 15: | Line 15: | ||
|p2= origin: [[Object]], [[Location]], [[Group]], [[String]] (marker) or [[Position]] | |p2= origin: [[Object]], [[Location]], [[Group]], [[String]] (marker) or [[Position]] | ||
| [[Object]], [[Location]], [[Group]], [[String]] (marker) or [[Position]] - the closest from ''items'' | |r1= [[Object]], [[Location]], [[Group]], [[String]] (marker) or [[Position]] - the closest from ''items'' | ||
|x1= <code>{{cc| Find the nearest marker from player}}_nearestMarker = [<nowiki/>[[allMapMarkers]], [[player]]] [[call]] [[BIS_fnc_nearestPosition]];</code> | |x1= <code>{{cc|Find the nearest marker from player}} | ||
_nearestMarker = [<nowiki/>[[allMapMarkers]], [[player]]] [[call]] [[BIS_fnc_nearestPosition]];</code> | |||
|x2= <code>{{cc| Find the nearest marker to trigger using trigger onActivation code}}_nearestMarker = [<nowiki/>[[allMapMarkers]], [[thisTrigger]]] [[call]] [[BIS_fnc_nearestPosition]];</code> | |x2= <code>{{cc|Find the nearest marker to trigger using trigger onActivation code}} | ||
_nearestMarker = [<nowiki/>[[allMapMarkers]], [[thisTrigger]]] [[call]] [[BIS_fnc_nearestPosition]];</code> | |||
| [[nearObjects]], [[nearestObject]], [[nearestObjects]], [[BIS_fnc_nearestPoint]], [[BIS_fnc_nearestNum]], [[BIS_fnc_nearestRoad]], [[BIS_fnc_nearestHelipad]], [[BIS_fnc_isPosBlacklisted]] | |seealso= [[nearObjects]], [[nearestObject]], [[nearestObjects]], [[BIS_fnc_nearestPoint]], [[BIS_fnc_nearestNum]], [[BIS_fnc_nearestRoad]], [[BIS_fnc_nearestHelipad]], [[BIS_fnc_isPosBlacklisted]] | ||
}} | }} | ||
[[Category:{{Name|arma2oa}}: Functions|{{uc:nearestPosition}}]] | [[Category:{{Name|arma2oa}}: Functions|{{uc:nearestPosition}}]] | ||
[[Category:{{Name|tkoh}}: Functions|{{uc:nearestPosition}}]] | [[Category:{{Name|tkoh}}: Functions|{{uc:nearestPosition}}]] | ||
[[Category:{{Name|arma3}}: Functions|{{uc:nearestPosition}}]] | [[Category:{{Name|arma3}}: Functions|{{uc:nearestPosition}}]] |
Revision as of 21:58, 29 January 2021
Description
- Description:
- Function to find the nearest Object or position from a list, when compared to a given reference.
- Execution:
- call
- Groups:
- Positions
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