This commit is contained in:
Skaronator
2014-03-01 19:01:51 +01:00
parent 9d453ec7a0
commit 4e35d15b14
3 changed files with 18 additions and 23 deletions

View File

@@ -40,20 +40,20 @@ if (_spawnRoll <= _spawnChance) then {
_num = (round(random _randomizedLoot)) + _guaranteedLoot;
_config = configFile >> "CfgBuildingLoot" >> _lootTable;
if (DZE_MissionLootTable) then {
_config = missionConfigFile >> "CfgBuildingLoot" >> _lootTable;;
if (DZE_MissionLootTable) then {
_itemTypes = [] + getArray (missionConfigFile >> "CfgBuildingLoot" >> _lootTable >> "lootType");
} else {
_itemTypes = [] + getArray (configFile >> "CfgBuildingLoot" >> _lootTable >> "lootType");
};
_itemTypes = [] + getArray (_config >> "itemType");
_index = dayz_CBLBase find toLower(_lootTable);
_weights = dayz_CBLChances select _index;
_CBLBase = dayz_CBLBase find _lootTable;
_weights = dayz_CBLChances select _CBLBase;
_cntWeights = count _weights;
for "_x" from 1 to _num do {
//create loot
_index = floor(random _cntWeights);
_index = _weights select _index;
_itemType = _itemTypes select _index;
_index1 = floor(random _cntWeights);
_index2 = _weights select _index1;
_itemType = _itemTypes select _index2;
[_itemType select 0, _itemType select 1, _position, 5] call spawn_loot;
};