Tent/Vehicle Saving Issues Fix for 1.7.6.1 - For Reality Hive

Hello,

I am here to release some of my fixes that I came up with when I was working with 1.7.6.1 I did notice that tents wouldn't update inventory or if they was runned over they would come back after restart. I have accomplished fixing both issues. I wouldn't call myself a programmer/coder but I just have a good understanding how stuff work, don't ask me how I know these things I just know. :p Well anyway I'll release the fixes down below for you to review. I don't take any responsbility for breaking your server or lose any in game items. This is strictly "At your Own Risk" procedure.

First fix - Making sure Tents get their Inventory updated in game and not have it possibly duping items that you already took out of your tent after a server restart.

-> Locate your server's server_monitor.sqf it should be located in dayz_server > system > server_monitor.sqf and locate this following line:
Code:
            if (_damage < 1) then {
                diag_log format["OBJ: %1 - %2", _idKey,_type];
               
                //Create it
                _object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
                _object setVariable ["lastUpdate",time];
                _object setVariable ["ObjectID", _idKey, true];
                _object setVariable ["CharacterID", _ownerID, true];
               
                clearWeaponCargoGlobal  _object;
                clearMagazineCargoGlobal  _object;
               
                if (_object isKindOf "TentStorage") then {
                    _pos set [2,0];
                    _object setpos _pos;
                    _object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
                };
                _object setdir _dir;
                _object setDamage _damage;

Replace it with this:
Code:
if (_damage < 1) then {
        diag_log("Spawned: " + str(_idKey) + " " + _type);
       
        _object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
        _object setVariable ["lastUpdate",time];
        // Don't set objects for deployables to ensure proper inventory updates
        if (_ownerID == "0") then {
            _object setVariable ["ObjectID", str(_idKey), true];
        } else {
            _object setVariable ["ObjectUID", _worldspace call dayz_objectUID2, true];
        };
        _object setVariable ["CharacterID", _ownerID, true];
       
        clearWeaponCargoGlobal  _object;
        clearMagazineCargoGlobal  _object;
       
        if (_object isKindOf "TentStorage") then {
            _pos set [2,0];
            _object setpos _pos;
            _object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}]; // Don't have to have this enabled if not planning to have tents removed after destroyed.
        };
        _object setdir _dir;
        _object setDamage _damage;

Second Fix this fix will make sure the tents will be removed from Database when they are destroyed and not have it coming back after restart.

-> Locate your server's server_Updateobject.sqf which is located under dayz_server > compiles > server_Updateobject.sqf and locate in that file this line "_object_killed = {" without quotes and once you find it or if it doesn't have it you should be okay adding it in. Once you find that you should be seeing something sort of like this.
Code:
_object_killed = {
    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]]};
        _hit = 1;
        _object setHit ["_selection", _hit]
    } forEach _hitpoints;
    _damage = 1;
   
    if (_objectID == "0") then {
       
        //_key = format["CHILD:306:%1:%2:%3:",_uid,_array,_damage];
    } else {
        _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];
};

Now your going to want to replace it with this very simple fix:
Notes: This may also be deleting vehicles that are damaged beyond repair.
Code:
_object_killed = {
 
    [_objectID,_UID] call server_deleteObj;
};

Note from Person Posting This Fix:

I have tested this on my community's test server and I've just been going through see what I can fix, and this was one of the fixes that I have accomplished and it works. On mine I prefered to keep the tents from being removed from database after being destroyed in game. I just wanted to see if I could accomplish it and it worked but I have mine commented out and left the original _object_killed active. if you ever want to comment out a complete function without // to each line just do this on top of it put /* and at the bottom of it put */ and than waalah that function is completely commented out or that area.
 
Back
Top