Jump to content
Sign in to follow this  

How to add magazines to current weapons?

Recommended Posts

this is my current code, and I need to add magazines to the current weapon in all units in editor. Can you please help me on how to do this?





waitUntil {!isNil "bis_fnc_init"};




_civ_hats = ["H_Bandanna_camo", "H_Booniehat_oli", "H_Watchcap_blk", "H_Shemag_olive"];


_vests = ["V_Rangemaster_belt", "V_TacVest_oli", "V_BandollierB_cbr"];


_weapons = ["V_Rangemaster_belt", "V_TacVest_oli", "V_BandollierB_cbr"];


_unit = _this select 0;



removeHeadgear _this;




// Add vest and clothing

removeVest _this;

_vest_item = _vests call BIS_fnc_selectRandom;

_this addVest _vest_item;


removeUniform _this;

_uniforms = ["U_IG_Guerilla3_2","U_IG_Guerilla3_1","U_IG_Guerilla2_3","U_IG_Guerilla2_2","U_IG_Guerilla2_1"];

_count = count _uniforms;

_this addUniform (_uniforms select floor random _count);






// Random integer, if 1 instead of 0, add a random item from the array

if(round (random 1) == 1) then



        _hat_item = _civ_hats call BIS_fnc_selectRandom;

_this addHeadgear _hat_item;


Share this post

Link to post
Share on other sites

This code add magazines to all unit weapons for each muzzle:

Fn_Gear_CompatibleMagazines = {
	private _cls = configFile >> "CfgWeapons" >> _this;
	private _res = [];
	{_res pushBack (if (_x == "this")
		then {getArray(_cls >> "magazines")}
		else {getArray(_cls >> _x >> "magazines")});
	} forEach getArray(_cls >> "muzzles");


private _unt = player;

{	if (count _x > 0) then {
		{	if (count _x > 0) then {			
				_unt addMagazine (_x select 0)}
		} foreach (_x call Fn_Gear_CompatibleMagazines)	
} forEach [primaryWeapon _unt, secondaryWeapon _unt, handgunWeapon _unt];

  • Like 1

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
Sign in to follow this