Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
beako

How to create a loaded weapon (launch_RPG32_F)?

Recommended Posts

HI ALL,

 

I am simply trying to replace the current secondary weapon with a different type of launcher, but have it added already preloaded.

 

Instead I have to wait until the unit reloads the weapon then I have to restock his backpack with the magazine he just used.

 

Is there a simpler way to add a preloaded weapon?

 

_man2 = objNull;
{if (typeOf _x == "B_T_Soldier_LAT_F") then {_man2 = _x}} forEach units player;


_lancherMagArray = [];
_BP = "";
_BPItems = [];
_backPackCamo = 'B_Kitbag_sgg';

// for units with secondaryWeapons
_lancherMagArray = getArray (configfile >> "CfgWeapons" >> secondaryWeapon _man2 >> "magazines");

if  !(_lancherMagArray isEqualTo []) then {

	// for B_T_Soldier_LAT_F replace NLAW with launch_RPG32_ghex_F
	if (typeOf _man2 == "B_T_Soldier_LAT_F") then {
		[_man2, "launch_RPG32_ghex_F", 2, "RPG32_F"] call BIS_fnc_addWeapon; 
		_lancherMagArray = ["RPG32_F","RPG32_HE_F"];
	};

	// replaceBP with "B_Kitbag_cbr" 
	removeBackpack _man2;
	_man2 addBackpack _backPackCamo;		// B_Kitbag_sgg		B_Kitbag_mcamo 	B_Kitbag_rgr 	B_Kitbag_cbr
	
    // fill backpack
    { 	
		if (_man2 canAddItemToBackpack _x) then {
			waitUntil {
				_man2 addItemToBackpack _x; 					
				!(_man2 canAddItemToBackpack _x)					
			};		
		};
	} forEach _lancherMagArray;	
	_BP = backpack _man2;
	_BPItems = backpackItems _man2;

};	

// cheat to fill backpack after reloading launcher
if (typeOf _man2 == "B_T_Soldier_LAT_F") then {
	waitUntil {
		((_man2 ammo "launch_RPG32_ghex_F")  == 1)
	};
	_man2 addItemToBackpack "RPG32_F";	
};

 

Share this post


Link to post
Share on other sites
On 6/25/2019 at 4:21 AM, beako said:

HI ALL,

 

I am simply trying to replace the current secondary weapon with a different type of launcher, but have it added already preloaded.

 

Instead I have to wait until the unit reloads the weapon then I have to restock his backpack with the magazine he just used.

 

Is there a simpler way to add a preloaded weapon?

 

Add one magazine before adding the weapon like so:

 

Player addMagazine "RPG32_F";

Player addWeapon "launch_RPG32_ghex_F";

//Add as many mags as you want

Edited by Dedmen
Shortened quote

Share this post


Link to post
Share on other sites

×