diff --git a/SQF/dayz_server/modules/crash_spawner.sqf b/SQF/dayz_server/modules/crash_spawner.sqf index f1fd5f87e..55af15436 100644 --- a/SQF/dayz_server/modules/crash_spawner.sqf +++ b/SQF/dayz_server/modules/crash_spawner.sqf @@ -21,8 +21,14 @@ if (_spawnRoll <= _spawnChance) then { }; _crashName = getText (configFile >> "CfgVehicles" >> _crashModel >> "displayName"); - - _position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos; + + // Loop for a new location without any vehicles + _needsrelocated = true; + while {_needsrelocated} do { + _position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos; + _istoomany = _position nearObjects ["AllVehicles",10]; + if((count _istoomany) == 0) then { _needsrelocated = false; }; + }; //diag_log(format["CRASHSPAWNER: Spawning '%1' with loot table '%2' NOW! (%3) at: %4", _crashName, _lootTable, time, str(_position)]);