[Release] Auto Delete Wrecked Vehicles

QueZ

Well-Known Member
A very simple script which I asked for and got help from AlienX to achieve. So thank you so much AlienX for all your help. Now for those who wishes to use this modification as well here is a release.

WHAT THIS DOES: This modification will Auto delete a wrecked vehicle seconds after it explodes. It will reduce lag on your server as well as get rid of the wall of flames (if you run older versions of dayz or different mods with this problem still). Wrecks will delete within 5 seconds or less usually. Very useful for servers with a LOT of vehicles and choppers. Wrecks cause a lot of lag specially Choppers.
  • HELP THREAD & CREDIT TO ALIENX: HERE
  • Installation Time: About 5 minutes.
  • Difficulty: Easy
  • Requirements: Notepad++, PBO Manager, dayz_server.pbo file
--------------------------------------------------------------------------------------------------

INSTALLATION

Step 1 - Open server_updateObject.sqf from your dayz_server.pbo

Step 2 - Find the following block of code

Code:
_object_damage = {
    private["_hitpoints","_array","_hit","_selection","_key","_damage"];
    _hitpoints = _object call vehicle_getHitpoints;
    _damage = damage _object;
    _array = [];
    {
        _hit = [_object,_x] call object_getHit;
        _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
        if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
        _object setHit ["_selection", _hit]
    } forEach _hitpoints;
    _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
    diag_log ("HIVE: WRITE: "+ str(_key));
    _key call server_hiveWrite;
    _object setVariable ["needUpdate",false,true];
};

And replace it with the following
Code:
_object_damage = {
    private["_hitpoints","_array","_hit","_selection","_key","_damage"];
    _hitpoints = _object call vehicle_getHitpoints;
    _damage = damage _object;
    _array = [];
    {
        _hit = [_object,_x] call object_getHit;
        _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
        if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
        _object setHit ["_selection", _hit]
    } forEach _hitpoints;
    _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
    diag_log ("HIVE: WRITE: "+ str(_key));
    _key call server_hiveWrite;
    if ( _damage >= 1 ) then { deleteVehicle _object; };
    _object setVariable ["needUpdate",false,true];
};

Step 3 - Repack the Server PBO and Upload and of course enjoy!

---------------------------------------------------------------------------------------------------

OPTIONAL

To change the time it takes in seconds for the vehicle wrecks to delete, use this code instead.
Simply change the 5 in { sleep 5; deleteVehicle _this; }; to change the time in seconds
Again credit to AlienX: HERE
Code:
_object_damage = {
    private["_hitpoints","_array","_hit","_selection","_key","_damage"];
    _hitpoints = _object call vehicle_getHitpoints;
    _damage = damage _object;
    _array = [];
    {
        _hit = [_object,_x] call object_getHit;
        _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
        if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
        _object setHit ["_selection", _hit]
    } forEach _hitpoints;
    _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
    diag_log ("HIVE: WRITE: "+ str(_key));
    _key call server_hiveWrite;
    _object setVariable ["needUpdate",false,true];
    if ( _damage >= 1 ) then { _object spawn { sleep 5; deleteVehicle _this; }; };
};
 
Back
Top