How to make heli crashes spawn on restart?

Kevin-

Member
Hey I'd like for heli crashes to spawn when the server restarts because on my server, the server restarts every 6 hours and crashed helis have been even harder to find and I'd like to make it so it is back to normal and that heli crashes spawn during the server restart. If anyone has done this please reply or link the tutorial, it would be much appreciated. :)
 
dayz_server.pbo>>system>>server_monitor.sqf

At the Bottom ADD:
Code:
//Spawn crashed helos
for "_x" from 1 to 5 do {
    _id = [] spawn spawn_heliCrash;
    //waitUntil{scriptDone _id};
};


day_server>>init>server_functions.sqf

In between this:
Code:
server_hiveReadWrite = {
    private["_key","_resultArray","_data"];
    _key = _this select 0;
    //diag_log ("ATTEMPT READ/WRITE: " + _key);
    _data = "HiveEXT" callExtension _key;
    diag_log ("READ/WRITE: " + _data);
    _resultArray = call compile format ["%1;",_data];
    _resultArray;
};

And This:
Code:
server_getDiff =    {
    private["_variable","_object","_vNew","_vOld","_result"];
    _variable = _this select 0;
    _object =    _this select 1;
    _vNew =    _object getVariable[_variable,0];
    _vOld =    _object getVariable[(_variable + "_CHK"),_vNew];
    _result =    0;
    if (_vNew < _vOld) then {
        //JIP issues
        _vNew = _vNew + _vOld;
        _object getVariable[(_variable + "_CHK"),_vNew];
    } else {
        _result = _vNew - _vOld;
        _object setVariable[(_variable + "_CHK"),_vNew];
    };
    _result
};



ADD This:

Code:
spawn_heliCrash = {
    private["_position","_veh","_num","_config","_itemType","_itemChance","_weights","_index","_iArray"];
 
    waitUntil{!isNil "BIS_fnc_selectRandom"};
    if (isDedicated) then {
    _position = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
    _veh = createVehicle ["UH1Wreck_DZ",_position, [], 0, "CAN_COLLIDE"];
    dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_veh];
    _veh setVariable ["ObjectID",1,true];
    dayzFire = [_veh,2,time,false,false];
    publicVariable "dayzFire";
    if (isServer) then {
        nul=dayzFire spawn BIS_Effects_Burn;
    };
    _num = round(random 4) + 3;
    _config =        configFile >> "CfgBuildingLoot" >> "HeliCrash";
    _itemType =        [] + getArray (_config >> "itemType");
    //diag_log ("DW_DEBUG: _itemType: " + str(_itemType));
    _itemChance =    [] + getArray (_config >> "itemChance");
    //diag_log ("DW_DEBUG: _itemChance: " + str(_itemChance));
    //diag_log ("DW_DEBUG: (isnil fnc_buildWeightedArray): " + str(isnil "fnc_buildWeightedArray"));
 
    waituntil {!isnil "fnc_buildWeightedArray"};
 
    _weights = [];
    _weights =        [_itemType,_itemChance] call fnc_buildWeightedArray;
    //diag_log ("DW_DEBUG: _weights: " + str(_weights));
    for "_x" from 1 to _num do {
        //create loot
        _index = _weights call BIS_fnc_selectRandom;
        sleep 1;
        if (count _itemType > _index) then {
            //diag_log ("DW_DEBUG: " + str(count (_itemType)) + " select " + str(_index));
            _iArray = _itemType select _index;
            _iArray set [2,_position];
            _iArray set [3,5];
            _iArray call spawn_loot;
            _nearby = _position nearObjects ["WeaponHolder",20];
            {
                _x setVariable ["permaLoot",true];
            } forEach _nearBy;
        };
    };
    };
};


dayz_server.pbo>>init>>server_functions.sqf

Comment out:
Code:
//server_spawnCrashSite  =    compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnCrashSite.sqf";
 
Just wondering where do you customize your Loottable. Obliviously you can't do it in server_spawnCrashSite.sqf anymore.
 
Back
Top