Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private ["_config","_itemChances","_itemCount","_weighted","_j","_weight","_type","_canZombie","_canLoot","_classname","_itemChancesSmall","_itemCountSmall"];
- dayz_CBLChances = [];
- dayz_CBLBase = [];
- dayzE_CBLSChances = [];
- dayzE_CBLSBase = [];
- _config = missionConfigFile >> "CfgBuildingLoot";
- FOR "_i" FROM 0 TO ((COUNT _config) - 1) do {
- _classname = toLower(configName (_config SELECT _i));
- _itemChances = [] + getArray (_config >> _classname >> "ItemChance");
- _itemCount = COUNT _itemChances;
- IF (_itemCount > 0) THEN {
- IF (dayz_CBLBase find _classname < 0) THEN {
- _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;
- };
- dayz_CBLChances SET [COUNT dayz_CBLChances, _weighted];
- dayz_CBLBase SET [COUNT dayz_CBLBase, _classname];
- };
- } ELSE {
- 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 = [];
- dayz_CLBase = [];
- _config = missionConfigFile >> "cfgLoot";
- 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;
- };
- dayz_CLBase SET [COUNT dayz_CLBase, configName (_config SELECT _i)];
- dayz_CLChances SET [COUNT dayz_CLChances, _weighted];
- };
- dayzE_CLSChances = [];
- dayzE_CLSBase = [];
- _config = missionConfigFile >> "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 = [];
- FOR "_i" FROM 0 TO (COUNT (missionConfigFile >> "CfgBuildingLoot") - 1) do {
- _type = (missionConfigFile >> "CfgBuildingLoot") SELECT _i;
- _canZombie = getNumber (_type >> "zombieChance") > 0;
- _canLoot = getNumber (_type >> "lootChance") > 0;
- IF(_canZombie) THEN {
- IF(!((configName _type) IN dayz_ZombieBuildings)) THEN {
- dayz_ZombieBuildings SET [COUNT dayz_ZombieBuildings, configName _type];
- };
- };
- IF(_canLoot) THEN {
- IF(!((configName _type) IN dayz_LootBuildings)) THEN {
- dayz_LootBuildings SET [COUNT dayz_LootBuildings, configName _type];
- };
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment