Deployable Ammo Crates and 1.7.7

Yea in my last post in playersyc and update object need to add _EP1 to it.

And add them in deployable and spawn them that way.
 
Are you using deployable in data base not doing in sqm also are all ur compiles and veriables changed to custom not the default @dayz code ones?
 
I am trying both.
I couldn't get them to spawn at all via deployable at all.

I can get them to spawn via adding them into mission.sqm, but they get deleted right away.
 
Add the classname to the table "deployable" and note the id number

So you do not delete the box with cleanup script. Make a new Survivor in the survivor table with a randon ass UID and set isdead to 0. (this will make it so if it is not used within X days it won't be cleaned up) This will vary server to server.
Note the ID of the survivor you created.

Now go to your instance_deployable table and insert a new entry. Leave id blank and make up some crazy UID for the UID field. Under owner ID put the ID (Not UID) of your created survivor. Worldspace explanatory. You can create an inventory or leave it blank. All other values are not needed. Create the entry.

Restart your server and it should spawn in like anything else.

I am not responsible for your crap not working or breaking your database. I have only tested this for a day on my server.

AGAIN BE CAREFUL WITH HOW MANY DIFFERENT ITEMS YOU PUT IN IT!!!!!
It will save to the db fine but when you restart the server it will error out on the overfilled box.

Are you using this method?
 
I tried the method you just outlined and I restarted the server. The box was there with stuff in it. I restarted the server, puting another similar box in another location, and now neither box are where they should be.
 
Just spawn USBasicAmmunitionBox_EP1 same way as vehicles, that worked for me.


Can you detail exactly how you got it to work for those that might not be 100% familiar with this method? That would be a huge help, thanks.
 
I thought I had it, but then I missed adding the classnames into the safeObjects, triple checked, ready to upload, but now server is filling up... will have to get back with results later. It certainly looks like it has potential!


Any luck on this?
 
First add USBasicAmmunitionBox_EP1 to server_player_Sync, server_updateNearbyObjects, server_functions and in variables and edit server_cleanup just like posted earlier.

If you have any map tool you can just add custom spawn point and name it USBasicAmmunitionBox_EP1.

Or add it to database tables:
vehicle = Create new vehicle USBasicAmmunitionBox_EP1 and make inventory for it.
world_vehicle = Create spawnpoint for it.
instance_vehicle = Spawn it in game.
 
Looking at this code below from server_cleanup.fsm, isn't it already commented out?

the /* generally denotes that all follow code is commented out until you get to the */

Code:
"/*" \n
      "//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
 
Using crates with 1.7.7.1

Alright, working crates that respawn on reboots, and that allow you to save content, regardless of reboots. This is a copy/paste job of tid bits of work done by people in this forum, and on other forums. I personally made no code changes, I am just a noob, but I have compiled it all here for you other noobs like me to follow, and I thank everyone for their help!!!!


Okay I'll throw this out there without any extra stuff we have been working on. Here is the basics of spawning in a ammo box that updates to the database. If you put more than 80-90 different items in it will error out and not spawn. eg. 100 m4a1 and 100 stanag mags would only count as 2 items. All of this is done in the dayz_server.pbo.

Go to your compile folder and in the script server_playerSync and server_updateNearbyObjects add the classname of the object that you want to update after tentstorage.
Eg for classname "USBasicAmmunitionBox"
} forEach nearestObjects [_pos, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage","USBasicAmmunitionBox"], 10];

Add the classname to the table "deployable" and note the id number

So you do not delete the box with cleanup script. Make a new Survivor in the survivor table with a randon ass UID and set isdead to 0. (this will make it so if it is not used within X days it won't be cleaned up) This will vary server to server.
Note the ID of the survivor you created.

Now go to your instance_deployable table and insert a new entry. Leave id blank and make up some crazy UID for the UID field. Under owner ID put the ID (Not UID) of your created survivor. Worldspace explanatory. You can create an inventory or leave it blank. All other values are not needed. Create the entry.

Restart your server and it should spawn in like anything else.

I am not responsible for your crap not working or breaking your database. I have only tested this for a day on my server.

AGAIN BE CAREFUL WITH HOW MANY DIFFERENT ITEMS YOU PUT IN IT!!!!!
It will save to the db fine but when you restart the server it will error out on the overfilled box.


Now that you have that part done, here is part II for the 1.7.7.1 patch, credit goes to those in this forum that made the actual adjustments:

In your dayz_server.pbo go to the system folder and edit server_cleanup.fsm, find this code

Code:
server_cleanup.fsm
"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

and uncomment like so:


Code:
server_cleanup.fsm
"//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

Then do as ebay says above my post:

I found in variables.sqf you can edit this line to include any ammo crates you want to add as safe objects:
Code:
SafeObjects = ["Land_Fire_DZ", "TentStorage", "Wire_cat1", "Sandbag1_DZ", "Hedgehog_DZ", "StashSmall", "StashMedium"];
If you add them to that list it will prevent the server_monitor.sqf from deleting them here:
Code:
else { // else for object or non legit vehicle
if (!(_class in SafeObjects )) then {
_damage = 1;
};
This requires a custom variables.sqf. If you don't already have one you can add it to your mission by editing your init.sqf like this:
Code:
call compile preprocessFileLineNumbers "variables.sqf";
Copy variables.sqf from ArmA 2\@Dayz\Addons\dayz_code\init to the root of your mission pbo then make your changes.

I did all the above, and it works like a charm! Thanks to you all!
 
Using crates with 1.7.7.1

Alright, working crates that respawn on reboots, and that allow you to save content, regardless of reboots. This is a copy/paste job of tid bits of work done by people in this forum, and on other forums. I personally made no code changes, I am just a noob, but I have compiled it all here for you other noobs like me to follow, and I thank everyone for their help!!!!





Now that you have that part done, here is part II for the 1.7.7.1 patch, credit goes to those in this forum that made the actual adjustments:

In your dayz_server.pbo go to the system folder and edit server_cleanup.fsm, find this code

Code:
server_cleanup.fsm
"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

and uncomment like so:


Code:
server_cleanup.fsm
"//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

Then do as ebay says above my post:



I did all the above, and it works like a charm! Thanks to you all!

What a nightmare. Is it possible to just add classnames back to the deployable tables or are all the ammo boxes omitted from the server pbo and the reason they fail to spawn?
 
You have to add them to the deployable anyway. Since the update, it appears that the crates get removed in two ways:

First they are not in the safeObjects
Secondly the cleanup fsm file removes them

You will need to add to safeObjects, and stop the cleanup from cleaning them up. The rest remains the same as in version 1761.

The only issue I am having now, is they don't always spawn, sometimes they do, sometimes they don't. Content and location remain the same, not sure why they don't always spawn.
 
You have to add them to the deployable anyway. Since the update, it appears that the crates get removed in two ways:

First they are not in the safeObjects
Secondly the cleanup fsm file removes them

You will need to add to safeObjects, and stop the cleanup from cleaning them up. The rest remains the same as in version 1761.

The only issue I am having now, is they don't always spawn, sometimes they do, sometimes they don't. Content and location remain the same, not sure why they don't always spawn.


Sometimes, and I repeat, sometimes, a reboot will fix them. Seems hit and miss. Can't figure out why.
 
Sweet, ya I had a feeling something else was removing them. Will edit and upload tonight. I figure even without cleaning up whatever this cleans up, 6hr reboots should keep it running.

Update: So far working fine, crates are all there, will report back once I have it running a few days.
 
Hey guys, after doing all of the above my crates were still getting deleted and some weren't spawning at all.

So I looked back in server_cleanup.fsm and sure enough there is another routine that is deleting them. I am not sure what other effects commenting this out will have on your server so use at your own risk:

This needs to be commented out too like so:
Code:
name = "cleanup_objects";
      init = /*%FSM<STATEINIT""">*/"//_missionObjs = allMissionObjects ""WeaponHolder"" + allMissionObjects ""WeaponHolderBase"" ;" \n
      "//_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
      "    //_nearby = {isPlayer _x} count (_x nearEntities [[""CAManBase""], 250]);" \n
      "//" \n
      "    //_created = (_x getVariable [""created"",-0.1]);" \n
      "//" \n
      "    //if (_created == -0.1) then {" \n
      "        //_x setVariable [""created"",(DateToNumber date)];" \n
      "    //};" \n
      "" //\n
      "    //_age = ((DateToNumber date) - _created) * 525948;" \n
      "//" \n
      "//diag_log format [""Pile : %1, Created: %2, Age: %3"", _x,  _created, _age];" \n
      "//" \n
      "    //if ( (!_keep) && (_nearby==0) && (_age > 60) ) 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



You don't have to comment out that entire block.
Just comment out the lines that actually delete stuff. All I think you really would have to do it is this line in there:

"deleteVehicle _x;" \n

Personally I'm going to do it this way, commenting out the first line, and changing the 2nd.

"deleteVehicle _x;" \n
"_delQty = 0;" \n
and then
"diag_log (""CLEANUP: DELETED "" + str(_delQty) + "" LOOT BAGS"");" \n

because you don't want stuff deleted by that 1st line, and lines 2 & 3 reference each other, so just setting _delQty = 0 will force no report file comments.
The other stuff is harmless just looking up stuff and deciding whether to delete certain objects.
 
Back
Top