From 2fba620e39db3931570260cfd68068b2387cce34 Mon Sep 17 00:00:00 2001 From: Johnmatic Date: Tue, 28 Aug 2018 18:11:28 +0200 Subject: [PATCH] rare loot fix better rare loot respawn, magazines for rare weapons --- @ExileServer/addons/a3_dms/config.sqf | 3 +++ @ExileServer/addons/a3_dms/fn_DMS_preInit.sqf | 1 + .../addons/a3_dms/scripts/fn_FillCrate.sqf | 20 +++++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index d93cc65..4eefd26 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -1220,6 +1220,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 ba1bb87..409c1de 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 a46889c..0363673 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; };