Jump to content
Sign in to follow this  
El' Rabito

Weapon Magazine Spawn Blacklist

Recommended Posts

Small tweak that adds the possibility to blacklist magazines that spawn with weapons. Instructions in the codebox below.

 

	
// 1. Add this to mission config.cpp class CfgExileLootSettings
	
	
/**
* Shows the classname of magazines spawned with a weapon in the server .rpt (0 = disabled /  1 = enabled)
*/
MagSpawnDebug = 0;

/**
* Weapon magazine spawn blacklist (CASE SENSITIVE! Enable MagSpawnDebug to check for the propper classnames.
*/
MagazineSpawnBlacklist[] = 
{
	"rhsusf_5Rnd_HE",
	"rhsusf_5Rnd_FRAG",
	"rhsusf_8Rnd_HE",
	"rhsusf_8Rnd_FRAG",
	"rhsusf_5rnd_doomsday_buck",
	"rhsusf_8rnd_doomsday_buck",
	"rhs_mag_rsp30_red",
	"rhs_mag_rsp30_green",
	"rhs_mag_rsp30_white"

};
							
// 2. Make an override for ExileServer_system_lootManager_spawnLootInBuilding.sqf and replace the "case 2" part.

case 2: 	
{ 
	_lootHolder addWeaponCargoGlobal [_itemClassName, 1]; 
	if !(_itemClassName isKindOf ["Exile_Melee_Abstract", configFile >> "CfgWeapons"]) then
	{
		_magazineClassNames = getArray(configFile >> "CfgWeapons" >> _itemClassName >> "magazines");
		if (count(_magazineClassNames) > 0) then
		{
			_blackList = getArray(missionConfigFile >> "CfgExileLootSettings" >> "MagazineSpawnBlacklist");
			_MagSpawnDebug = getNumber(missionConfigFile >> "CfgExileLootSettings" >> "MagSpawnDebug");
			{
			if ( _x in _blackList ) then {
				_magazineClassNames set [ _forEachIndex, -1 ];
			};
			}forEach _magazineClassNames;
			_magazineClassNames = _magazineClassNames - [ -1 ];
			if (_MagSpawnDebug == 1) then
			{
				diag_log format ["MagSpawnDebug: %1", _magazineClassNames];
			};
			_magazineClassName = selectRandom _magazineClassNames;
			_numberOfMagazines = 2 + floor(random 2); 
			_lootHolder addMagazineCargoGlobal [_magazineClassName, _numberOfMagazines];
			_spawnedItemClassNames pushBack _magazineClassName;
		};
	};
	_numberOfItemsToSpawn = -1;
};

Support Me: www.buymeacoffee.com/ElRabito

  • Like 2

Share this post


Link to post
Share on other sites
Sign in to follow this  

×