Editing Crash Site Loot and Creating More Spawns

Dealman

New Member
Important Information
Note: You can also go to DayZ-Private-master/DayZ-Private-master/util/ and run cpbo.exe. When you execute this file it will ask you if you want to associate .pbo files with this program, select yes. Now you can right-click any .pbo associated file and click "Extract PBO". You can also right-click on a folder and use "Create PBO". I will be using this method, you can however, use PBO Manager if you would so desire!

For unpacking and packing PBO Files you'll need PBO Manager. You will also need a Text-editor such as Notepad++ in order to edit the .sqf files. Before you change any file mentioned in this Tutorial, make sure that you create backups!

What Will This Do?
DayZ_Server.pbo will be the file you're gonna edit in order to change the Heli Crashes. This file is automatically downloaded everytime you join the server - therefore it is server-side and no external downloading is required by your clients.

Editing the Loot
First you're gonna need to get your DayZ_Server.pbo. To find this, go to the folder where your server is located. Navigate your way to @bliss_#.tavi/addons/. In this folder you'll find the file you need to edit, create a folder at your desktop and name it something you'll remember, copy and paste dayz_server.pbo to the newly created folder, for example:
Desktop/PBO Editing/Taviana/dayz_server.pbo

Choose to extract this PBO and select to extract all of the contents(Hold down your left-mouse button and drag from the top and down to select everything!). This will create a new folder called dayz_server. This folder has 2 sub-folders; Compile, Init, System and Tavi.

You'll want to go into Init, here you will find a file called server_functions.sqf. Open this with your text-editor of choice, I use Notepad++(If you want syntax highlighting, go to Language and then select C++). Scroll down to Line 77 and you will find this;

Code:
spawn_heliCrash = {
private["_position","_veh","_num","_config","_itemType","_itemChance","_weights","_index","_iArray"];
 
waitUntil{!isNil "BIS_fnc_selectRandom"};
if (isDedicated) then {
_position = [getMarkerPos "center",0,10000,10,0,2000,0] call BIS_fnc_findSafePos;
diag_log("DEBUG: Spawning a crashed helicopter at " + str(_position));
_veh = createVehicle ["UH1Wreck_DZ",_position, [], 0, "CAN_COLLIDE"];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_veh];
_veh setVariable ["ObjectID",1,true];
dayzFire = [_veh,2,time,false,false];
publicVariable "dayzFire";
if (isServer) then {
nul=dayzFire spawn BIS_Effects_Burn;
};
_num = round(random 4) + 3;
_config = configFile >> "CfgBuildingLoot" >> "HeliCrash";
_itemType = [] + getArray (_config >> "itemType");
//diag_log ("DW_DEBUG: _itemType: " + str(_itemType));
_itemChance = [] + getArray (_config >> "itemChance");
//diag_log ("DW_DEBUG: _itemChance: " + str(_itemChance));
//diag_log ("DW_DEBUG: (isnil fnc_buildWeightedArray): " + str(isnil "fnc_buildWeightedArray"));
 
waituntil {!isnil "fnc_buildWeightedArray"};
 
_weights = [];
_weights = [_itemType,_itemChance] call fnc_buildWeightedArray;
//diag_log ("DW_DEBUG: _weights: " + str(_weights));
for "_x" from 1 to _num do {
//create loot
_index = _weights call BIS_fnc_selectRandom;
sleep 1;
if (count _itemType > _index) then {
//diag_log ("DW_DEBUG: " + str(count (_itemType)) + " select " + str(_index));
_iArray = _itemType select _index;
_iArray set [2,_position];
_iArray set [3,5];
_iArray call spawn_loot;
_nearby = _position nearObjects ["WeaponHolder",20];
{
_x setVariable ["permaLoot",true];
} forEach _nearBy;
};
};
};
};

That is the code used by original DayZ for spawning loot at crash sites. Look at Line 92 and you'll find this;

Code:
    _num = round(random 4) + 3;

This is where you change the amount of loot spawned at the Crash Site. 4+3 means that up to 7 piles of loot may spawn. You can change this as you please. Keep in mind that loot tends to spawn inside of the actual crash site.

At Line 94 you'll find this;

Code:
  _ItemType = [] + GetArray (_config >> "itemType");

This is the actual loot that can be generated at the crash sites. Currently, this is set to auto and because of this it will use the normal loot generated by the developers of the map.

At Line 96 you'll see this;

Code:
  _itemChance = [] + GetArray (_config >> "itemChance");

This is the chance for loot to spawn at the crash site. This can be changed as you please. Here's an example of added items and their corresponding spawn chance;

Code:
_ItemType = [["G36K_Camo", "weapon"], ["M4A1_Aim", "weapon"], [" ","military"], [" ","medical"], ["MedBox0","object"]];
_itemChance = [0.05, 0.05, 1, 0.5, 0.1];

"weapon" tells the game that the added item is a weapon, this will prevent the game from spawning multiple of the entered item as if they were trash or ammo. I'm not entirely sure as to what the empty parameters are doing, but I assume they are there to load any items classified as military and medical to the loot table. "object" is of course used to tell the game is a object and as such can hold gear. You can also use "magazine" if the item you entered is ammo.

Note: In the example used, rMod is in use. This mod makes it possible to spawn normally banned weapons and vehicles in DayZ. For example SCAR Rifles and tanks.

Remember:
_ItemType = The actual item type. It works like this: "ClassName", "Type". For example "G36K_Camo", "weapon". Use this to add the actual loot itself.

_itemChance = The spawn-rate of the corresponding item. In this example, the G36K is the first item in the loot table and therefore the first chance entered will correspond the G36K - an easier example;

_ItemType = [["G36K_Camo", "weapon"], ["M4A1_Aim", "weapon"]];
_itemChance = [0.05, 0.05];

The finished edited file will look something like this;
Code:
 spawn_heliCrash = {
 
 
WaitUntil {IsNil "BIS_fnc_selectRandom"!}
if (isDedicated) then {
_position = [getMarkerPos "center", 0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
diag_log ("DEBUG: Spawning a helicopter crashed at" + str (_position));
_veh createVehicle = ["UH1Wreck_DZ" _position, [], 0, "CAN_COLLIDE"];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor, _veh];
_veh setVariable ["ObjectID", 1, true];
dayzFire = [_veh, 2, time, false, false];
public variable "dayzFire";
if (IsServer) then {
nul = dayzFire spawn BIS_Effects_Burn;
};
_num = round (random 4) + 3;
_config = configFile >> "CfgBuildingLoot" >> "HeliCrash";
_ItemType = [["G36K_Camo", "weapon"], ["M4A1_Aim", "weapon"], ["FN_FAL", "weapon"], ["bizon_silenced", "weapon"], ["M14_EP1" weapon, " "], [" FN_FAL_ANPVS4 "," weapon "], [" BAF_L85A2_RIS_SUSAT "," weapon "], [" M40A3 "," weapon "], [" Mk_48_DZ "," weapon "], [" M249_DZ weapon "," "], [" SVD_CAMO "," weapon "], [" DMR "," weapon "], [" "," military "], [" "," medical "], [" MedBox0 "," object "] , ["NVGoggles", "weapon"], ["AmmoBoxSmall_556", "object"], ["AmmoBoxSmall_762", "object"], ["Skin_Camo1_DZ", "magazine"], ["Skin_Sniper1_DZ", "magazine"] , ["DZ_Backpack_EP1", "object"]];
/ / Diag_log ("DW_DEBUG: _ItemType:" + str (_ItemType));
_itemChance = [0.05, 0.05, 0.02, 0.05, 0.05, 0.02, 0.01, 0.02, 0.03, 0.05, 0.01, 0.1, 1, 0.5, 0.1, 0.01, 0.1, 0.1, 0.03, 0.03, 0.3, 0.03];
/ / Diag_log ("DW_DEBUG: _itemChance:" + str (_itemChance));
/ / Diag_log ("DW_DEBUG: (IsNil fnc_buildWeightedArray):" + str (IsNil "fnc_buildWeightedArray"));
 
waituntil {IsNil "fnc_buildWeightedArray"!}
 
_weights = [];
_weights = [_ItemType, _itemChance] call fnc_buildWeightedArray;
/ / Diag_log ("DW_DEBUG: _weights:" + str (_weights));
for "_x" from 1 to _num do {
/ / Create loot
_index = _weights call BIS_fnc_selectRandom;
sleep 1;
if (count _ItemType> _index) then {
/ / Diag_log ("DW_DEBUG:" + str (count (_ItemType)) + "select" + str (_index));
_iArray = _ItemType select _index;
_iArray set [2, _position];
_iArray set [3,5];
_iArray call spawn_loot;
_nearby = _position near objects ["Weapon Holder", 20];
{
_x setVariable ["permaLoot", true];
ForEach} _nearBy;
};
};
};
};

Note that only one "block of code" is actually edited. If anything else is edited, the server might and will complain. To summarize things, what can actually be changed?

_num = round = The amount of lootpiles. Am not entirely sure on this, please, correct me if I'm wrong!
_ItemType = The loot that can be generated at crash sites.
_itemChance = The chance of an item to be generated. The higher the number, the more likely it is to generate.

Saving and Converting
Now that you've edited the loot table to your liking, go ahead and save the file. After you've saved the file, copy and paste the edited file into your dayz_server/Init folder, when prompted to overrite, select yes. Now right-click on the dayz_server folder and select "Create PBO". A new PBO will be created containing your new server_functions.sqf file.

Now put this new PBO file in your Server/@bliss_#.tavi/addons/ folder and overwrite the previous one. You're now done editing the loot table itself, congratulations!

Credits go to xmoondockx for creating the original tutorial! Since this website doesn't allow users newer than 10 days to post links, I could not include links to the required tools. Blame the forum admins for this stupid decision and not me!
 
Creating and Editing Crash Site Spawns

The Administrator of a server also has the ability to specify the occurance of crash sites. This can be set to anywhere from 1 to a whole 100 crash sites! To do this, you'll need to extract your dayz_server.pbo file again. By now, you should be able to do this procedure on your own.

This time, however, you'll want to go into the System folder and edit server_monitor.sqf. Open this file with a text-editor of your choice and look at Line 206. You'll find this;

Code:
 / / Spawn crashed helos
for "_x" from 1 to 5 do {
_id = [] spawn spawn_heliCrash;
/ / Script done WaitUntil {_id};
};

What you want to look at here are the numbers 1 and 5. The first number is the minimum amount of crash sites that will be generated on a server restart.

The other number, 5, is the maximum amount of crash sites generated on a server restart. Keep in mind that if you set this to a minimum of 1 and maximum of 100 crash sites, any number between 1 and 100 will generate, for example it could generate 23 crash sites and 78 crash sites on another restart.

Edit this to your liking and save it. Now repeat the process of converting the folder into a PBO file and overwrite your old PBO file located in Server/@bliss_#.tavi/addons/ and you're done!

Yet again, I take no credit to this other than the translation itself. All of the above was done by no other than the almighty xmoondockx. I tried to explain some things as detailed as my knowledge allowed me to, I'm not a programmer so do correct me if I explained some things wrong and I'll edit it.

I had to make 2 posts due to the 10 000 character limit. Forum Admin, you might want to look into this, my reply consisted of 9 641 character originally but I couldn't post it because it claimed it was still above 10 000 characters. I would assume this isn't working as intended, just thought I'd mention! :)

Edit: You have my permission to post this elsewhere or link to this thread as you please in one condition, you must give credit to xmoondockx for his amazing work.

Edit 2: Due to a bug with extracting PBOs, server_monitor.sqf might not extract properly, if this happens try to select "Extract" instead of "Extract PBO".
 
I'm pretty sure you have an error in the code you supplied for the _item_type variable in your finished example. You currently have:
Code:
_ItemType = [["G36K_Camo", "weapon"], ["M4A1_Aim", "weapon"], ["FN_FAL", "weapon"], ["bizon_silenced", "weapon"], ["M14_EP1" weapon, " "], [" FN_FAL_ANPVS4 "," weapon "], [" BAF_L85A2_RIS_SUSAT "," weapon "], [" M40A3 "," weapon "], [" Mk_48_DZ "," weapon "], [" M249_DZ weapon "," "], [" SVD_CAMO "," weapon "], [" DMR "," weapon "], [" "," military "], [" "," medical "], [" MedBox0 "," object "] , ["NVGoggles", "weapon"], ["AmmoBoxSmall_556", "object"], ["AmmoBoxSmall_762", "object"], ["Skin_Camo1_DZ", "magazine"], ["Skin_Sniper1_DZ", "magazine"] , ["DZ_Backpack_EP1", "object"]];
Whereas I think it should be:

Code:
_ItemType = [["G36K_Camo", "weapon"], ["M4A1_Aim", "weapon"], ["FN_FAL", "weapon"], ["bizon_silenced", "weapon"], ["M14_EP1", " weapon "], [" FN_FAL_ANPVS4 "," weapon "], [" BAF_L85A2_RIS_SUSAT "," weapon "], [" M40A3 "," weapon "], [" Mk_48_DZ "," weapon "], [" M249_DZ weapon "," "], [" SVD_CAMO "," weapon "], [" DMR "," weapon "], [" "," military "], [" "," medical "], [" MedBox0 "," object "] , ["NVGoggles", "weapon"], ["AmmoBoxSmall_556", "object"], ["AmmoBoxSmall_762", "object"], ["Skin_Camo1_DZ", "magazine"], ["Skin_Sniper1_DZ", "magazine"] , ["DZ_Backpack_EP1", "object"]];

I'm going to try this out soon and I'll report back. Thanks for the tutorial. :)
 
I appreciate this tut Dealman, and I appreciate the time you put into this as well Moondock.

Sadly, after trying to get this to work all night, it still does not. I am running a Namalsk 0.73 server and would love to get rid of these dang on PKPs!

I am also using DayZ.ST, so I have no FTP or access to the main files that contain the 'Array' of weapons the Heli Crashes pull guns from. So, I was hoping this method would work. I just ended up with no spawns at all, and on a few occasions the server wouldn't load.

I would greatly appreciate any advise and or help with this! Again, thanks for the tut and I look forward to some guidance!

-CRAFT
 
Well tell me your wishes / About modi. the crashsites i can write a server pbo for you.
step 2 write a support mail to day.st and ask for a upload.
 
Well tell me your wishes / About modi. the crashsites i can write a server pbo for you.
step 2 write a support mail to day.st and ask for a upload.

I am currently renting a server from dayz.st and I am looking to add rMod weapons to crash sites.
It would be very much appreciated if someone could help with adding the items, or if someone could post basic code as to how to do this. I am running Chernarus and only have access to mission and server pbo's, I have been told this only allows access to custom heli and care packages.

Thanks
 
Hi there mate, I have been trying to spawn rmod loot at crash sites, i did manage it once with 2 weapons but when i try now i cant do it, wen i log in it just hangs at loading.... for ages.

I was wondering if you would be able to do me a .pbo file that I can upload straight to dayz.st control panel.

I would be really greatful :)
the items i am trying to spawn are

M32_EP1
SCAR_H_STD_TWS_SD
M110_TWS_EP1
UZI_SD_EP1
SCAR_L_STD_EGLM_TWS
AKS_74_GOSHAWK

all with a 20% spawn chance
If you could send it to my email [email protected] I would really appreciate it

Also I have attatched the file that I have tried to do myself but it wont load, just stays on loading....if you have any idea what i'm doing wrong that would be cool too:)



many thanks
robbie
 

Attachments

  • server_functions.zip
    2.3 KB · Views: 13
Maybe he din't explain it good enough for some of the people but basicly what he is saying u will need to replace the 2 lines that he actually posted in the quote.

This is what he posted and this is an example and nothing more, your suppose to replace "_ItemType" and "_itemChance" with what is below.
Code:
_ItemType = [["G36K_Camo", "weapon"], ["M4A1_Aim", "weapon"], [" ","military"], [" ","medical"], ["MedBox0","object"]];
_itemChance = [0.05, 0.05, 1, 0.5, 0.1];

This code above still wont work the code below does.
But note that these are the only things that will spawn now at the crash site, and always make sure u got the right type for whatever your trying to spawn.
Code:
_ItemType = [["G36K_Camo","weapon"],["M4A1_Aim","weapon"],["MedBox0","object"]];
_itemChance = [0.05, 0.05, 0.1];

The _itemChance is what it says the chance rate it will spawn at, as you can see there are as many spawn rates as there are items.
Now the way it works is you either put number between 0 and 1 meaning 0 wont have any chance at all and 1 would have 100% chance, but u can also make it rare like 0.01 meaning it will hardly spawn like it would be the rarest spawn at a heli site.
What i used 0.01 to 0.1 meaning 0.1 was the highest chance and even at 0.1 it already spawn allot so take that as it would be a 100% of spawning, so stay between the numbers 0.01 and 0.1 and everything would act just like any heli site.

I hope i explained this right and i hope it will help your problems.

If you still cannot fix your problems then u really need to give up on this or learn how coding works, you cannot ask others to do it for you.
 
I'm pretty sure I have done everything correctly as you can see in the file I uploaded, I got it to work once. I only asked for someone to do it for me because xmoondocx offered to in the post above :)

Thanks for the info :)
 
o no i changed the numbers and it still doesnt work

I've attached the pbo file if anyone gets a chance to look at it and if they can let me know whats wrong with it, no probs if you cant.

cheers robbie
 

Attachments

  • dayz_server.pbo
    73 KB · Views: 12
that file is corrupted you will need to upload the server_functions by itself or just paste what u did.
 
HI again , sorry to keep bothering y'all, boyd, I started again from scratch and copied and pasted what you put above, and its worked!! I just add what weapons I want and add the spawn chance!
I think what I was doing wrong was putting spaces after the commas in the item type row, anyway its worked.

Many thanks for the tutorial and all the help

robbie
 
hi. I followed the guidance above and edited my server_functions.sqf
But I still stuck on loading screen. Anyone ,please teach me how to fix that.
 

Attachments

  • dayz_server.pbo
    70.9 KB · Views: 9
Thanks for the advise and offer to help Moondock, but at this point I was to murder the guys who run DayZ.ST.

They have given me the run around and keep telling me that all I need edit to accomplish my goal are either the mission or server pbo. Ironic how that's the only files I can access right? Then they tell me to go ask the on the thread for help...

I told them I have, then they tell me to contact the creators of Namalsk for help...

Then they fall back on their crutches and tell me that the editing of the files is not supported and/or recommended.

No wonder why Dayz.ST gets ddosed so bad, the customer support is terrible. I'm going to have to switch my server host to one that offers FTP.

I appreciate your help and advise Boyd and Moondock, but I think I'm going to give up on this for now.

Cheers!

P.S.- If anyone has successfully altered the heli spawns for Namalsk, and hosts through DayZ.ST please give me a shout. Thank you all.
 
Now I found a solution. So I post that.
Open dayz_server.pbo by PBO manager
Edit server_functions.sqf following the guidance above(thx moon and boyd)
re-pack dayz_server folder by PBO manager
*Open the edited dayz_server.pbo by PBO manager
*Open PBO properties
*add "prefix" to Property and "z\addons\dayz_server" to Value. Then, click add and Apply
 
Thanks for the advise and offer to help Moondock, but at this point I was to murder the guys who run DayZ.ST.

They have given me the run around and keep telling me that all I need edit to accomplish my goal are either the mission or server pbo. Ironic how that's the only files I can access right? Then they tell me to go ask the on the thread for help...

I told them I have, then they tell me to contact the creators of Namalsk for help...

Then they fall back on their crutches and tell me that the editing of the files is not supported and/or recommended.

No wonder why Dayz.ST gets ddosed so bad, the customer support is terrible. I'm going to have to switch my server host to one that offers FTP.

I appreciate your help and advise Boyd and Moondock, but I think I'm going to give up on this for now.

Cheers!

P.S.- If anyone has successfully altered the heli spawns for Namalsk, and hosts through DayZ.ST please give me a shout. Thank you all.


I switched from xstreamgaming.net to dayz.st the other week mainly due to the price difference. It took less than an hour of moving over to their server to realise how unstable their servers are. I switched back immediately. Apparently you do get what you pay for.

xstreamgaming.net might be more expensive, but their support is excellent. Sam, who deals with support tickets (not sure if he's the owner) is extremely helpful. They offer full FTP + MySQL access which means you can pretty much mod to your heart's desire. There's no way I'd go back to Dayz.st for hosting.

Edit: Also, more on topic, this method of editing heli crashes worked perfectly for my server. Cheers for the post :)
 
nullpo: Are you running Namlask? And just to recap you basically put the 'dayz_server' inside of the folders you created and repacked it all? Sorry if that question sounds redundant.

Dean: Thanks for the reference, I did give them a look recently b/c of their FTP access. How does the conrtol panel compare to DayZ.ST's?
 
Back
Top