From 9a63abb0a270de11bc36a965f9ddc6a35c14e856 Mon Sep 17 00:00:00 2001 From: "[VB]AWOL" Date: Mon, 21 Oct 2013 11:59:11 -0500 Subject: [PATCH] check to prevent spawning crashes on top of a vehicle or base --- SQF/dayz_server/modules/crash_spawner.sqf | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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)]);