How do I... When tent is destroyed = not deleted from hive BUT contents are

justchil

Well-Known Member
I know this was a bug or I have seen it done. I'm running reality hive.

Right now when a tent is destroyed they are deleted from instance_deployables. What would one need to do to NOT delete them but to simply remove the contents from the tent either at the time of being destroyed or on the next restart.

Thanks :D
 
You need to find where the server is handling the tent death and modify it.

I'd elaborate more but I don't run vanilla or have the files to look through.

I'd assume it would be in your server.pbo in the compiles folder possibly as server_objectDeath or similar, or in server_functions/server_cleanup.
 
server_monitor

if (_type in SafeObjects) then {
if (_object isKindOf "TentStorage" || _object isKindOf "CamoNet_DZ" || _object isKindOf "Land_A_tent") then {
_pos set [2,0];
_object setPosATL _pos;
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
};
} else {
_damage = 1;
_object setDamage _damage;
diag_log format["OBJ: %1 - %2 REMOVED", _object,_damage];
};

server_publishobject

if (_object isKindOf "TentStorage" || _object isKindOf "CamoNet_DZ") then {
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
};

I can remove the MPEventHandler to keep them from being destroyed.... but there should be a way I can change setDamage = 1 to set the inventory instead. I'm looking around at the rest of the pbo now to find an example i can learn from.
 
I've been trying to find where it's defined. Searched every .sqf in the server.pbo and dayz_code with no luck hmm
 
Looks like it should be in server.pbo/init/server_functions.sqf

I think what I need to see is _object_killed in server_updateObject in the compiles folder.
Im assuming it has the code you need to edit there.
 
Not sure how I missed that lol

vehicle_handleServerKilled = {
private["_unit","_killer"];
_unit = _this select 0;
_killer = _this select 1;
[_unit, "killed"] call server_updateObject;
_unit removeAllMPEventHandlers "MPKilled";
_unit removeAllEventHandlers "Killed";
_unit removeAllEventHandlers "HandleDamage";
_unit removeAllEventHandlers "GetIn";
_unit removeAllEventHandlers "GetOut";
};

_object_killed = {
[_ObjectID,_UID] call server_deleteObj;
};

Here is server_deleteObj.sqf just in case:

private["_id","_uid","_key"];
_id = _this select 0;
_uid = _this select 1;

if (isServer) then {

if (parseNumber _id > 0) then {
_key = format["CHILD:304:%1:",_id];
_key call server_hiveWrite;
diag_log format["DELETE: Deleted by ID: %1",_id];
} else {
_key = format["CHILD:310:%1:",_uid];
_key call server_hiveWrite;
diag_log format["DELETE: Deleted by UID: %1",_uid];
};
};
 
So what its doing is on an object kill it immediately calls for it to be deleted from the database.

Try changing _object_killed to this and see if they are still there after a restart when you destroy them.

Code:
_object_killed = {
    _object setDamage 1;
    clearWeaponCargoGlobal _object;
    clearMagazineCargoGlobal _object;
};

If you are wanting to keep them in the database with inventory, try this instead:
Code:
_object_killed = {
    _object setDamage 1;
};
 
I will mess around with it. I had it not deleting immediately / after restart but the inventory was still in the tent. The goal is to get this along with remove inventory when destroyed.
 
Interesting. Stashes seem to work this way... waiting on a reboot but I just put gear in 2 hit them with satchel charges and minutes later the gear disappeared. Curious to see if they respawn after a restart.
 
Back
Top