So this is someone elses code, modded slightly to do what we want.
If you are running the clean up rockets rubbish script to remove all the wrecks, then you can take full advantage of this script, that will create vehicle wrecks on your map that have random loot tables.
So lets start putting it in.
SERVER.PBO ONLY
You will be making changes to init\Server_Functions.sqf and system\Server_Monitor.sqf
Step 1 - Server_Functions.sqf
Find the section that does your compile preprocessFileLineNumbers
and add the following line
server_spawnMedicCarePackages = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnMedicCarePackages.sqf";
For example look at my code below
Step 2 - Server_monitor.sqf
Ok so next thing to do is find your Server_monitor.sqf, scroll right to the bottom and look for your helicopter crash site code shown below
Just above this piece of coding add the green bit of coding below
diag_log (format["CAREPKG Red : ABOUT TO SPAWN"]);
for "_x" from 1 to 6 do {
_id = [] spawn server_spawnMedicCarePackages;
}; //Spawn care packages
Step 3 - Adding the actual code to a new file
Create a file called server_spawnMedicCarePackages.sqf and add the following code below to it.
It will be saved in your compiles folder
So above what we have is the humvee wreck being spawned in this can be changed by actually editing the name of the wreck, Ive gone with the ones that are normally found on the road, but they can be any vehicle that is normally on the server. However unless they are in the 3D editor as unburned wrecks, then they will spawn in black and charred.
The second section of the loot table is changable. Feel free to add to it or change it any way you want
Ive run out of space here so ill add another post on how to edit the loot tables further down
If you are running the clean up rockets rubbish script to remove all the wrecks, then you can take full advantage of this script, that will create vehicle wrecks on your map that have random loot tables.
So lets start putting it in.
SERVER.PBO ONLY
You will be making changes to init\Server_Functions.sqf and system\Server_Monitor.sqf
Step 1 - Server_Functions.sqf
Find the section that does your compile preprocessFileLineNumbers
and add the following line
server_spawnMedicCarePackages = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnMedicCarePackages.sqf";
For example look at my code below
Code:
server_deleteObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_deleteObj.sqf";
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_spawnMedicCarePackages = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnMedicCarePackages.sqf";
Step 2 - Server_monitor.sqf
Ok so next thing to do is find your Server_monitor.sqf, scroll right to the bottom and look for your helicopter crash site code shown below
Code:
allowConnection = true;
// [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire, _prewaypoints, _damage]
nul = [3, 4, 400, 0, 0.99, 'center', 4000, true, false, false, 1, 0.0001] spawn server_spawnCrashSite;
Just above this piece of coding add the green bit of coding below
diag_log (format["CAREPKG Red : ABOUT TO SPAWN"]);
for "_x" from 1 to 6 do {
_id = [] spawn server_spawnMedicCarePackages;
}; //Spawn care packages
Code:
diag_log (format["CAREPKG Red : ABOUT TO SPAWN"]);
for "_x" from 1 to 6 do {
_id = [] spawn server_spawnMedicCarePackages;
}; //Spawn care packages
if (isDedicated) then {
_id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
};
allowConnection = true;
// [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire, _prewaypoints, _damage]
nul = [3, 4, 400, 0, 0.99, 'center', 4000, true, false, false, 1, 0.0001] spawn server_spawnCrashSite;
Step 3 - Adding the actual code to a new file
Create a file called server_spawnMedicCarePackages.sqf and add the following code below to it.
It will be saved in your compiles folder
Code:
private["_position","_veh","_num","_config","_itemType","_itemChance","_weights","_index","_iArray"];
if (isDedicated) then {
diag_log(format["CAREPACKAGE RED: IN FILE"]);
_position = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
_randomvehicle = ["HMMWVWreck","HMMWVWreck","HMMWVWreck"] call BIS_fnc_selectRandom;
_vehicleloottype = ["Hospital"] call BIS_fnc_selectRandom;
_veh = createVehicle [_randomvehicle,_position, [], 0, "CAN_COLLIDE"];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_veh];
_veh setVariable ["ObjectID",1,true];
if (_randomvehicle == "HMMWVWreck") then { _num = round(random 3) + 3; };
if (_randomvehicle == "HMMWVWreck") then { _num = round(random 6) + 4; };
if (_randomvehicle == "HMMWVWreck") then { _num = round(random 12) + 5; };
diag_log(format["CAREPACKAGE: rv: '%1', pos: '%2',vlt :'%3'", str(_randomvehicle), str(_position), str(_vehicleloottype)]);
switch (_vehicleloottype) do {
case "Hospital": {
_itemType = [["MedBox0", "object"], ["MedBox0", "object"], ["FoodBox0", "object"], ["FoodBox0", "object"], ["DZ_British_ACU", "object"], ["DZ_Backpack_EP1", "object"], ["DZ_TK_Assault_Pack_EP1", "object"], ["DZ_ALICE_Pack_EP1", "object"], ["", "medical"], ["", "generic"], ["", "hospital"]];
};
};
diag_log(format["CAREPACKAGE RED Medic: Spawning a " + str (_randomvehicle) + " at " + str(_position) + " with loot type " + str(_vehicleloottype) + " With total loot drops = " + str(_num)]);
itemTypeCount = (count _itemType) - 1;
for "_x" from 1 to _num do {
_index = random itemTypeCount;
sleep 1;
if (count _itemType > _index) then {
_iArray = _itemType select _index;
_iArray set [2,_position];
_iArray set [3,10];
_iArray call spawn_loot;
_nearby = _position nearObjects ["WeaponHolder",20];
{
_x setVariable ["permaLoot",true];
} forEach _nearBy;
};
};
};
So above what we have is the humvee wreck being spawned in this can be changed by actually editing the name of the wreck, Ive gone with the ones that are normally found on the road, but they can be any vehicle that is normally on the server. However unless they are in the 3D editor as unburned wrecks, then they will spawn in black and charred.
The second section of the loot table is changable. Feel free to add to it or change it any way you want
Ive run out of space here so ill add another post on how to edit the loot tables further down