Ammo boxes disapearing

zappi

Well-Known Member
Hi all, i have a problem with ammoboxes that i added in the server.

I used arma 2D/3D editor to place them on map.
It's none edited ammoboxes.

The problem is, when player come to check out the boxes, they sometimes disapearing.
It's happens after some minutes.
IA defending those ammoboxes, and mainly, the time that player kill the defenders and come to the ammoboxes they disapearing.

What can i do to solve this problem?
 
That will be possible to do, but kinda hard to find.
Pretty much depending on what DayZ you are running, it can be the server cleanup which deletes them.
 
I use Epoch 1.0.2.4 and will be updated soon under 1.0.2.5

I use mission IA for chernarus too ( with other script) and getting no problem with the mission ammoboxes.
They still always on the server with no disapearing...
 
Not sure but check your cleanup.fsm in your server pbo. 1.8.0.3 is set to clean like every 60 seconds, set it to like 1800 or 3600.

Mine is set a 1800 which is an hour and a half before my boxes are deleted. I had it set at 3600, but too much loot would say for 3 hours. I liked it though.

See if you can find something like this.

Code:
class too_many_objects
        {
          priority = 2.000000;
          to="cleanup_objects";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _timeNem) > 1800)"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/"_timeNem = diag_tickTime;"/*%FSM</ACTION""">*/;
        };
 
Sounds like its a cleanup issue, anything say like 60 or the amount of time it takes for it to disappear? Wish I had an epoch server pbo to reference. :(
 
Code:
class FSM
{
  fsmName = "DayZ Server Cleanup";
  class States
  {
    /*%FSM<STATE "init">*/
    class init
    {
      name = "init";
      init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "initialized">*/
        class initialized
        {
          priority = 0.000000;
          to="prepare";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"!isnil ""bis_fnc_init"""/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
      };
    };
    /*%FSM</STATE>*/
    /*%FSM<STATE "waiting">*/
    class waiting
    {
      name = "waiting";
      init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Waiting for next task"";" \n
      ""/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "need_update">*/
        class need_update
        {
          priority = 1.000000;
          to="update_objects";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"( (count needUpdate_objects) > 0 && (diag_tickTime -_lastNeedUpdate>40) )"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/"_lastNeedUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
        /*%FSM<LINK "cleanup_groups">*/
        class cleanup_groups
        {
          priority = 1.000000;
          to="group_cleanup";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupGroups) > 10)"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/"_lastCleanupGroups = diag_tickTime;"/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
        /*%FSM<LINK "cleanup_vehicles">*/
        class cleanup_vehicles
        {
          priority = 1.000000;
          to="vehicle_cleanup";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupVehicles) > 5)"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/"_lastCleanupVehicles = diag_tickTime;"/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
        /*%FSM<LINK "time_sync">*/
        class time_sync
        {
          priority = 1.000000;
          to="sync_the_time";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/"_lastUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
        /*%FSM<LINK "true">*/
        class true
        {
          priority = 0.000000;
          to="general_cleanup";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/

Here it's a part of the server_cleanup.fsm
 
theres a few possibilitys here, but my first guess would also be the cleanup script, idk about epoch but im assuming its simmular to other mods ... if it is you will need to look for some lines that looks something like this in your server cleanup scripts:
Code:
      "_missionObjs = allMissionObjects ""ReammoBox"";" \n
      "_qty = count _missionObjs;" \n
      "" \n
      "diag_log (""CLEANUP:TOTAL "" + str(_qty) + "" LOOT BAGS"");" \n
      "" \n
      "_delQty = 0;" \n
      "{" \n
      "    _keep = _x getVariable [""permaLoot"",false];" \n
and change the :
Code:
[""permaLoot"",false]
to
Code:
[""permaLoot"",true]
and if you got something like this:
Code:
      "//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
comment it out ...

it should not delete them after this.
 
Sorry for delay;

Well i checked all the server_cleanup.fsm but didnt found anything about reammobox or Ammobox ...

Here it's the big part of the file...

Code:
...
        /*%FSM<LINK "need_update">*/
        class need_update
        {
          priority = 1.000000;
          to="update_objects";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"( (count needUpdate_objects) > 0 && (diag_tickTime -_lastNeedUpdate>40) )"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/"_lastNeedUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
        /*%FSM<LINK "cleanup_groups">*/
        class cleanup_groups
        {
          priority = 1.000000;
          to="group_cleanup";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupGroups) > 10)"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/"_lastCleanupGroups = diag_tickTime;"/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
        /*%FSM<LINK "cleanup_vehicles">*/
        class cleanup_vehicles
        {
          priority = 1.000000;
          to="vehicle_cleanup";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupVehicles) > 5)"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/"_lastCleanupVehicles = diag_tickTime;"/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
        /*%FSM<LINK "time_sync">*/
        class time_sync
        {
          priority = 1.000000;
          to="sync_the_time";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/"_lastUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
        /*%FSM<LINK "true">*/
        class true
        {
          priority = 0.000000;
          to="general_cleanup";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
 
      "    PVDZE_plr_SetDate = _date;" \n
      "    publicVariable ""PVDZE_plr_SetDate"";" \n
      "    diag_log (""TIME SYNC: Local Time set to "" + str(_date));    " \n
      "};" \n
      ""/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "true">*/
        class true
        {
          priority = 0.000000;
          to="general_cleanup";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
      };
    };
    /*%FSM</STATE>*/
    /*%FSM<STATE "general_cleanup">*/
    class general_cleanup
    {
      name = "general_cleanup";
      init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Starting loop for next task"";"/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "true">*/
        class true
        {
          priority = 0.000000;
          to="waiting";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  ...
      "_safety = PVDZE_serverObjectMonitor;" \n
      "//_dateNow = (DateToNumber date);" \n
      "" \n
      "_lastUpdate = diag_tickTime;" \n
      "_lastNeedUpdate = diag_tickTime;" \n
      "_lastCleanupVehicles = diag_tickTime;" \n
      "_lastCleanupGroups = diag_tickTime;" \n
     ...
          priority = 0.000000;
          to="waiting";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  ...
    /*%FSM<STATE "update_objects">*/
    class update_objects
    {
      name = "update_objects";
      init = /*%FSM<STATEINIT""">*/"//diag_log format[""DEBUG: needUpdate_objects=%1"",needUpdate_objects];" \n
      "{" \n
      "    needUpdate_objects = needUpdate_objects - [_x];" \n
      "    [_x,""all""] call server_updateObject;" \n
      "" \n
      "} forEach needUpdate_objects;"/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "true">*/
        class true
        {
          priority = 0.000000;
          to="general_cleanup";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
      };
    };
    /*%FSM</STATE>*/
    /*%FSM<STATE "group_cleanup">*/
    class group_cleanup
    {
      name = "group_cleanup";
      init = /*%FSM<STATEINIT""">*/"//Clean groups" \n
      "{" \n
      "    // diag_log (""CLEANUP: CHECKING GROUP WITH "" + str(count units _x) + "" UNITS"");" \n
      "    if (count units _x==0) then {" \n
      "        deleteGroup _x;" \n
      "        // diag_log (""CLEANUP: DELETING A GROUP"");" \n
      "    };" \n
      "} forEach allGroups;" \n
      ""/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "true">*/
        class true
        {
          priority = 0.000000;
          to="general_cleanup";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
      };
    };
    /*%FSM</STATE>*/
    /*%FSM<STATE "vehicle_cleanup">*/
    class vehicle_cleanup
    {
      name = "vehicle_cleanup";
      init = /*%FSM<STATEINIT""">*/"_safety = PVDZE_serverObjectMonitor;" \n
      "" \n
      "//Check for hackers" \n
      " {" \n
      "    if(vehicle _x != _x && (vehicle _x getVariable [""Mission"",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) != ""ParachuteWest"") then {" \n
      "        diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
      "        (vehicle _x) setDamage 1;" \n
      "        _x setDamage 1;" \n
      "    };" \n
      " } forEach allUnits;" \n
      "" \n
      "PVDZE_serverObjectMonitor = _safety;"/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "true">*/
        class true
        {
          priority = 0.000000;
          to="general_cleanup";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
 
Code:
 "    if(vehicle _x != _x && (vehicle _x getVariable [""Mission"",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) != ""ParachuteWest"") then {" \n
      "        diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
      "        (vehicle _x) setDamage 1;" \n
      "        _x setDamage 1;" \n
      "    };" \n
      " } forEach allUnits;" \n

you can try and comment out this part, but i dont think it will do any diffrence tho ... i belive theres some other cleanup script i dont know about, that deletes "ReammoBox"
 
So is it everytime or only some of the time that they dissapear?

If it is everytime, it is an issue with them not being excluded from server_updateObject.sqf
 
I guess i cannot change this libne by comment it Halvhjearne. Because it's used for the DayZAI or and Mission...

It's happens everytime.

My ammoboxes is into a ammoboxes.sqf and the Ex is placed rightly on te init.

I added for each of ammoboxes i added a line:
_this setVariable ["permaLoot",true,true];

For exemple one of the box is:

Code:
_vehicle_0 = objNull;
if (true) then
{
  _this = createVehicle ["CZBasicWeapons_EP1", [4885.8237, 10176.058, -0.00021362305], [], 0, "CAN_COLLIDE"];
  _vehicle_0 = _this;
  _this setPos [4885.8237, 10176.058, -0.00021362305];
  _this setVariable ["permaLoot",true,true];
};

Each of those box get this more line.
It' seem box, since this update, still disapear
 
it should not matter, since its just an exceptions for them not to be deletet ... however, you can try setting the variable on each box to misson like this:
Code:
  _this setVariable ["misson",1,true];

... maybe that will work

however i still belive something else is deleting the boxes perhaps in another cleanupscript or something? ... idk
 
In server_functions.sqf you need to find the area near server_cleanLoot =
The block of code looks like:
Code:
  if (_noPlayerNear) then
                        {
                                _nearObj = nearestObjects [_objectPos,["ReammoBox","WeaponHolder","WeaponHolderBase"],((sizeOf (typeOf _x)) + 5)];
                                {
                                        deleteVehicle _x;
                                        _deletedLoot = _deletedLoot + 1;
                                } forEach _nearObj;
                                _x setVariable ["looted",-0.1,true];
                        };

You need to make it look like:
Code:
  if (_noPlayerNear) then
                        {
                                _nearObj = nearestObjects [_objectPos,["ReammoBox","WeaponHolder","WeaponHolderBase"],((sizeOf (typeOf _x)) + 5)];
                                {
                                    if (vehicle _x getVariable ["AwesomeBoxes",0] != 1) then {
                                        deleteVehicle _x;
                                        _deletedLoot = _deletedLoot + 1;
                                    };
                                } forEach _nearObj;
                                _x setVariable ["looted",-0.1,true];
                        };

And change your box setVariable to match.
 
Code:
_vehicle_0 = objNull;
if (true) then
{
  _this = createVehicle ["CZBasicWeapons_EP1", [4885.8237, 10176.058, -0.00021362305], [], 0, "CAN_COLLIDE"];
  _vehicle_0 = _this;
  _this setPos [4885.8237, 10176.058, -0.00021362305];
  --->  _this setVariable ["AwesomeBoxes",true,true];
};

Where the arrow is has to match the variable here:
Code:
  if (_noPlayerNear) then
                        {
                                _nearObj = nearestObjects [_objectPos,["ReammoBox","WeaponHolder","WeaponHolderBase"],((sizeOf (typeOf _x)) + 5)];
                                {
                            ---> if (vehicle _x getVariable ["AwesomeBoxes",0] != 1) then {
                                        deleteVehicle _x;
                                        _deletedLoot = _deletedLoot + 1;
                                    };
                                } forEach _nearObj;
                                _x setVariable ["looted",-0.1,true];
                        };

You can use the variable of your choice, they just need to match.
 
Since the move on Epoch 1.0.3 the code as changed .

The code in the server_functions.sqf look like this now:

Code:
server_spawnCleanLoot = {
    private ["_created","_delQty","_nearby","_age","_keep","_qty","_missionObjs","_dateNow"];
    _missionObjs =  allMissionObjects "ReammoBox";
    _delQty = 0;
    _dateNow = (DateToNumber date);
    {
        _keep = _x getVariable ["permaLoot",false];
        if (!_keep) then {
            _created = _x getVariable ["created",-0.1];
            if (_created == -0.1) then {
                _x setVariable ["created",_dateNow,false];
                _created = _dateNow;
            } else {
                _age = (_dateNow - _created) * 525948;
                if (_age > 20) then {
                    _nearby = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase","AllVehicles"], 130]);
                    if (_nearby==0) then {
                        deleteVehicle _x;
                        sleep 0.025;
                        _delQty = _delQty + 1;
                    };

At least i suppose this is this one to change..

What i have to change on it to get the ammobox not despawning again?

PS: it seems the mission ammobox despawning too now after some minits...
 
Change this part here:
Code:
            } else {
                _age = (_dateNow - _created) * 525948;
                if (_age > 20) then {
                    _nearby = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase","AllVehicles"], 130]);
                    if (_nearby==0) then {
                        deleteVehicle _x;
                        sleep 0.025;
                        _delQty = _delQty + 1;
                    };
                };

to

Code:
            } else {
                _age = (_dateNow - _created) * 525948;
                if (_age > 20) then {
                    _nearby = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase","AllVehicles"], 130]);
                    if (_nearby==0) then {
                        if ( (vehicle _x getVariable ["AwesomeBoxes",0] != 1) and (vehicle _x getVariable ["Mission",0] != 1) and (vehicle _x getVariable ["Sarge",0] != 1) ) then {
                            deleteVehicle _x;
                            sleep 0.025;
                            _delQty = _delQty + 1;
                        };
                    };
                };
            };

If you have different variables it should be obvious enough how to use them.
 
Back
Top