mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
small loot spawns
This commit is contained in:
@@ -36,14 +36,14 @@ _positionsSmall = [] + getArray (_config >> "lootPosSmall");
|
||||
_iPos = _obj modelToWorld _x;
|
||||
_nearBy = nearestObjects [_iPos, ["ReammoBox","WeaponHolder","WeaponHolderBase"], 1];
|
||||
if (count _nearBy == 0) then {
|
||||
_index = dayz_CBLBase find _type;
|
||||
_index = dayzE_CBLSBase find _type;
|
||||
//diag_log format["Found %2 at index: %1", _index,_type];
|
||||
_weights = dayz_CBLChances select _index;
|
||||
_weights = dayzE_CBLSChances select _index;
|
||||
_cntWeights = count _weights;
|
||||
_index = floor(random _cntWeights);
|
||||
_index = _weights select _index;
|
||||
_itemType = _itemTypes select _index;
|
||||
[_itemType select 0, _itemType select 1 , _iPos, 0.0] call spawn_loot_small;
|
||||
[_itemType select 0, _itemType select 1 , _iPos, 0.0] call spawn_loot_small;
|
||||
_obj setVariable ["created",(DateToNumber date),true];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,11 +2,13 @@ private["_cfgCount","_config","_i","_itemChances","_itemCount","_weighted","_j",
|
||||
dayz_CBLChances = [];
|
||||
dayz_CBLBase = [];
|
||||
|
||||
dayzE_CBLSChances = [];
|
||||
dayzE_CBLSBase = [];
|
||||
|
||||
_config = configFile >> "CfgBuildingLoot";
|
||||
for "_i" from 0 to ((count _config) - 1) do {
|
||||
_classname = toLower(configName (_config select _i));
|
||||
_itemChances = [] + getArray (_config >> _classname >> "ItemChance");
|
||||
_itemChancesSmall = [] + getArray (_config >> _classname >> "ItemChanceSmall");
|
||||
_itemCount = count _itemChances;
|
||||
if (_itemCount > 0) then {
|
||||
if (dayz_CBLBase find _classname < 0) then {
|
||||
@@ -26,6 +28,27 @@ for "_i" from 0 to ((count _config) - 1) do {
|
||||
dayz_CBLChances set [count dayz_CBLChances, [0]];
|
||||
dayz_CBLBase set [count dayz_CBLBase, _classname];
|
||||
};
|
||||
|
||||
_itemChancesSmall = [] + getArray (_config >> _classname >> "ItemChanceSmall");
|
||||
_itemCountSmall = count _itemChancesSmall;
|
||||
if (_itemCountSmall > 0) then {
|
||||
if (dayzE_CBLSBase find _classname < 0) then {
|
||||
_weighted = [];
|
||||
_j = 0;
|
||||
for "_l" from 0 to ((count _itemChancesSmall) - 1) do {
|
||||
_weight = round ((_itemChancesSmall select _l) * 100);
|
||||
for "_k" from 0 to _weight - 1 do {
|
||||
_weighted set [_j + _k, _l];
|
||||
};
|
||||
_j = _j + _weight;
|
||||
};
|
||||
dayzE_CBLSChances set [count dayzE_CBLSChances, _weighted];
|
||||
dayzE_CBLSBase set [count dayzE_CBLSBase, _classname];
|
||||
};
|
||||
} else {
|
||||
dayzE_CBLSChances set [count dayzE_CBLSChances, [0]];
|
||||
dayzE_CBLSBase set [count dayzE_CBLSBase, _classname];
|
||||
};
|
||||
};
|
||||
|
||||
dayz_CLChances = [];
|
||||
@@ -46,6 +69,24 @@ for "_i" from 0 to ((count (_config)) - 1) do {
|
||||
dayz_CLChances set [count dayz_CLChances, _weighted];
|
||||
};
|
||||
|
||||
dayzE_CLSChances = [];
|
||||
dayzE_CLSBase = [];
|
||||
_config = configFile >> "cfgLootSmall";
|
||||
for "_i" from 0 to ((count (_config)) - 1) do {
|
||||
_itemChances = (getArray (_config select _i)) select 1;
|
||||
_weighted = [];
|
||||
_j = 0;
|
||||
for "_l" from 0 to ((count _itemChances) - 1) do {
|
||||
_weight = round ((_itemChances select _l) * 100);
|
||||
for "_k" from 0 to _weight - 1 do {
|
||||
_weighted set [_j + _k, _l];
|
||||
};
|
||||
_j = _j + _weight;
|
||||
};
|
||||
dayzE_CLSBase set [count dayzE_CLSBase, configName (_config select _i)];
|
||||
dayzE_CLSChances set [count dayzE_CLSChances, _weighted];
|
||||
};
|
||||
|
||||
private["_i","_type","_config","_canZombie","_canLoot"];
|
||||
dayz_ZombieBuildings = [];
|
||||
dayz_LootBuildings = [];
|
||||
|
||||
Reference in New Issue
Block a user