Modifying Heli Crash loot

narsil

New Member
Hi, we are currently attempting to alter the heli crash site loot tables. we have;

1) downloaded our server.pbo file and extracted the PBO with cpbo.exe.
2) edited the server_functions.sqf file to change the heli crash code.
3) repacked as a PBO using (cpbo.exe again).
4) using FTP I have then overwritten the original server.pbo file (while the server was offline) and then restarted the server.
After that I believe it should be functioning, but all I get is people hanging at loading. The code I have out in place is this:


spawn_heliCrash = {
private["_position","_veh","_num","_config","_itemType","_itemChance","_weights","_index","_iArray"];

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 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 6) + 3;
//_itemType = [] + getArray (_config >> "itemType");
//_itemChance = [] + getArray (_config >> "itemChance");
_itemType = [["m107_DZ","weapon"], ["BAF_LRR_scoped","weapon"], ["G36_c_SD_eotech","weapon"], ["BAF_L110A1_Aim","weapon"], ["Saiga12K","weapon"], ["RPK_74","weapon"], ["AK_107_kobra","weapon"], ["FN_FAL","weapon"], ["bizon_silenced","weapon"], ["M14_EP1","weapon"], ["FN_FAL_ANPVS4","weapon"], ["BAF_L85A2_RIS_ACOG","weapon"], ["M40A3","weapon"], ["Mk_48_DZ","weapon"], ["M249","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"]];
_itemChance = [0.02, 0.03, 0.05, 0.04, 0.02, 0.03, 0.04, 0.02, 0.05, 0.04, 0.01, 0.05, 0.04, 0.03, 0.04, 0.02, 0.08, 1, 0.5, 0.07, 0.03, 0.09, 0.1, 0.02, 0.03, 0.05];
//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;
};
};
};
};



I believe this is all correct, and that the weapons I have specified are fine to use. If someone could advise me I would be very grateful.
Is there any bad line of code, or maybe a bad step in packing the .pbo file?

Thanks in advance.
 
Hi mate, I'm going to be attempting this soon aswell. From my understanding, unpacking, editing + repacking the pbo isn't enough. You need to rebuild bliss using build.pl after you've made the changes. If someone else with more knowledge could chime in on this, that'd be great as I'd like to know this for sure before I attempt it.
 
Hey.
Thank you for your answer and a heads up.

Good luck with your endeavors :)

As you see from the code provided above, we are trying to kick AS50 and L85 AWS from spawning at heli crashes, and we included some weapons from ARMA II OA, but when we uploaded the file everyone would get stuck on the loading screen.

If anyone can provide more in-depth we would be extremely gratefull.
 
Hey lads, I've done this on my server. It's simple once you've tampered with it once.

If you just want to get rid of the AS50/L85 use this
http://www.tunngle.net/community/topic/103541-dayz-loot-substitution-or-suppression-in-mpmission/
Can confirm that it works.

Modifying heli loot is much more difficult. Errors tend to happen if you just unpack/repack.

Go and find all the server function and server monitors in your bliss repository. Alter the heli changes there and then run build.pl to not get errors.

I'm %90 of the way through, using a method of someone I can't give credit to (forums are gone so I can find the original poster!!!) My version of heli crashes works but the weighted array is buggy. It tends to drop a lot of the same item, eg NV drops x4 with a weighted %3 drop o_O

Is that loot suppression what your after or did you want the chopper changes too? I can post them when I get home if you want them. Be warned I modified chopper crashes extensivelly on my server.
 
I used this code on my server which I found somewhere else. This is not my work, I am only posting the information from the other forum.

  1. Edit server_functions.sqf
  2. Search for spawn_heliCrash = {
  3. Replace that block of code with the code below
  4. Run build.pl and deploy the mission file and server pbo.
  5. Done!

The server now controls the loot at heli spawns. Clients dont need to change a thing.

In the below script we replace the AS50 with the M40A3 and the L85 CWS with the L85 Holo.
We also mix in some new guns like the AK107, Saiga12k and RPK74

Now to get somekind of overview i created a speadsheet -> https://docs.google.com/spreadsheet/ccc?key=0AqbMm2jk_cqNdHNFc1YwUlpod1JGUDA5MWJUREhkb0E#gid=0
If you want to modify it just download as Excel or whatever.
Modify items and chance and paste it into the code replacing the old values

_itemType = [paste here];
_itemChance = [paste here];

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,4000,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 6) + 3;
        //_itemType =          [] + getArray (_config >> "itemType");
        //_itemChance = [] + getArray (_config >> "itemChance");
        _itemType = [["AK_74","weapon"], ["AK_47_M","weapon"], ["M4A1_Aim","weapon"], ["Saiga12K","weapon"], ["RPK_74","weapon"], ["AK_107_kobra","weapon"], ["FN_FAL","weapon"], ["bizon_silenced","weapon"], ["M14_EP1","weapon"], ["FN_FAL_ANPVS4","weapon"], ["BAF_L85A2_RIS_Holo","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"]];
        _itemChance = [0.07, 0.07, 0.05, 0.02, 0.02, 0.02, 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.03];
    //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;
        };
    };
    };
};
 
Code:
    };
    _num = round(random 4) + 3;
    _config =        configFile >> "CfgBuildingLoot" >> "HeliCrash";
    _itemType =        [["M60A4_EP1","weapon"], ["M4A1_Aim","weapon"], ["M14_EP1","weapon"], ["BAF_L85A2_RIS_Holo","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.5, 0.05, 0.05, 0.02, 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.03];
    //diag_log ("DW_DEBUG: _itemChance: " + str(_itemChance)); 
    //diag_log ("DW_DEBUG: (isnil fnc_buildWeightedArray): " + str(isnil "fnc_buildWeightedArray")); 
 
    waituntil {!isnil "fnc_buildWeightedArray"};

Write it, this looks like a bit cleaner :)

Btw dont forget to edit your server_monitor.sqf for more spawns
 
Cargo stuff and Random Wrecks/spawns are allready added to the new Bliss.
If you don´t use Bliss.
Create a new Toptic for your wishes pls
 
Will post somewhere else, but would you be able to still assist? The guys on privatedayz had a discussion about this, but since the new forums are pointing here I can't see that post anymore...

Just the code for cargo drop will help.. :)
 
Use this my young padavan
_mark_carepackage1 = createMarker ["Care Package at "+str(_position),_position];
_mark_carepackage1 setMarkerType "waypoint";
_mark_carepackage1 setMarkerPos (_position);
_mark_carepackage1 setMarkerColor "ColorRed";
_mark_carepackage1 setMarkerText " ";

but not all players can see the markers on the map.
 
Morning!
Not enought time today to explain something.
Use this strg+c and replace it.
Code:
diag_log ("DEBUG Care Packages processing... START");
 
spawn_Misc_cargo_cont_net1 = {
    private["_mark_carepackage1","_position","_veh","_num","_config","_itemType","_itemChance","_weights","_index","_iArray"];
 
    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 Misc_cargo_cont_net1 at " + str(_position));
 
    _mark_carepackage1 = createMarker ["Care Package at "+str(_position),_position];
    _mark_carepackage1 setMarkerType "waypoint";
    _mark_carepackage1 setMarkerPos (_position);
    _mark_carepackage1 setMarkerColor "ColorRed";
    _mark_carepackage1 setMarkerText " ";
 
    _veh = createVehicle ["Misc_cargo_cont_net1",_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 2) + 3;
    _config =        configFile >> "CfgBuildingLoot" >> "Supermarket";
    _itemType =        [["WeaponHolder_ItemJerrycan", "object"], ["WeaponHolder_PartWheel", "object"], ["WeaponHolder_PartFueltank", "object"], ["WeaponHolder_PartEngine", "object"], ["WeaponHolder_PartGlass", "object"], ["", "food"], ["DZ_ALICE_Pack_EP1", "object"], ["", "trash"]];
    //diag_log ("DW_DEBUG: _itemType: " + str(_itemType)); 
    _itemChance =    [0.02, 0.1, 0.09, 0.02, 0.09, 0.4, 0.2, 0.4];
    //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;
        };
    };
    };
};

Thats one of the trio the smallest of all.
 
Back
Top