Jump to content
Neviothr

Help with multiple custom loadouts

Recommended Posts

I'm trying to give each different type of AI unit a different loadout.

 

init.sqf:

[] call compile preprocessfile "f\customLoadouts.sqf";
{[_x] call fnc_loadout} forEach allUnits;

customLoadouts.sqf:

fnc_loadout = {

params ["_unit", "_role"];

_role = (typeOf _unit);

//Remove all current gear
removeGoggles _unit;
removeBackpack _unit;
removeHeadgear _unit:
removeVest _unit;
removeUniform _unit;
removeAllWeapons _unit:
removeAllAssignedItems _unit;

	switch (typeOf _unit) do
	{
		//Ammo Bearer
		case "I_Soldier_A_F":
		{
			_unit forceAddUniform "rhs_chdkz_uniform_5";
			_unit addItemToUniform "FirstAidKit";
			for "_i" from 1 to 3 do {_unit addItemToUniform "30Rnd_556x45_Stanag_Tracer_Yellow";};
			for "_i" from 1 to 2 do {_unit addItemToUniform "rhs_VOG25";};
			_unit addVest "V_TacVest_oli";
			for "_i" from 1 to 8 do {_unit addItemToVest "30Rnd_556x45_Stanag_Tracer_Yellow";};
			for "_i" from 1 to 2 do {_unit addItemToVest "16Rnd_9x21_Mag";};
			for "_i" from 1 to 2 do {_unit addItemToVest "HandGrenade";};
			 addItemToVest "SmokeShell";
			_unit addBackpack "B_Carryall_mcamo";
			for "_i" from 1 to 4 do {_unit addItemToBackpack "FirstAidKit";};
			_unit addItemToBackpack "SmokeShellGreen";
			for "_i" from 1 to 2 do {_unit addItemToBackpack "Chemlight_green";};
			for "_i" from 1 to 8 do {_unit addItemToBackpack "30Rnd_556x45_Stanag_Tracer_Yellow";};
			_unit addItemToBackpack "rhs_100Rnd_762x54mmR";
			for "_i" from 1 to 3 do {_unit addItemToBackpack "hlc_20Rnd_762x51_B_fal";};
			_unit addItemToBackpack "rhs_rpg7_PG7VL_mag";
			for "_i" from 1 to 2 do {_unit addItemToBackpack "HandGrenade";};
			for "_i" from 1 to 2 do {_unit addItemToBackpack "MiniGrenade";};
			for "_i" from 1 to 4 do {_unit addItemToBackpack "rhs_VOG25";};
			_unit addHeadgear "H_Bandanna_gry";
			_unit addWeapon "RH_M16a1";
			_unit addWeapon "hgun_P07_F";
			_unit linkItem "ItemMap";
			_unit linkItem "ItemCompass";
			_unit linkItem "ItemWatch";
			_unit linkItem "ItemRadio";
			_unit linkItem "ItemGPS";
		};

		//Auto Rifleman
		case "I_Soldier_AR_F"
		{
			_unit forceAddUniform "rhs_chdkz_uniform_4";
			_unit addItemToUniform "FirstAidKit";
			for "_i" from 1 to 2 do {_unit addItemToUniform "16Rnd_9x21_Mag";};
			_unit addItemToUniform "HandGrenade";
			_unit addItemToUniform "SmokeShell";
			_unit addVest "V_TacVestIR_blk";
			for "_i" from 1 to 2 do {_unit addItemToVest "rhs_100Rnd_762x54mmR";};
			_unit addItemToVest "SmokeShellGreen";
			for "_i" from 1 to 2 do {_unit addItemToVest "Chemlight_green";};
			_unit addHeadgear "H_Bandanna_blu";
			_unit addWeapon "rhs_weap_pkm";
			_unit addWeapon "hgun_P07_F";
			_unit linkItem "ItemMap";
			_unit linkItem "ItemCompass";
			_unit linkItem "ItemWatch";
			_unit linkItem "ItemRadio";
		};

		//Combat Life Saver
		case "I_medic_F"
		{
			_unit forceAddUniform "rhs_chdkz_uniform_3";
			_unit addItemToUniform "FirstAidKit";
			for "_i" from 1 to 3 do {_unit addItemToUniform "rhs_30Rnd_762x39mm";};
			_unit addVest "V_TacVest_camo";
			for "_i" from 1 to 2 do {_unit addItemToVest "rhs_30Rnd_762x39mm";};
			for "_i" from 1 to 2 do {_unit addItemToVest "16Rnd_9x21_Mag";};
			_unit addItemToVest "SmokeShell";
			_unit addItemToVest "SmokeShellGreen";
			_unit addItemToVest "SmokeShellOrange";
			_unit addItemToVest "SmokeShellPurple";
			for "_i" from 1 to 2 do {_unit addItemToVest "Chemlight_green";};
			_unit addBackpack "B_FieldPack_oli";
			for "_i" from 1 to 10 do {_unit addItemToBackpack "FirstAidKit";};
			_unit addItemToBackpack "Medikit";
			_unit addHeadgear "H_Bandanna_cbr";
			_unit addWeapon "rhs_weap_akms";
			_unit addWeapon "hgun_P07_F";
			_unit linkItem "ItemMap";
			_unit linkItem "ItemCompass";
			_unit linkItem "ItemWatch";
			_unit linkItem "ItemRadio";
		};

		//Crewman
		case "I_crew_F"
		{
			_unit forceAddUniform "rhs_chdkz_uniform_2";
			_unit addItemToUniform "FirstAidKit";
			for "_i" from 1 to 3 do {_unit addItemToUniform "rhs_30Rnd_762x39mm";};
			_unit addVest "V_BandollierB_blk";
			for "_i" from 1 to 2 do {_unit addItemToVest "rhs_30Rnd_762x39mm";};
			for "_i" from 1 to 2 do {_unit addItemToVest "16Rnd_9x21_Mag";};
			for "_i" from 1 to 2 do {_unit addItemToVest "HandGrenade";};
			for "_i" from 1 to 2 do {_unit addItemToVest "Chemlight_green";};
			_unit addItemToVest "SmokeShell";
			_unit addItemToVest "SmokeShellGreen";
			_unit addHeadgear "rhs_tsh4";
			_unit addWeapon "rhs_weap_akms";
			_unit addWeapon "hgun_P07_F";
			_unit linkItem "ItemMap";
			_unit linkItem "ItemCompass";
			_unit linkItem "ItemWatch";
			_unit linkItem "ItemRadio";
		};

		//Engineer
		case "I_engineer_F"
		{
			_unit forceAddUniform "rhs_chdkz_uniform_1";
			_unit addItemToUniform "FirstAidKit";
			for "_i" from 1 to 3 do {_unit addItemToUniform "30Rnd_556x45_Stanag_Tracer_Yellow";};
			_unit addVest "V_I_G_resistanceLeader_F";
			for "_i" from 1 to 2 do {_unit addItemToVest "16Rnd_9x21_Mag";};
			for "_i" from 1 to 2 do {_unit addItemToVest "30Rnd_556x45_Stanag_Tracer_Yellow";};
			for "_i" from 1 to 2 do {_unit addItemToVest "HandGrenade";};
			for "_i" from 1 to 2 do {_unit addItemToVest "Chemlight_green";};
			_unit addItemToVest "SmokeShellYellow";
			_unit addItemToVest "SmokeShellGreen";
			_unit addItemToVest "SmokeShellOrange";
			_unit addItemToVest "SmokeShellPurple";
			_unit addBackpack "B_Kitbag_mcamo";
			_unit addItemToBackpack "ToolKit";
			_unit addItemToBackpack "MineDetector";
			_unit addItemToBackpack "SatchelCharge_Remote_Mag";
			for "_i" from 1 to 2 do {_unit addItemToBackpack "DemoCharge_Remote_Mag";};
			_unit addHeadgear "H_Bandanna_khk";
			_unit addWeapon "RH_M16a1";
			_unit addWeapon "hgun_P07_F";
			_unit linkItem "ItemMap";
			_unit linkItem "ItemCompass";
			_unit linkItem "ItemWatch";
			_unit linkItem "ItemRadio";
		};

		//Explosives Specialist
		case "I_Soldier_exp_F"
		{
			_unit forceAddUniform "MNP_CombatUniform_Militia_DC";
			_unit addItemToUniform "FirstAidKit";
			for "_i" from 1 to 3 do {_unit addItemToUniform "rhs_30Rnd_762x39mm";};
			_unit addItemToUniform "Chemlight_green";
			_unit addVest "V_TacVestIR_blk";
			_unit addItemToVest "SmokeShellGreen";
			for "_i" from 1 to 2 do {_unit addItemToVest "16Rnd_9x21_Mag";};
			for "_i" from 1 to 2 do {_unit addItemToVest "rhs_30Rnd_762x39mm";};
			for "_i" from 1 to 3 do {_unit addItemToVest "APERSMine_Range_Mag";};
			for "_i" from 1 to 2 do {_unit addItemToVest "HandGrenade";};
			_unit addItemToVest "SmokeShellYellow";
			_unit addItemToVest "Chemlight_green";
			_unit addBackpack "B_Carryall_cbr";
			_unit addItemToBackpack "ToolKit";
			for "_i" from 1 to 2 do {_unit addItemToBackpack "MineDetector";};
			for "_i" from 1 to 2 do {_unit addItemToBackpack "APERSBoundingMine_Range_Mag";};
			for "_i" from 1 to 2 do {_unit addItemToBackpack "ClaymoreDirectionalMine_Remote_Mag";};
			for "_i" from 1 to 2 do {_unit addItemToBackpack "SLAMDirectionalMine_Wire_Mag";};
			_unit addItemToBackpack "DemoCharge_Remote_Mag";
			_unit addHeadgear "H_Bandanna_khk_hs";
			_unit addWeapon "rhs_weap_akms";
			_unit addWeapon "hgun_P07_F";
			_unit linkItem "ItemMap";
			_unit linkItem "ItemCompass";
			_unit linkItem "ItemWatch";
			_unit linkItem "ItemRadio";
		};

		//Grenadier
		case "I_Soldier_GL_F"
		{
			_unit forceAddUniform "MNP_CombatUniform_Militia_DE";
			for "_i" from 1 to 2 do {_unit addItemToUniform "30Rnd_556x45_Stanag_Tracer_Yellow";};
			_unit addVest "V_HarnessOGL_brn";
			_unit addItemToVest "FirstAidKit";
			for "_i" from 1 to 3 do {_unit addItemToVest "30Rnd_556x45_Stanag_Tracer_Yellow";};
			_unit addItemToVest "1Rnd_SmokePurple_Grenade_shell";
			for "_i" from 1 to 2 do {_unit addItemToVest "16Rnd_9x21_Mag";};
			for "_i" from 1 to 2 do {_unit addItemToVest "MiniGrenade";};
			for "_i" from 1 to 2 do {_unit addItemToVest "HandGrenade";};
			for "_i" from 1 to 5 do {_unit addItemToVest "1Rnd_HE_Grenade_shell";};
			_unit addItemToVest "SmokeShell";
			_unit addItemToVest "SmokeShellGreen";
			for "_i" from 1 to 2 do {_unit addItemToVest "Chemlight_green";};
			for "_i" from 1 to 2 do {_unit addItemToVest "1Rnd_Smoke_Grenade_shell";};
			_unit addBackpack "B_AssaultPack_mcamo";
			_unit addItemToBackpack "1Rnd_SmokeGreen_Grenade_shell";
			for "_i" from 1 to 2 do {_unit addItemToBackpack "1Rnd_SmokeOrange_Grenade_shell";};
			_unit addHeadgear "H_Bandanna_mcamo";
			_unit addWeapon "RH_M16A1gl";
			_unit addWeapon "hgun_P07_F";
			_unit linkItem "ItemMap";
			_unit linkItem "ItemCompass";
			_unit linkItem "ItemWatch";
			_unit linkItem "ItemRadio";
		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};

		case (_role = ""):
		{

		};
	// Close the switch
	};

// Close the function
};

What am I doing wrong?

Share this post


Link to post
Share on other sites

You only have a colon after the first case, you need them after all the cases

Share this post


Link to post
Share on other sites

It now says that there's an "unidentified variable in expression: fnc_loadout"

This in singleplayer, btw, and I need it to be call on all units.

Share this post


Link to post
Share on other sites

defaultGear.sqf;

// Player Loadouts Via Classnames
// Written by Schadler.C

private ["_unit", "_type", "_side"];

_unit = _this select 0;
_type = (typeOf _unit);
_side = (side _unit);


// Remove Starting Items
	
	removeallWeapons _unit;
	removeAllAssignedItems _unit;
	removeBackpack _unit;
	
// Common Items
	
	_unit addWeapon "ItemMap";
	_unit addWeapon "ItemCompass";
	_unit addWeapon "ItemWatch";
	_unit addItem "FirstAidKit";

// Start Gear Assignment	
	
switch (_side) do {
	
	// Blufor Loadout
	
	case west: {
		
		// Common WEST Gear
		
		_unit addWeapon "NVGoggles";
		
			// Common Ammo/Items/etc here if needed.

				switch (_type) do {
					
					// Commander
					
						case "rhsusf_usmc_marpat_d_officer": {
							
							// Backpack/Radio
							
								_unit addBackpack "tf_rt1523g_big_rhs";
							
							// Weapons
							
								_unit addWeapon "rhs_weap_m4a1_grip";
								_unit addPrimaryWeaponItem "rhsusf_acc_SFMB556";
								_unit addPrimaryWeaponItem "optic_Hamr";
								
							// Ammo
							
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5];
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2];
								_unit addMagazines ["SmokeShellRed", 1];
								_unit addMagazines ["SmokeShellOrange", 1];
								_unit addMagazines ["SmokeShellBlue", 1];
								_unit addMagazines ["rhs_mag_m67", 2];
								_unit addMagazines ["SmokeShell", 2];
							
							// Items
							
								_unit linkItem "ItemGPS";
								_unit linkItem "tf_anprc152";
								_unit addWeapon "Laserdesignator";
								_unit addMagazine "LaserBatteries";
							
						};
						
					// Squad Leader
					
						case "rhsusf_usmc_marpat_d_squadleader": {
							
							// Backpack/Radio
							
								_unit addBackpack "tf_rt1523g_big_rhs";
							
							// Weapons
							
								_unit addWeapon "rhs_weap_m4a1_grip";
								_unit addPrimaryWeaponItem "rhsusf_acc_SFMB556";
								_unit addPrimaryWeaponItem "optic_Hamr";
								
							// Ammo
							
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5];
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2];
								_unit addMagazines ["SmokeShellRed", 1];
								_unit addMagazines ["SmokeShellOrange", 1];
								_unit addMagazines ["SmokeShellBlue", 1];
								_unit addMagazines ["rhs_mag_m67", 2];
								_unit addMagazines ["SmokeShell", 2];
							
							// Items
							
								_unit linkItem "ItemGPS";
								_unit linkItem "tf_anprc152";
								_unit addWeapon "Laserdesignator";
								_unit addMagazine "LaserBatteries";
						};
						
					// Team Leader
					
						case "rhsusf_usmc_marpat_d_teamleader": {
						
							// Weapons
							
								_unit addWeapon "rhs_weap_m4a1_grip";
								_unit addPrimaryWeaponItem "rhsusf_acc_SFMB556";
								_unit addPrimaryWeaponItem "rhsusf_acc_compm4";
								
							// Ammo
							
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5];
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2];
								_unit addMagazines ["rhs_mag_m67", 2];
								_unit addMagazines ["SmokeShell", 2];
							
							// Items
							
								_unit addWeapon "Binocular";
								_unit linkItem "tf_anprc152";

						};
						
					// UAV Operator
						
						case "rhsusf_usmc_marpat_d_uav": {
							
							// Backpack/Radio
							
								_unit addBackpack "tf_rt1523g_big_rhs";
							
							// Weapons
							
								_unit addWeapon "rhs_weap_m4a1_grip";
								_unit addPrimaryWeaponItem "rhsusf_acc_SFMB556";
								_unit addPrimaryWeaponItem "rhsusf_acc_compm4";
								
							// Ammo
							
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5];
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2];
								_unit addMagazines ["SmokeShellRed", 1];
								_unit addMagazines ["SmokeShellOrange", 1];
								_unit addMagazines ["SmokeShellBlue", 1];
							
							// Items
							
								_unit linkItem "B_UavTerminal";
								_unit linkItem "tf_anprc152";
							
						};
						
					// Rifleman
					
						case "rhsusf_usmc_marpat_d_rifleman": {
						
							// Weapons
							
								_unit addWeapon "rhs_weap_m4a1_grip";
								_unit addPrimaryWeaponItem "rhsusf_acc_SFMB556";
								_unit addPrimaryWeaponItem "optic_Hamr";
								
							// Ammo
							
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5];
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2];
								_unit addMagazines ["rhs_mag_m67", 2];
								_unit addMagazines ["SmokeShell", 2];
							
							// Items
							
								_unit addWeapon "Binocular";
								_unit linkItem "tf_anprc152";
						};

					// Medic
					
						case "rhsusf_usmc_marpat_d_rifleman_light": {
						
							// Backpack
							
								_unit addBackpack "B_kitbag_rgr";
							
							// Weapons
							
								_unit addWeapon "rhs_weap_m4a1_grip";
								_unit addPrimaryWeaponItem "rhsusf_acc_SFMB556";
								_unit addPrimaryWeaponItem "rhsusf_acc_compm4";
								
							// Ammo
							
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5];
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2];
								_unit addMagazines ["SmokeShell", 8];
								_unit addMagazines ["rhs_mag_m67", 2];
							
							// Items
							
								_unit linkItem "tf_anprc152";
								(unitbackpack _unit) addItemCargoGlobal ["FirstAidKit", 15];
								_unit addItem "Medikit";
								_unit addWeapon "Binocular";
							
						};
						
					// Grenadier
					
						case "rhsusf_usmc_marpat_d_grenadier": {
													
							// Weapons
							
								_unit addWeapon "rhs_weap_m4a1_m320";
								_unit addPrimaryWeaponItem "rhsusf_acc_SFMB556";
								_unit addPrimaryWeaponItem "rhsusf_acc_compm4";
								
							// Ammo
							
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5];
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2];
								_unit addMagazines ["rhs_mag_M441_HE", 8];
								_unit addMagazines ["rhs_mag_m67", 2];
								_unit addMagazines ["SmokeShell", 2];
							
							// Items
								
								_unit linkItem "tf_anprc152";
								_unit addWeapon "Binocular";

						};
						
					// Combat Engineer
					
						case "rhsusf_usmc_marpat_d_engineer": {
							
							// Backpack
							
								_unit addBackpack "B_kitbag_rgr";
							
							// Weapons
							
								_unit addWeapon "rhs_weap_m4a1_grip";
								_unit addPrimaryWeaponItem "rhsusf_acc_SFMB556";
								_unit addPrimaryWeaponItem "rhsusf_acc_compm4";
								
							// Ammo
							
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5];
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2];
								_unit addMagazines ["DemoCharge_Remote_Mag", 5];
								_unit addMagazines ["rhs_mag_m67", 2];
								_unit addMagazines ["SmokeShell", 2];
							
							// Items
							
								_unit linkItem "tf_anprc152";
								_unit addWeapon "Binocular";
								_unit linkItem "MineDetector";

						};
						
					// Light MG
					
						case "rhsusf_usmc_marpat_d_autorifleman_m249": {
							
							// Backpack
							
								_unit addBackpack "B_Kitbag_rgr";
							
							// Weapons
							
								_unit addWeapon "rhs_weap_m249_pip_L";
								_unit addPrimaryWeaponItem "rhsusf_acc_compm4";
								
							// Ammo
							
								_unit addMagazines ["rhsusf_100Rnd_556x45_soft_pouch", 6];
								_unit addMagazines ["rhs_mag_m67", 2];
								_unit addMagazines ["SmokeShell", 2];
							
							// Items
							
								_unit linkItem "tf_anprc152";
								_unit addWeapon "Binocular";

						};

					// Heavy MG
					
						case "rhsusf_usmc_marpat_d_machinegunner": {
						
							// Backpack

								_unit addBackpack "B_Kitbag_rgr";
							
							// Weapons
							
								_unit addWeapon "";
								_unit addPrimaryWeaponItem "";
								
							// Ammo
							
								_unit addMagazines ["", 0];
								_unit addMagazines ["rhs_mag_m67", 0];
								_unit addMagazines ["SmokeShell", 0];
							
							// Items
								
								_unit linkItem "tf_anprc152";
								_unit addWeapon "Binocular";
								
						};
						
					// Light AT
					
						case "rhsusf_usmc_marpat_d_riflemanat": {
													
							// Weapons
							
								_unit addWeapon "rhs_weap_m4a1_grip";
								_unit addPrimaryWeaponItem "rhsusf_acc_SFMB556";
								_unit addPrimaryWeaponItem "rhsusf_acc_compm4";
								
								_unit addWeapon "rhs_weap_M136";
								
							// Ammo
							
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5];
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2];
								_unit addMagazines ["rhs_m136_mag", 1];
								_unit addMagazines ["rhs_mag_m67", 2];
								_unit addMagazines ["SmokeShell", 2];
							
							// Items
							
								_unit linkItem "tf_anprc152";
								_unit addWeapon "Binocular";

						};
						
					// Heavy AT
					
						case "rhsusf_usmc_marpat_d_javelin": {
						
							// Backpack

								_unit addBackpack "B_Kitbag_rgr";
							
							// Weapons
							
								_unit addWeapon "rhs_weap_m4a1_grip";
								_unit addPrimaryWeaponItem "rhsusf_acc_SFMB556";
								_unit addPrimaryWeaponItem "rhsusf_acc_compm4";
								
								_unit addWeapon "rhs_weap_fgm148";
								
							// Ammo
							
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5];
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2];
								_unit addMagazines ["rhs_fgm148_Magazines_AT", 2];
								_unit addMagazines ["rhs_mag_m67", 2];
								_unit addMagazines ["SmokeShell", 2];
							
							// Items
							
								_unit linkItem "tf_anprc152";							
								_unit addWeapon "Binocular";

						};
						
					// Marksman
					
						case "rhsusf_usmc_marpat_d_marksman": {
														
							// Weapons
							
								_unit addWeapon "rhs_weap_m14ebrri_leu";
								_unit addPrimaryWeaponItem "rhsusf_acc_LEUPOLDMK4";
								
							// Ammo
							
								_unit addMagazines ["rhsusf_20Rnd_762x51_m118_special_Mag", 8];
								_unit addMagazines ["rhs_mag_m67", 2];
								_unit addMagazines ["SmokeShell", 2];
							
							// Items
								
								_unit linkItem "tf_anprc152";
								_unit addWeapon "Binocular";
							
						};
						
					// Sniper
					
						case "rhsusf_usmc_marpat_d_sniper": {
							
							// Remove Default Uniform
							
								removeUniform _unit;
								removeGoggles _unit;
								removeVest _unit;
								removeHeadgear _unit;
								removeAllAssignedItems _unit;
								
							// Uniform
							
								_unit addUniform "U_B_GhillieSuit";
								_unit addHeadgear "rhs_Booniehat_marpatwd";
								_unit addVest "rhsusf_spc_marksman";
							
							// Weapons
							
								_unit addWeapon "rhs_weap_XM2010";
								_unit addPrimaryWeaponItem "rhsusf_acc_LEUPOLDMK4_2";
								_unit addPrimaryWeaponItem "rhsusf_acc_harris_bipod";
								
							// Ammo
							
								_unit addMagazines ["rhsusf_5Rnd_300winmag_xm2010", 10];
								_unit addMagazines ["rhs_mag_m67", 2];
								_unit addMagazines ["SmokeShell", 2];
							
							// Items
								
								_unit linkItem "tf_anprc152";
								_unit addWeapon "Rangefinder";
							
						};
						
					// Crewman
						
						case "rhsusf_usmc_marpat_d_crewman": {
						
							// Weapons
							
								_unit addWeapon "rhs_weap_m4a1";
								
							// Ammo
							
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5];
								_unit addMagazines ["SmokeShell", 2];
								_unit addMagazines ["SmokeShellRed", 1];
								_unit addMagazines ["SmokeShellOrange", 1];
								_unit addMagazines ["SmokeShellBlue", 1];
							
							// Items
								
								_unit linkItem "tf_anprc152";							
								_unit addWeapon "Binocular";
								_unit linkItem "ItemGPS";
							
						};
						
					// Heli Pilot
					
						case "rhsusf_usmc_marpat_d_helipilot": {
						
							// Parachute
							
								_unit addBackpack "B_Parachute";
							
							// Weapons
							
								_unit addWeapon "rhs_weap_m4a1";
								
							// Ammo
							
								_unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5];
								_unit addMagazines ["SmokeShell", 2];
								_unit addMagazines ["SmokeShellRed", 1];
								_unit addMagazines ["SmokeShellOrange", 1];
								_unit addMagazines ["SmokeShellBlue", 1];
							
							// Items
							
								_unit linkItem "tf_anprc152";
								_unit addWeapon "Binocular";
								_unit linkItem "ItemGPS";
							
						};
						
					// Default
					
							default {/*Default Loadout or Error Message*/};
				};
	};
	
	// Opfor Loadout
	
	case east: {
	
		/* EAST LOADOUT HERE! */
	
	};
	case guer: {
	
		/* RESISTANCE LOADOUT HERE! */
	
	};
	case civ: {
	
		/* CIV LOADOUT HERE! */
	
	};
};

initPlayerLocal.sqf: (also onPlayerRespawn.sqf if you want it to save on respawning)

_nil = [player] execVM "defaultGear.sqf";

This is what I use. Feel free to edit/fix it anyway that you need too.

 

 

Share this post


Link to post
Share on other sites

Found kind of a solution, but it still doesn't work as I want it too.

https://forums.bistudio.com/topic/183740-a-loadoutframework-for-arma-3/

 

Basically, I need a function to be called with different parameters, depending on the unit's role.

Kinda like this:

if unit typeOf = "x" then {call [unit,loadoutName] call BG_fnc_applyLoadout;}

Pick a unit, find it's role (I_Soldier_A_F, I_Soldier_AR_F, etc.), then call a BG_fnc_applyLoadout while the parameters being the name of the picked unit, and appropriate loadout depending on the typeOf return.

Oh, and do that for every single AI unit on the map. Again, this is for singleplayer, so the player's loadout doesn't really matter here, only the AI's.

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

×