Installed Animated Heli Crashes. Now no loot. Error log included.

Dumgard

New Member
Problem solved. Edit server_spawnCrashSite.sqf

Original
Code:
        _num        = round(random _randomizedLoot) + _guaranteedLoot;
 
        _config =        configFile >> "CfgBuildingLoot" >> _lootTable;
        _itemTypes =    [] + getArray (_config >> "itemType");
        _index =        dayz_CBLBase  find "HeliCrash";
        _weights =        dayz_CBLChances select _index;
        _cntWeights = count _weights;
 
        //Creating the Lootpiles outside of the _crashModel
        for "_x" from 1 to _num do {
            //Create loot
            _index = floor(random _cntWeights);
            _index = _weights select _index;
            _itemType = _itemTypes select _index;
 
            //Let the Loot spawn in a non-perfect circle around _crashModel
            _lootPos = [_pos, ((random 2) + (sizeOf(_crashModel) * _lootRadius)), random 360] call BIS_fnc_relPos;
            [_itemType select 0, _itemType select 1, _lootPos, 0] call spawn_loot;
 
            diag_log(format["CRASHSPAWNER: Loot spawn at '%1' with loot table '%2'", _lootPos, sizeOf(_crashModel)]);
 
            // ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 and other such items.
            _nearby = _pos nearObjects ["ReammoBox", sizeOf(_crashModel)];
            {
                _x setVariable ["permaLoot",true];
            } forEach _nearBy;
        };

Replace with
Code:
_itemTypes = [] + getArray (configFile >> "CfgBuildingLoot" >> _lootTable >> "lootType");
_index =        dayz_CBLBase find _lootTable;
_weights =        dayz_CBLChances select _index;
_cntWeights =    count _weights;
 
//Creating the Lootpiles outside of the _crashModel
for "_x" from (round(random _randomizedLoot) + _guaranteedLoot) to 1 step -1 do {
    //Create loot
    _index = floor(random _cntWeights);
    _index = _weights select _index;
    _itemType = _itemTypes select _index;
 
    //Let the Loot spawn in a non-perfect circle around _crashModel
    _lootPos = [_pos, ((random 2) + (sizeOf(_crashModel) * _lootRadius)), random 360] call BIS_fnc_relPos;
    [_itemType select 0, _itemType select 1, _lootPos, 0] call spawn_loot;
 
    diag_log(format["CRASHSPAWNER: Loot spawn at '%1' with loot table '%2'", _lootPos, sizeOf(_crashModel)]);
 
    // ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 and other such items.
    _nearby = _pos nearObjects ["ReammoBox", sizeOf(_crashModel)];
    {
        _x setVariable ["permaLoot",true];
    } forEach _nearBy;
};
 
Back
Top