diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 15f9f52..fd3d4cb 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -1230,6 +1230,9 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc "Exile_Item_CodeLock" ]; DMS_RareLootChance = 10; // Percentage Chance to spawn rare loot in any crate | Default: 10% + DMS_RareLootSpawnMagazines = true; //If spawned rare loot is weapon, spawn magazines for it too + DMS_RareLootMinMagazines = DMS_MinimumMagCount; //We can spawn different count of magazines for rare weapons + DMS_RareLootMaxMagazines = DMS_MaximumMagCount; // Vehicles DMS_ArmedVehicles = [ // List of armed vehicles that can spawn diff --git a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf index 7bb4f9f..283ecaa 100644 --- a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf +++ b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf @@ -46,6 +46,7 @@ if (DMS_Use_Map_Config) then }; DMS_MagRange = DMS_MaximumMagCount - DMS_MinimumMagCount; +DMS_RareMagRange = DMS_RareLootMaxMagazines - DMS_RareLootMinMagazines; /* Original Functions from diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf index 24eef1a..76d0906 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf @@ -286,14 +286,30 @@ if (DMS_RareLoot) then }; // (Maybe) Add rare loot - if(random 100 < _rareLootChance) then + + for "_i" from 1 to DMS_RareLootAmount do { - for "_i" from 1 to DMS_RareLootAmount do + if((random 100) < _rareLootChance) then { _item = selectRandom DMS_RareLootList; if (_item isEqualType "") then { + private _ammo = ""; + + if (DMS_RareLootSpawnMagazines) then + { + _ammo = _item call DMS_fnc_selectMagazine; + }; + _item = [_item,1]; + + if (_ammo isEqualType "") then + { + if !(_ammo in ["Exile_Magazine_Swing","Exile_Magazine_Boing","Exile_Magazine_Swoosh", ""]) then + { + _crate addItemCargoGlobal [_ammo, (DMS_RareLootMinMagazines + floor(random DMS_RareMagRange))]; + }; + }; }; _crate addItemCargoGlobal _item; };