check to prevent spawning crashes on top of a vehicle or base

This commit is contained in:
[VB]AWOL
2013-10-21 11:59:11 -05:00
parent bf2bc9e875
commit 9a63abb0a2

View File

@@ -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)]);