Weapon Caches Disappearing

HospitalChair

Well-Known Member
I have added weapon caches onto my server via the 3d editor. They spawn correctly but only last for about 20 minutes before the server cleans them up. I used this guide http://www.dayzpatriots.com/adding-weapon-ammo-crates-1-7-7-1-t97.html before to add all of the exceptions, but the line of code that is of course the only thing i care about has changed from 1.7 to 1.8 that code is this:

"Check for Ammobox" \n
" {" \n
"if(!(_x isKindOf ""WeaponHolder"")) then {" \n
"diag_log (""CLEANUP: DELETING AN AMMOBOX "" + (typeOf _x));" \n
"deleteVehicle _x;" \n
"};" \n
"} forEach allMissionObjects ""ReammoBox"";" \n
"*/" \n
"" \n

We are told to comment out all of those lines and the weapon crates should stay but as i already stated that code doesnt exist. I really need some help fixing this as this is the last thing i need to do to polish my server off.
 
Try looking in server_functions.sqf.

Since I only run Epoch, if you can post the code block I can try to show you how to edit it.
 
Here is my server_functions

#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
waituntil {!isnil "bis_fnc_init"};

BIS_MPF_remoteExecutionServer = {
if ((_this select 1) select 2 == "JIPrequest") then {
[nil,(_this select 1) select 0,"loc",rJIPEXEC,[any,any,"per","execVM","ca\Modules\Functions\init.sqf"]] call RE;
};
};

BIS_Effects_Burn = {};
server_playerLogin = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerLogin.sqf";
server_playerSetup = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerSetup.sqf";
server_onPlayerDisconnect = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_onPlayerDisconnect.sqf";
server_updateObject = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_updateObject.sqf";
server_playerDied = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerDied.sqf";
server_publishObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishObject.sqf"; //Creates the object in DB
server_publishBld = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishBuilding.sqf"; //Creates the building in DB
server_deleteObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_deleteObj.sqf"; //Removes the object from the DB
server_playerSync = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerSync.sqf";
zombie_findOwner = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\zombie_findOwner.sqf";
server_updateNearbyObjects = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_updateNearbyObjects.sqf";
server_spawnCrashSite = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnCrashSite.sqf";
server_sendToClient = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_sendToClient.sqf";
server_Wildgenerate = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\zombie_Wildgenerate.sqf";
server_plantSpawner = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_plantSpawner.sqf";

//Get instance name (e.g. dayz_1.chernarus)
fnc_instanceName = {
"dayz_" + str(dayz_instance) + "." + worldName
};
spawnComposition = compile preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"; //"\z\addons\dayz_code\compile\object_mapper.sqf";
fn_bases = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fn_bases.sqf";

vehicle_handleServerKilled = {
private["_unit","_killer"];
_unit = _this select 0;
_killer = _this select 1;

[_unit, "killed"] call server_updateObject;
_unit removeAllMPEventHandlers "MPKilled";
_unit removeAllMPEventHandlers "mphit";
_unit removeAllMPEventHandlers "mprespawn";
_unit removeAllEventHandlers "FiredNear";
_unit removeAllEventHandlers "Killed";
_unit removeAllEventHandlers "HandleDamage";
_unit removeAllEventHandlers "GetIn";
_unit removeAllEventHandlers "GetOut";
_unit removeAllEventHandlers "Fired";
_unit removeAllEventHandlers "Local";
};

check_publishobject = {
private ["_allowed","_allowedObjects","_object","_playername"];

_object = _this select 0;
_playername = _this select 1;
_allowedObjects = ["TentStorage", "Hedgehog_DZ", "Sandbag1_DZ", "BearTrap_DZ", "Wire_cat1", "StashSmall", "StashMedium", "DomeTentStorage", "CamoNet_DZ", "Trap_Cans", "TrapTripwireFlare", "TrapBearTrapSmoke", "TrapTripwireGrenade", "TrapTripwireSmoke", "TrapBearTrapFlare", "CZBasicWeapons_EP1"];
_allowed = false;

#ifdef OBJECT_DEBUG
diag_log format ["DEBUG: Checking if Object: %1 is allowed published by %2", _object, _playername];
#endif

if ((typeOf _object) in _allowedObjects) then {
#ifdef OBJECT_DEBUG
diag_log format ["DEBUG: Object: %1 published by %2 is Safe",_object, _playername];
#endif
_allowed = true;
};

_allowed;
};

//event Handlers
eh_localCleanup = {
private ["_object","_type","_unit"];
_object = _this select 0;
_object addEventHandler ["local", {
if(_this select 1) then {
_unit = _this select 0;
_type = typeOf _unit;
_myGroupUnit = group _unit;
_unit removeAllMPEventHandlers "mpkilled";
_unit removeAllMPEventHandlers "mphit";
_unit removeAllMPEventHandlers "mprespawn";
_unit removeAllEventHandlers "FiredNear";
_unit removeAllEventHandlers "HandleDamage";
_unit removeAllEventHandlers "Killed";
_unit removeAllEventHandlers "Fired";
_unit removeAllEventHandlers "GetOut";
_unit removeAllEventHandlers "GetIn";
_unit removeAllEventHandlers "Local";
clearVehicleInit _unit;
deleteVehicle _unit;
deleteGroup _myGroupUnit;
_unit = nil;
diag_log ("CLEANUP: DELETED A " + str(_type) );
};
}];
};

server_hiveWrite = {
private["_data"];
//diag_log ("ATTEMPT WRITE: " + _this);
_data = "HiveExt" callExtension _this;
//diag_log ("WRITE: " +str(_data));
};

server_hiveReadWrite = {
private["_key","_resultArray","_data"];
_key = _this;
//diag_log ("ATTEMPT READ/WRITE: " + _key);
_data = "HiveExt" callExtension _key;
//diag_log ("READ/WRITE: " +str(_data));
_resultArray = call compile format ["%1",_data];
_resultArray;
};

onPlayerDisconnected "[_uid,_name] call server_onPlayerDisconnect;";

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;
};

server_getDiff2 = {
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 = _vNew - _vOld;
_object setVariable[(_variable + "_CHK"),_vNew];
_result;
};

dayz_objectUID2 = {
private["_position","_dir","_key"];
_dir = _this select 0;
_key = "";
_position = _this select 1;
{
_x = _x * 10;
if ( _x < 0 ) then { _x = _x * -10 };
_key = _key + str(round(_x));
} forEach _position;
_key = _key + str(round(_dir));
_key;
};

dayz_recordLogin = {
private["_key"];
_key = format["CHILD:103:%1:%2:%3:",_this select 0,_this select 1,_this select 2];
_key call server_hiveWrite;
};

call compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fa_hiveMaintenance.sqf";
 
There is a post text limit.

You need to post it to pastebin and link it.

The area im looking for is the block with ReammoBox in it.
 
You should be able to just comment out these two lines.
Code:
       "        deleteVehicle _x;" \n
       "        _delQty = _delQty + 1;" \n

Like so
Code:
//       "        deleteVehicle _x;" \n
//       "        _delQty = _delQty + 1;" \n
 
The only thing I can think of then is that you have an antihack or some other script cleaning up your boxes.
If you use INFIstar or another installed antihack make sure you have the hacker boxes check turned off.
 
That would be this area in server_cleanup
Code:
    /*%FSM<STATE "cleanup_objects">*/
    class cleanup_objects
    {
      name = "cleanup_objects";
      init = /*%FSM<STATEINIT""">*/"_missionObjs =  allMissionObjects ""ReammoBox"";" \n
       "_qty = count _missionObjs;" \n
       "" \n
       "diag_log (""CLEANUP:TOTAL "" + str(_qty) + "" LOOT BAGS"");" \n
       "" \n
       "_dateNow = (DateToNumber date);" \n
       "_delQty = 0;" \n
       "{" \n
       "    _created = (_x getVariable [""created"",-0.1]);" \n
       "    if (_created == -0.1) then {" \n
       "        _x setVariable [""created"",_dateNow,false];" \n
       "        _created = _dateNow;" \n
       "    };" \n
       "    _keep = _x getVariable [""permaLoot"",false];" \n
       "    _age = (_dateNow - _created) * 525948;" \n
       "    _nearby = {(isPlayer _x) and (alive _x)} count (_x nearEntities [[""CAManBase"",""AllVehicles""], 130]);" \n
       "    if ( (!_keep) && (_nearby==0) && (_age > 20)) then {" \n
       "        deleteVehicle _x;" \n
       "        _delQty = _delQty + 1;" \n
       "    };" \n
       "" \n
       "} forEach _missionObjs;" \n
       "" \n
       "if (_delQty > 0) then {" \n
       "    diag_log (""CLEANUP: DELETED "" + str(_delQty) + "" LOOT BAGS"");" \n
       "};" \n
       ""/*%FSM</STATEINIT""">*/;

So change this code in that block
Code:
       "        deleteVehicle _x;" \n
       "        _delQty = _delQty + 1;" \n

to this
Code:
       "        //deleteVehicle _x;" \n
       "        //_delQty = _delQty + 1;" \n
 
Hey Vampire, since you seem to be on the up and up with coding, would you have any idea as to how i can change the cleanup time for bodies and wrecks. I'm wanting to change the time till wrecks get cleaned up to 10 minutes, and bodies to 30.
 
You would need to look at what is called when it happens.

I'd assume a vehicle wreck calls server_updateObject with it being killed.

Body cleanup seems to happen in server_functions.sqf as the function server_spawncleanDead.

What do you mean by wrecks being cleaned up? every server I've been on the burnt wreck stays there till restart as far as I could tell.
 
Yeah, but im pretty sure there is a way to delete wrecked vehicles before restart. I'm just trying to reduce lag as much as possible and being a pvp server, there are always a lot of bodies and wrecks everywhere.
 
Back
Top