private ["_DZE_safeZonePosArray","_customPosition","_customRadius","_maxDist","_nearVehicles","_objDist","_position","_safeZonePos","_safeZoneRadius","_useCustomPosition"]; _useCustomPosition = false; // Enable a custom position to move vehicles to (i.e a junk yard) _customPosition = [6942.64,15121.6,0]; // Position for vehicles to be moved to if _useCustomPosition = true; _customRadius = 150; // Minimum distance from the custom position to move vehicles to _maxDist = 600; // Maximum distance from the safe zone position to find a safe position or custom position for relocation, setting this too low can make vehicles spawn very close to other vehicles. _objDist = 15; // Minimum distance from the safe position for relocation to the center of the nearest object. Specifying quite a large distance here will slow the function and might often fail to find a suitable position. _DZE_safeZonePosArray = [ [[3965.6555, 2357.6074,0],30],//detention [[3814.6487, 5661.3838,0],50],//sisters [[8584.3291, 2005.4772, 0],50],//enola [[3062.4978, 8048.4341, 0],80],//refugee [[3505.8303, 5778.3496,0],120]//central ]; { _safeZonePos = _x select 0; _safeZoneRadius = _x select 1; _nearVehicles = _safeZonePos nearEntities [["Air","LandVehicle","Ship"],_safeZoneRadius]; { if (_useCustomPosition) then { _position = [_customPosition,_customRadius,_maxDist,_objDist,1,0,0,[]] call BIS_fnc_findSafePos; } else { _position = [_safeZonePos,_safeZoneRadius + 50,_maxDist,_objDist,if (_x isKindOf "Ship") then {2} else {0},0,0,[],[_safeZonePos,_safeZonePos]] call BIS_fnc_findSafePos; }; _x setPos _position; [_x,"position"] call server_updateObject; diag_log format ["[SAFEZONE] %1 was moved out of a safe zone to: @%2 %3",typeOf _x,mapGridPosition _position,_position]; } forEach _nearVehicles; } forEach _DZE_safeZonePosArray;