9213ec24ca
Added old Dayz style helicrashes
101 lines
4.1 KiB
Plaintext
101 lines
4.1 KiB
Plaintext
if (!isServer) exitWith {};
|
|
|
|
_numberofCrashes = 5; // this is the number of helicrashes that you want to spawn
|
|
|
|
if (worldName == 'Namalsk') then
|
|
{
|
|
_numberofCrashes = 2; // lower number for a smaller map
|
|
};
|
|
|
|
_middle = worldSize/2;
|
|
_spawnCenter = [_middle,_middle,0];
|
|
_max = _middle;
|
|
_min = 0; // minimum distance from the center position (Number) in meters
|
|
_mindist = 15; // minimum distance from the nearest object (Number) in meters, ie. spawn at least this distance away from anything within x meters..
|
|
_water = 0; // water mode (Number) 0: cannot be in water , 1: can either be in water or not , 2: must be in water
|
|
_shoremode = 0; // 0: does not have to be at a shore , 1: must be at a shore
|
|
_markersize = 100; // Radius of the marker in meters
|
|
_displayMarkers = SC_debug; // only use for debug, no need for actual gameplay
|
|
|
|
private['_position'];
|
|
|
|
diag_log format ["[OCCUPATION:HeliCrashes]:: Initialised at %1",time];
|
|
|
|
for "_i" from 1 to _numberofCrashes do
|
|
{
|
|
_validspot = false;
|
|
while{!_validspot} do
|
|
{
|
|
sleep 0.2;
|
|
_position = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos;
|
|
_validspot = true;
|
|
|
|
// Check for nearby spawn points and traders
|
|
_nearestMarker = [allMapMarkers, _position] call BIS_fnc_nearestPosition;
|
|
_posNearestMarker = getMarkerPos _nearestMarker;
|
|
if(_position distance _posNearestMarker < 750) then { _validspot = false; };
|
|
|
|
//Check if near another heli crash site
|
|
_nearOtherCrash = (nearestObjects [_position,["Land_UWreck_MV22_F"],750]) select 0;
|
|
if (!isNil "_nearOtherCrash") then { _validspot = false; };
|
|
|
|
//Check if near another loot crate site
|
|
_nearOtherCrate = (nearestObjects [_position,["CargoNet_01_box_F"],500]) select 0;
|
|
if (!isNil "_nearOtherCrate") then { _validspot = false; };
|
|
|
|
//Check if near player base
|
|
_nearBase = (nearestObjects [_position,["Exile_Construction_Flag_Static"],500]) select 0;
|
|
if (!isNil "_nearBase") then { _validspot = false; };
|
|
|
|
};
|
|
|
|
diag_log format['[OCCUPATION:HeliCrashes] Crash %1 : Location %2',_i,_position];
|
|
_helicopter = "Land_UWreck_MV22_F";
|
|
_vehHeli = _helicopter createVehicle [0,0,0];
|
|
_heliFire = "test_EmptyObjectForFireBig" createVehicle (position _vehHeli);
|
|
_heliFire attachto [_vehHeli, [0,0,-1]];
|
|
_vehHeli setPos _position;
|
|
|
|
_positionOfBox = [_position,3,10,1,0,10,0] call BIS_fnc_findSafePos;
|
|
_box = "Box_NATO_Ammo_F" createvehicle _positionOfBox;
|
|
|
|
clearMagazineCargoGlobal _box;
|
|
clearWeaponCargoGlobal _box;
|
|
clearItemCargoGlobal _box;
|
|
_box enableRopeAttach false;
|
|
_box setVariable ["permaLoot",true];
|
|
_box allowDamage false;
|
|
_box addMagazineCargoGlobal ["HandGrenade", (random 2)];
|
|
_box addMagazineCargoGlobal ["APERSBoundingMine_Range_Mag", (random 2)];
|
|
_box addBackpackCargoGlobal ["B_Parachute", 1 + (random 1)];
|
|
_box addItemCargoGlobal ["H_CrewHelmetHeli_B", 1 + (random 1)];
|
|
_box addItemCargoGlobal ["U_B_HeliPilotCoveralls", 1 + (random 1)];
|
|
_box addItemCargoGlobal ["ItemGPS", (random 1)];
|
|
_box addItemCargoGlobal ["Exile_Item_InstaDoc", (random 1)];
|
|
_box addItemCargoGlobal ["Exile_Item_PlasticBottleFreshWater", 2 + (random 2)];
|
|
_box addItemCargoGlobal ["Exile_Item_EMRE", 2 + (random 2)];
|
|
|
|
// Add weapons with ammo to the Box
|
|
_possibleWeapons = ["srifle_DMR_02_camo_F","srifle_DMR_03_woodland_F","srifle_DMR_04_F","srifle_DMR_05_hex_F"];
|
|
_amountOfWeapons = 1 + (random 3);
|
|
|
|
for "_i" from 1 to _amountOfWeapons do
|
|
{
|
|
_weaponToAdd = _possibleWeapons call BIS_fnc_selectRandom;
|
|
_box addWeaponCargoGlobal [_weaponToAdd,1];
|
|
|
|
_magazinesToAdd = getArray (configFile >> "CfgWeapons" >> _weaponToAdd >> "magazines");
|
|
_box addMagazineCargoGlobal [(_magazinesToAdd select 0),round random 5];
|
|
};
|
|
|
|
if(_displayMarkers) then
|
|
{
|
|
_event_marker = createMarker [ format ["helicrash_marker_%1", _i], _position];
|
|
_event_marker setMarkerColor "ColorRed";
|
|
_event_marker setMarkerAlpha 1;
|
|
_event_marker setMarkerText "Heli Crash";
|
|
_event_marker setMarkerType "loc_Tree";
|
|
_event_marker setMarkerBrush "Vertical";
|
|
_event_marker setMarkerSize [(3), (3)];
|
|
};
|
|
}; |