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;
That is the code used by original DayZ for spawning loot at crash sites. Look at Line 92 and you'll find this;
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;
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;
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;
"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;
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!
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!