diff --git a/SQF/dayz_code/compile/building_spawnLoot.sqf b/SQF/dayz_code/compile/building_spawnLoot.sqf index a21caf470..011dc348a 100644 --- a/SQF/dayz_code/compile/building_spawnLoot.sqf +++ b/SQF/dayz_code/compile/building_spawnLoot.sqf @@ -7,7 +7,13 @@ _obj = _this select 0; _type = toLower(typeOf _obj); //diag_log format["Spawning loot for: %1", _type]; + + _config = configFile >> "CfgBuildingLoot" >> _type; +if (DZE_MissionLootTable) then { + _config = missionConfigFile >> "CfgBuildingLoot" >> _type; +}; + _positions = [] + getArray (_config >> "lootPos"); _itemTypes = [] + getArray (_config >> "itemType"); _lootChance = getNumber (_config >> "lootChance"); diff --git a/SQF/dayz_code/compile/building_spawnZombies.sqf b/SQF/dayz_code/compile/building_spawnZombies.sqf index 2327710f3..0c9298ae7 100644 --- a/SQF/dayz_code/compile/building_spawnZombies.sqf +++ b/SQF/dayz_code/compile/building_spawnZombies.sqf @@ -8,6 +8,9 @@ if (dayz_spawnZombies > dayz_maxLocalZombies) exitwith {}; _obj = _this select 0; _type = typeOf _obj; _config = configFile >> "CfgBuildingLoot" >> _type; +if (DZE_MissionLootTable) then { + _config = missionConfigFile >> "CfgBuildingLoot" >> _type; +}; _canLoot = isClass (_config); if (_canLoot) then { diff --git a/SQF/dayz_code/compile/player_spawnCheck.sqf b/SQF/dayz_code/compile/player_spawnCheck.sqf index 61e99e5f4..46c1f6050 100644 --- a/SQF/dayz_code/compile/player_spawnCheck.sqf +++ b/SQF/dayz_code/compile/player_spawnCheck.sqf @@ -98,6 +98,9 @@ if (_nearbyCount < 1) exitwith { _type = typeOf _x; _config = configFile >> "CfgBuildingLoot" >> _type; + if (DZE_MissionLootTable) then { + _config = missionConfigFile >> "CfgBuildingLoot" >> _type; + }; _canLoot = isClass (_config); if(_canLoot) then { diff --git a/SQF/dayz_code/compile/wild_spawnZombies.sqf b/SQF/dayz_code/compile/wild_spawnZombies.sqf index e902c4c5c..8d395bd6a 100644 --- a/SQF/dayz_code/compile/wild_spawnZombies.sqf +++ b/SQF/dayz_code/compile/wild_spawnZombies.sqf @@ -1,6 +1,12 @@ private ["_position","_doLoiter","_unitTypes","_loot","_array","_agent","_type","_radius","_method","_myDest","_newDest","_lootType","_player","_isAlive","_rnd","_id"]; _player = _this select 0; -_unitTypes = []+ getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass"); + +_unitTypes = []; +if (DZE_MissionLootTable) then { + _unitTypes = []+ getArray (missionConfigFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass"); +} else { + _unitTypes = []+ getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass"); +}; _doLoiter = true; _loot = ""; diff --git a/SQF/dayz_code/compile/zombie_generate.sqf b/SQF/dayz_code/compile/zombie_generate.sqf index d0f01f0f4..8f42725ad 100644 --- a/SQF/dayz_code/compile/zombie_generate.sqf +++ b/SQF/dayz_code/compile/zombie_generate.sqf @@ -16,7 +16,12 @@ _agent = objNull; if (!_isNoone) exitWith {}; if (count _unitTypes == 0) then { - _unitTypes = []+ getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass"); + + if (DZE_MissionLootTable) then { + _unitTypes = []+ getArray (missionConfigFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass"); + } else { + _unitTypes = []+ getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass"); + }; }; _type = _unitTypes call BIS_fnc_selectRandom; diff --git a/SQF/dayz_code/init/loot_init.sqf b/SQF/dayz_code/init/loot_init.sqf index e5d5fbf01..cee657e59 100644 --- a/SQF/dayz_code/init/loot_init.sqf +++ b/SQF/dayz_code/init/loot_init.sqf @@ -110,8 +110,16 @@ for "_i" from 0 to ((count (_config)) - 1) do { private["_i","_type","_config","_canZombie","_canLoot"]; dayz_ZombieBuildings = []; dayz_LootBuildings = []; -for "_i" from 0 to (count (configFile >> "CfgBuildingLoot") - 1) do { - _type = (configFile >> "CfgBuildingLoot") select _i; + +_config = []; +if (DZE_MissionLootTable) then { + _config = missionConfigFile >> "CfgBuildingLoot"; +} else { + _config = configFile >> "CfgBuildingLoot"; +}; + +for "_i" from 0 to (count (_config) - 1) do { + _type = _config select _i; _canZombie = getNumber (_type >> "zombieChance") > 0; _canLoot = getNumber (_type >> "lootChance") > 0; if(_canZombie) then { diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index e8a69d3a3..0c4bdf9ac 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -593,7 +593,12 @@ if(!isDedicated) then { zeroPreviousWeather = [0,0,[0,0],0]; zeroCurrentWeather = [0,0,[0,0],0]; - dayz_baseTypes = getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass"); + if (DZE_MissionLootTable) then { + dayz_baseTypes = getArray (missionConfigFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass"); + } else { + dayz_baseTypes = getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass"); + }; + //temperature variables dayz_temperatur = 36; //TeeChange diff --git a/SQF/dayz_server/compile/server_spawnCrashSite.sqf b/SQF/dayz_server/compile/server_spawnCrashSite.sqf index ae53a4691..4e74a9089 100644 --- a/SQF/dayz_server/compile/server_spawnCrashSite.sqf +++ b/SQF/dayz_server/compile/server_spawnCrashSite.sqf @@ -96,9 +96,11 @@ while {true} do { _crash setvariable ["fadeFire",_fadeFire,true]; }; - - _config = configFile >> "CfgBuildingLoot" >> _lootTable; + if (DZE_MissionLootTable) then { + _config = missionConfigFile >> "CfgBuildingLoot" >> _lootTable; + }; + _itemTypes = [] + getArray (_config >> "itemType"); _index = dayz_CBLBase find toLower(_lootTable); _weights = dayz_CBLChances select _index; diff --git a/SQF/dayz_server/init/server_functions.sqf b/SQF/dayz_server/init/server_functions.sqf index 0f7788420..8acc03a08 100644 --- a/SQF/dayz_server/init/server_functions.sqf +++ b/SQF/dayz_server/init/server_functions.sqf @@ -223,10 +223,19 @@ RoadList = MarkerPosition nearRoads DynamicVehicleArea; // Very taxing !!! but only on first startup BuildingList = []; { - if (isClass (configFile >> "CfgBuildingLoot" >> (typeOf _x))) then - { - BuildingList set [count BuildingList,_x]; + if (DZE_MissionLootTable) then { + if (isClass (missionConfigFile >> "CfgBuildingLoot" >> (typeOf _x))) then + { + BuildingList set [count BuildingList,_x]; + }; + } else { + if (isClass (configFile >> "CfgBuildingLoot" >> (typeOf _x))) then + { + BuildingList set [count BuildingList,_x]; + }; }; + + } forEach (MarkerPosition nearObjects ["building",DynamicVehicleArea]); spawn_vehicles = { diff --git a/SQF/dayz_server/modules/crash_spawner.sqf b/SQF/dayz_server/modules/crash_spawner.sqf index b799e09bc..23f23ac67 100644 --- a/SQF/dayz_server/modules/crash_spawner.sqf +++ b/SQF/dayz_server/modules/crash_spawner.sqf @@ -75,6 +75,9 @@ if (_spawnRoll <= _spawnChance) then { }; _config = configFile >> "CfgBuildingLoot" >> _lootTable; + if (DZE_MissionLootTable) then { + _config = missionConfigFile >> "CfgBuildingLoot" >> _lootTable;; + }; _itemTypes = [] + getArray (_config >> "itemType"); _index = dayz_CBLBase find toLower(_lootTable); _weights = dayz_CBLChances select _index; diff --git a/SQF/dayz_server/modules/supply_drop.sqf b/SQF/dayz_server/modules/supply_drop.sqf index b6bafcfb8..4c692a2c3 100644 --- a/SQF/dayz_server/modules/supply_drop.sqf +++ b/SQF/dayz_server/modules/supply_drop.sqf @@ -41,6 +41,9 @@ if (_spawnRoll <= _spawnChance) then { _num = (round(random _randomizedLoot)) + _guaranteedLoot; _config = configFile >> "CfgBuildingLoot" >> _lootTable; + if (DZE_MissionLootTable) then { + _config = missionConfigFile >> "CfgBuildingLoot" >> _lootTable;; + }; _itemTypes = [] + getArray (_config >> "itemType"); _index = dayz_CBLBase find toLower(_lootTable); _weights = dayz_CBLChances select _index;