mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Fix #1149 / New Loottable System
This commit is contained in:
@@ -50,24 +50,41 @@ _agent setVariable ["newDest",_newDest];
|
||||
//Add some loot
|
||||
_rnd = random 1;
|
||||
if (_rnd > 0.3) then {
|
||||
_lootType = configFile >> "CfgVehicles" >> _type >> "zombieLoot";
|
||||
if (isText _lootType) then {
|
||||
|
||||
_array = [];
|
||||
if (DZE_MissionLootTable) then {
|
||||
_array = getArray (missionConfigFile >> "cfgLoot" >> getText(_lootType));
|
||||
_lootType = missionConfigFile >> "CfgVehicles" >> _type >> "zombieLoot";
|
||||
} else {
|
||||
_array = getArray (configFile >> "cfgLoot" >> getText(_lootType));
|
||||
_lootType = configFile >> "CfgVehicles" >> _type >> "zombieLoot";
|
||||
};
|
||||
|
||||
if (isText _lootType) then {
|
||||
if (DZE_MissionLootTable) then {
|
||||
_lootTypeCfg = getArray (missionConfigFile >> "cfgLoot" >> getText(_lootType));
|
||||
} else {
|
||||
_lootTypeCfg = getArray (configFile >> "cfgLoot" >> getText(_lootType));
|
||||
};
|
||||
_array = [];
|
||||
{
|
||||
_array set [count _array, _x select 0]
|
||||
} foreach _lootTypeCfg;
|
||||
if (count _array > 0) then {
|
||||
_loot = _array call BIS_fnc_selectRandomWeighted;
|
||||
_index = dayz_CLBase find getText(_lootType);
|
||||
_weights = dayz_CLChances select _index;
|
||||
_loot = _array select (_weights select (floor(random (count _weights))));
|
||||
if(!isNil "_array") then {
|
||||
if (DZE_MissionLootTable) then {
|
||||
_loot_count = getNumber(missionConfigFile >> "CfgMagazines" >> _loot >> "count");
|
||||
} else {
|
||||
_loot_count = getNumber(configFile >> "CfgMagazines" >> _loot >> "count");
|
||||
};
|
||||
if(_loot_count>1) then {
|
||||
_agent addMagazine [_loot, ceil(random _loot_count)];
|
||||
} else {
|
||||
_agent addMagazine _loot;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//Start behavior
|
||||
_id = [_position,_agent] execFSM "\z\AddOns\dayz_code\system\zombie_agent.fsm";
|
||||
Reference in New Issue
Block a user