{"name":"BIS_fnc_nearestPosition","operator":null,"title":"BIS fnc nearestPosition","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_nearestPosition","revid":328399,"updated":"2022-07-13T16:00:49Z","groups":["Positions"],"status":"ok","replaced_by":[],"games":[{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2","name":"Arma 2","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Function to find the nearest Object or position from a list, when compared to a given reference.","syntaxes":[{"syntax":"[items, origin] call BIS_fnc_nearestPosition","since":null,"effect":null,"exec":null,"params":[{"name":"items","type":"Array of Object, Location, Group, String (marker) and/or Position","optional":false,"default":null,"description":"note that for a group, **leader's position** is used","types":["Array","Object","Location","Group","String","Position"],"since":null,"text":"items: Array of Object, Location, Group, String (marker) **and/or** Position - note that for a group, **leader's position** is used"},{"name":"origin","type":null,"optional":false,"default":null,"description":"Object, Location, Group, String (marker) or Position","types":["Object","Location","Group","String","Position"],"since":null,"text":"origin: Object, Location, Group, String (marker) or Position"}],"returns":{"type":"Object, Location, Group, String (marker) or Position","types":["Object","Location","Group","String","Position"],"description":"the closest from items","text":"Object, Location, Group, String (marker) or Position - the closest from *items*"}}],"examples":[{"text":"```sqf\n// Find the nearest marker from player\n_nearestMarker = [allMapMarkers, player] call BIS_fnc_nearestPosition;\n```","code":["// Find the nearest marker from player\n_nearestMarker = [allMapMarkers, player] call BIS_fnc_nearestPosition;"]},{"text":"```sqf\n// Find the nearest marker to trigger using trigger onActivation code\n_nearestMarker = [allMapMarkers, thisTrigger] call BIS_fnc_nearestPosition;\n```","code":["// Find the nearest marker to trigger using trigger onActivation code\n_nearestMarker = [allMapMarkers, thisTrigger] call BIS_fnc_nearestPosition;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["nearObjects","nearestObject","nearestObjects","BIS_fnc_nearestPoint","BIS_fnc_nearestNum","BIS_fnc_nearestRoad","BIS_fnc_nearestHelipad","BIS_fnc_isPosBlacklisted"],"notes":[],"categories":["Arma 2: Functions","Arma 2: New Functions","Arma 2: Operation Arrowhead: Functions","Arma 3: Functions","Function Group: Positions","Functions","Introduced with Arma 2 version 1.00","Take On Helicopters: Functions"],"docblock":null,"filled_from_docblock":[]}