Jump to content
Sign in to follow this  
flymaker

Unit Weapon replacement script - Need help

Recommended Posts

Hello. :)

I'am trying do make a SQF script to replace default weapons from one side to modded weapons.
This is my first try in a real more complex script.


//Replace CSAT Weapons

//Put desire Weapon/Ammo Classname to replace
_replacefor_Katiba = ["hlc_rifle_auga3_GL","hlc_30Rnd_556x45_B_AUG"];
_replacefor_KatibaGL = ["",""];
_replacefor_KatibaC = ["",""];
_replacefor_Zafir = ["",""];
_replacefor_Rahin = ["",""];
_replacefor_Lynx = ["",""];
_replacefor_Sting = ["",""];
_replacefor_Zubr = ["",""];
_replacefor_Rook = ["",""];

//Get Unit Current Weapon and remove
_currentWeapon = primaryWeapon _this;
_this removeWeapon (primaryWeapon _currentWeapon);

_compatibleMags = [];
{
_mags = [];
if ( _x != "this" ) then {
_mags = getArray( configFile >> "CfgWeapons" >> _currentWeapon >> _x >> "magazines" );
}else{
_mags = getArray( configFile >> "CfgWeapons" >> _currentWeapon >> "magazines" );
};
_compatibleMags = _compatibleMags + _mags;
}forEach getArray( configFile >> "CfgWeapons" >> _currentWeapon >> "muzzles" );
{
if ( _x in _compatibleMags ) then {
_this removeMagazine _x;
}
} forEach magazines _this;

//Replace Katiba
If ( _currentWeapon == "arifle_Katiba_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
_this addMagazines [_newAmmo ,6];
_this addweapon _newWeapon;
};

If ( _currentWeapon == "arifle_Katiba_C_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
_this addMagazines [_newAmmo ,6];
_this addweapon _newWeapon;
};

If ( _currentWeapon == "arifle_Katiba_GL_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
_this addMagazines [_newAmmo ,6];
_this addweapon _newWeapon;
};


 

Error: "type string expected object"

Call method: nul = player execVM "Equip_Change.sqf";

Share this post


Link to post
Share on other sites

The most important thing is where the error is (shown by # in the error message). It's probably this due to the redundant primaryWeapon:

_currentWeapon = primaryWeapon _this;
_this removeWeapon (primaryWeapon _currentWeapon);

Share this post


Link to post
Share on other sites

OMG Thx.

 

I Am just starting with scripts and made a lot of mistakes. This is why i not follow programmer career.

Share this post


Link to post
Share on other sites

Well i made a good progression on code but i still need help.

//Replace CSAT Weapons


//Put desire Weapon/Ammo Classname to replace
_replacefor_Katiba = ["hlc_rifle_auga3_GL","hlc_30Rnd_556x45_B_AUG"];
_replacefor_KatibaGL = ["",""];
_replacefor_KatibaC = ["",""];
_replacefor_Zafir = ["",""];
_replacefor_Rahin = ["",""];
_replacefor_Lynx = ["",""];
_replacefor_Sting = ["",""];
_replacefor_Zubr = ["",""];
_replacefor_Rook = ["",""];

//Get Unit Current Weapon and remove
_getItems = primaryWeaponItems _this;
_currentWeapon = [primaryWeapon _this] call BIS_fnc_baseWeapon;
_this removeWeapon _currentWeapon;

_magazine01 = {_x == "30Rnd_65x39_caseless_green"} count magazines _this;
_magazine02 = {_x == "30Rnd_65x39_caseless_green_mag_Tracer"} count magazines _this;
_magazine03 = {_x == "1Rnd_HE_Grenade_shell"} count magazines _this;
_magazine04 = {_x == "1Rnd_Smoke_Grenade_shell"} count magazines _this;
_magazine05 = {_x == "1Rnd_SmokeRed_Grenade_shell"} count magazines _this;
_magazine06 = {_x == "1Rnd_SmokeOrange_Grenade_shell"} count magazines _this;
_magazine07 = {_x == "1Rnd_SmokeYellow_Grenade_shell"} count magazines _this;
_magazine08 = {_x == "1Rnd_SmokeGreen_Grenade_shell"} count magazines _this;
_magazine09 = {_x == "1Rnd_SmokePurple_Grenade_shell"} count magazines _this;
_magazine10 = {_x == "1Rnd_SmokeBlue_Grenade_shell"} count magazines _this;
_magazine11 = {_x == "UGL_FlareCIR_F"} count magazines _this;
_magazine12 = {_x == "UGL_FlareWhite_F"} count magazines _this;
_magazine13 = {_x == "UGL_FlareGreen_F"} count magazines _this;
_magazine14 = {_x == "UGL_FlareRed_F"} count magazines _this;
_magazine15 = {_x == "UGL_FlareYellow_F"} count magazines _this;


hint format["%1", magazines _this];

_compatibleMags = [];
{
_mags = [];
if ( _x != "this" ) then {
_mags = getArray( configFile >> "CfgWeapons" >> _currentWeapon >> _x >> "magazines" );
}else{
_mags = getArray( configFile >> "CfgWeapons" >> _currentWeapon >> "magazines" );
};
_compatibleMags = _compatibleMags + _mags;
}forEach getArray( configFile >> "CfgWeapons" >> _currentWeapon >> "muzzles" );
{
if ( _x in _compatibleMags ) then {
_this removeMagazine _x;
}
} forEach magazines _this;

//Replace Katiba
If ( _currentWeapon == "arifle_Katiba_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
_this addweapon _newWeapon;
{_this addPrimaryWeaponItem _x} forEach _getItems;
_this addMagazines [_newAmmo ,_magazines];
};

If ( _currentWeapon == "arifle_Katiba_C_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
if (magazines _this find "30Rnd_65x39_caseless_green" >= 0) then {
_magazines = {_x == "30Rnd_65x39_caseless_green"} count magazines _this;
_this addMagazines [_newAmmo ,_magazines];
};
_this addweapon _newWeapon;
{_this addPrimaryWeaponItem _x} forEach _getItems;
};

If ( _currentWeapon == "arifle_Katiba_GL_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
if (magazines _this find "30Rnd_65x39_caseless_green" >= 0) then {
_magazines = {_x == "30Rnd_65x39_caseless_green"} count magazines _this;
_this addMagazines [_newAmmo ,_magazines];
};
_this addweapon _newWeapon;
{_this addPrimaryWeaponItem _x} forEach _getItems;
};

If ( _currentWeapon == "LMG_Zafir_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
if (magazines _this find "30Rnd_65x39_caseless_green" >= 0) then {
_magazines = {_x == "30Rnd_65x39_caseless_green"} count magazines _this;
_this addMagazines [_newAmmo ,_magazines];
};
_this addweapon _newWeapon;
{_this addPrimaryWeaponItem _x} forEach _getItems;
};

If ( _currentWeapon == "srifle_DMR_01_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
if (magazines _this find "30Rnd_65x39_caseless_green" >= 0) then {
_magazines = {_x == "30Rnd_65x39_caseless_green"} count magazines _this;
_this addMagazines [_newAmmo ,_magazines];
};
_this addweapon _newWeapon;
{_this addPrimaryWeaponItem _x} forEach _getItems;
};

If ( _currentWeapon == "srifle_GM6_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
if (magazines _this find "30Rnd_65x39_caseless_green" >= 0) then {
_magazines = {_x == "30Rnd_65x39_caseless_green"} count magazines _this;
_this addMagazines [_newAmmo ,_magazines];
};
_this addweapon _newWeapon;
{_this addPrimaryWeaponItem _x} forEach _getItems;
};



I'm trying to get all magazines from first weapon, remove and re-add with the same quantity.

Share this post


Link to post
Share on other sites

I was thinking about the script. I need for now a way to put all magazines from a unit on Array with count.

Like that:
 

myArray = [ ["ammo1", 15],["ammo2", 2],["ammo3", 6]  ];

Anyone know how do that?

Share this post


Link to post
Share on other sites

jshock i need to count magazines from my primary weapon. For example:

A unit with Katiba GL, 2 magazines 6.5, 1 magazine 6.5 tracer and 3 GL rounds

This will return:
myArray = [["magazines 6.5", 2],["magazine 6.5 tracer", 1],["GL rounds", 3]];

I will run a addMagazine forEach entries on Array

Share this post


Link to post
Share on other sites

Look through this to see if it helps.

 

https://forums.bistudio.com/topic/186762-how-to-remove-primaryweapon-ammomagazine/

 

---

 

Ultimately this is how I ended up using it.

/*
Author: Cobra [BOMSF] 1949-2014
cobra@bomsf.com - www.bomsf.com
You may re-use any of this work as long as you provide credit back to me.
	Contact bomsfARMA3@gmail.com
	Edit By CSK222
		Soldier Loadouts
			Class: Rifleman
			Weapons: MXGL
			Path: text = "\A3\Weapons_F_EPB\Rifles\MX_Black\Data\UI\gear_mx_rifle_gl_black_X_CA.paa";
*/

private ["_soldier"];
_soldier = _this select 0;

if(local _soldier) then {
	
	// Remove Old Primary Weapon Ammo
	_compatibleMags = [];
	{
		_mags = [];
		if ( _x != "this" ) then
		{
			_mags = getArray( configFile >> "CfgWeapons" >> primaryWeapon _soldier >> _x >> "magazines" ); 
		}else
		{
			_mags = getArray( configFile >> "CfgWeapons" >> primaryWeapon _soldier >> "magazines" ); 
		};
		_compatibleMags = _compatibleMags + _mags;
	} forEach getArray( configFile >> "CfgWeapons" >> primaryWeapon _soldier >> "muzzles" );
	{
		if ( _x in _compatibleMags ) then
		{
			_soldier removeMagazine _x;
		}
	} forEach magazines _soldier;
	
	_soldier removeWeapon primaryWeapon _soldier;
	
	// Primary Weapon
	_soldier addMagazines ["30Rnd_65x39_caseless_mag_Tracer",4];
	_soldier addMagazines ["3Rnd_HE_Grenade_shell",3];
	_soldier addMagazines ["3Rnd_UGL_FlareWhite_F",3];
	_soldier addMagazines ["3Rnd_Smoke_Grenade_shell",3];
	_soldier addweapon "arifle_MX_GL_Black_F";
	_soldier addPrimaryWeaponItem "acc_pointer_IR";
	_soldier addPrimaryWeaponItem "optic_Hamr";
	_soldier addPrimaryWeaponItem "muzzle_snds_H";

	// Insignia
	[_soldier,"BOMSF"] call bis_fnc_setUnitInsignia;
};

Share this post


Link to post
Share on other sites

 

You made it manually. I want to made automatic because the script will replace all infantry units. This is to prevent hard work in codes like this:
 

scriptName "AAF_Eqipment";

If !(typeOf _this in ["I_Soldier_AAA_F","I_Soldier_AAR_F","I_Soldier_AAT_F","I_Soldier_AA_F","I_Soldier_AR_F","I_Soldier_AT_F","I_Soldier_A_F","I_Soldier_GL_F","I_Soldier_LAT_F","I_Soldier_M_F","I_Soldier_SL_F","I_Soldier_TL_F","I_Soldier_exp_F","I_Soldier_lite_F","I_Soldier_repair_F","I_Soldier_unarmed_F","I_crew_F","I_engineer_F","I_helicrew_F","I_helipilot_F","I_medic_F","I_officer_F","I_pilot_F","I_soldier_F","I_soldier_UAV_F","I_support_AMG_F","I_support_AMort_F","I_support_GMG_F","I_support_MG_F","I_support_Mort_F","I_Sniper_F","I_Spotter_F"]) exitWith {["%1 has wrong loadout",_this] call BIS_fnc_logFormat};

comment "Remove existing items";
removeAllWeapons _this;
removeAllItems _this;
removeAllAssignedItems _this;
removeUniform _this;
removeVest _this;
removeBackpack _this;
removeHeadgear _this;
removeGoggles _this;

// Officer - Done
If (typeOf _this == "I_officer_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_OfficerUniform";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 2 do {_this addItemToUniform "hlc_25Rnd_9x19mm_M882_AUG";};
_this addItemToUniform "hlc_25Rnd_9x19mm_JHP_AUG";
_this addVest "V_BandollierB_oli";
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
_this addItemToVest "SmokeShellGreen";
_this addItemToVest "SmokeShellOrange";
_this addItemToVest "SmokeShellPurple";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addHeadgear "H_MilCap_dgtl";
_this addGoggles "G_Aviator";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga2para_b";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "ItemGPS";

};

// Team leader - Done
If (typeOf _this == "I_Soldier_TL_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform";
_this addItemToUniform "FirstAidKit";
_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";
_this addItemToUniform "hlc_30Rnd_556x45_SOST_AUG";
_this addItemToUniform "hlc_30Rnd_556x45_SPR_AUG";
_this addVest "V_PlateCarrierIAGL_dgtl";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_30Rnd_556x45_T_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "MiniGrenade";};
for "_i" from 1 to 5 do {_this addItemToVest "1Rnd_HE_Grenade_shell";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
_this addItemToVest "SmokeShellOrange";
_this addItemToVest "SmokeShellPurple";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
for "_i" from 1 to 2 do {_this addItemToVest "1Rnd_Smoke_Grenade_shell";};
_this addItemToVest "1Rnd_SmokeGreen_Grenade_shell";
_this addItemToVest "1Rnd_SmokeOrange_Grenade_shell";
_this addItemToVest "1Rnd_SmokePurple_Grenade_shell";
_this addHeadgear "H_HelmetIA";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3_GL";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_MRCO";
_this addWeapon "hgun_ACPC2_F";
_this addWeapon "Binocular";


comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "ItemGPS";
_this linkItem "NVGoggles_INDEP";
};

// Squad leader - Done
If (typeOf _this == "I_Soldier_SL_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_shortsleeve";
_this addItemToUniform "FirstAidKit";
_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";
_this addItemToUniform "hlc_30Rnd_556x45_SOST_AUG";
_this addItemToUniform "hlc_30Rnd_556x45_SPR_AUG";
_this addVest "V_PlateCarrierIA2_dgtl";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_30Rnd_556x45_T_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_this addItemToVest "I_IR_Grenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
_this addItemToVest "SmokeShellOrange";
_this addItemToVest "SmokeShellPurple";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addHeadgear "H_HelmetIA";
_this addGoggles "G_Sport_BlackWhite";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_MRCO";
_this addWeapon "hgun_ACPC2_F";
_this addWeapon "Binocular";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "ItemGPS";
_this linkItem "NVGoggles_INDEP";

};

// Rifleman - Done
If (typeOf _this == "I_soldier_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";};
_this addVest "V_PlateCarrierIA1_dgtl";
for "_i" from 1 to 3 do {_this addItemToVest "hlc_30Rnd_556x45_SOST_AUG";};
for "_i" from 1 to 3 do {_this addItemToVest "hlc_30Rnd_556x45_SPR_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addHeadgear "H_HelmetIA";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Rifleman Light - Done
If (typeOf _this == "I_Soldier_lite_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_shortsleeve";
_this addItemToUniform "FirstAidKit";
_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";
_this addItemToUniform "hlc_30Rnd_556x45_SOST_AUG";
_this addItemToUniform "hlc_30Rnd_556x45_SPR_AUG";
_this addVest "V_Chestrig_oli";
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addHeadgear "H_MilCap_dgtl";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Rifleman AT - Done
If (typeOf _this == "I_Soldier_LAT_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 2 do {_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";};
_this addVest "V_PlateCarrierIA2_dgtl";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_30Rnd_556x45_SOST_AUG";};
_this addItemToVest "hlc_30Rnd_556x45_SPR_AUG";
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "B_FieldPack_oli";
for "_i" from 1 to 2 do {_this addItemToBackpack "NLAW_F";};
_this addHeadgear "H_HelmetIA";
_this addGoggles "G_Sport_Red";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "launch_NLAW_F";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Grenadier - Done
If (typeOf _this == "I_Soldier_GL_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 2 do {_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";};
_this addItemToUniform "1Rnd_SmokePurple_Grenade_shell";
_this addVest "V_PlateCarrierIAGL_dgtl";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_30Rnd_556x45_SOST_AUG";};
_this addItemToVest "hlc_30Rnd_556x45_SPR_AUG";
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_this addItemToVest "MiniGrenade";};
for "_i" from 1 to 5 do {_this addItemToVest "1Rnd_HE_Grenade_shell";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
for "_i" from 1 to 2 do {_this addItemToVest "1Rnd_Smoke_Grenade_shell";};
_this addItemToVest "1Rnd_SmokeGreen_Grenade_shell";
_this addItemToVest "1Rnd_SmokeOrange_Grenade_shell";
_this addHeadgear "H_HelmetIA_net";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3_GL";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// AutoRifleman - Done
If (typeOf _this == "I_Soldier_AR_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_shortsleeve";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 2 do {_this addItemToUniform "9Rnd_45ACP_Mag";};
_this addItemToUniform "HandGrenade";
_this addItemToUniform "SmokeShell";
_this addVest "V_PlateCarrierIA2_dgtl";
_this addItemToVest "hlc_200rnd_556x45_B_SAW";
_this addItemToVest "hlc_200rnd_556x45_M_SAW";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addHeadgear "H_HelmetIA_camo";
_this addGoggles "G_Sport_Blackred";

comment "Add weapons";
_this addWeapon "hlc_lmg_minimi_railed";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Marksman - Done
If (typeOf _this == "I_Soldier_M_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform";
_this addItemToUniform "FirstAidKit";
_this addItemToUniform "hlc_20Rnd_762x51_B_M14";
_this addItemToUniform "Chemlight_green";
_this addVest "V_PlateCarrierIA1_dgtl";
_this addItemToVest "hlc_20Rnd_762x51_B_M14";
for "_i" from 1 to 2 do {_this addItemToVest "20Rnd_762x51_barrier_M14";};
for "_i" from 1 to 2 do {_this addItemToVest "hlc_20Rnd_762x51_mk316_M14";};
for "_i" from 1 to 2 do {_this addItemToVest "hlc_20Rnd_762x51_T_M14";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
_this addItemToVest "Chemlight_green";
_this addHeadgear "H_HelmetIA";

comment "Add weapons";
_this addWeapon "hlc_rifle_m14dmr";
_this addPrimaryWeaponItem "hlc_optic_artel_m14";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Sniper - Done
If (typeOf _this == "I_Sniper_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_GhillieSuit";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 2 do {_this addItemToUniform "hlc_5rnd_300WM_FMJ_AWM";};
_this addItemToUniform "SmokeShell";
_this addVest "V_Chestrig_oli";
_this addItemToVest "hlc_5rnd_300WM_mk248_AWM";
_this addItemToVest "hlc_5rnd_300WM_BTSP_AWM";
_this addItemToVest "hlc_5rnd_300WM_AP_AWM";
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
_this addItemToVest "APERSTripMine_Wire_Mag";
_this addItemToVest "ClaymoreDirectionalMine_Remote_Mag";
_this addItemToVest "SmokeShellGreen";
_this addItemToVest "SmokeShellOrange";
_this addItemToVest "SmokeShellPurple";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};

comment "Add weapons";
_this addWeapon "hlc_rifle_awMagnum_OD_ghillie";
_this addPrimaryWeaponItem "optic_LRPS";
_this addWeapon "hgun_ACPC2_F";
_this addHandgunItem "muzzle_snds_acp";
_this addWeapon "Rangefinder";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "ItemGPS";
_this linkItem "NVGoggles_INDEP";

};

// Spotter - Done
If (typeOf _this == "I_Spotter_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_GhillieSuit";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 2 do {_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";};
for "_i" from 1 to 2 do {_this addItemToUniform "hlc_30Rnd_556x45_SOST_AUG";};
_this addItemToUniform "hlc_30Rnd_556x45_SPR_AUG";
_this addItemToUniform "SmokeShell";
_this addVest "V_Chestrig_oli";
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
_this addItemToVest "ClaymoreDirectionalMine_Remote_Mag";
_this addItemToVest "APERSTripMine_Wire_Mag";
for "_i" from 1 to 2 do {_this addItemToVest "MiniGrenade";};
for "_i" from 1 to 2 do {_this addItemToVest "I_IR_Grenade";};
_this addItemToVest "SmokeShellGreen";
_this addItemToVest "SmokeShellOrange";
_this addItemToVest "SmokeShellPurple";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3";
_this addPrimaryWeaponItem "optic_MRCO";
_this addWeapon "hgun_ACPC2_F";
_this addHandgunItem "muzzle_snds_acp";
_this addWeapon "Laserdesignator_03";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "ItemGPS";
_this linkItem "NVGoggles_INDEP";

};

// AT Specialist - Done
If (typeOf _this == "I_Soldier_AT_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_25Rnd_9x19mm_M882_AUG";};
_this addVest "V_PlateCarrierIA2_dgtl";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_25Rnd_9x19mm_JHP_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "B_FieldPack_oli";
for "_i" from 1 to 2 do {_this addItemToBackpack "Titan_AT";};
_this addHeadgear "H_HelmetIA_camo";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga2para_b";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "launch_I_Titan_short_F";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// AA Specialist - Done
If (typeOf _this == "I_Soldier_AA_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_shortsleeve";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_25Rnd_9x19mm_M882_AUG";};
_this addVest "V_PlateCarrierIA2_dgtl";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_25Rnd_9x19mm_JHP_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "B_FieldPack_oli";
for "_i" from 1 to 2 do {_this addItemToBackpack "Titan_AA";};
_this addHeadgear "H_HelmetIA";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga2para_b";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "launch_I_Titan_F";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Assist AT Specialist - Done
If (typeOf _this == "I_Soldier_AAT_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_tshirt";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";};
_this addVest "V_Chestrig_oli";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_30Rnd_556x45_SOST_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "hlc_30Rnd_556x45_SPR_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_this addItemToVest "I_IR_Grenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "B_Carryall_oli";
for "_i" from 1 to 2 do {_this addItemToBackpack "Titan_AT";};
for "_i" from 1 to 2 do {_this addItemToBackpack "Titan_AP";};
_this addHeadgear "H_HelmetIA";
_this addGoggles "G_Sport_Checkered";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";
_this addWeapon "Rangefinder";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Assist AA Specialist - Done
If (typeOf _this == "I_Soldier_AAA_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_tshirt";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";};
_this addVest "V_Chestrig_oli";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_30Rnd_556x45_SOST_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "hlc_30Rnd_556x45_SPR_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_this addItemToVest "I_IR_Grenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "B_Carryall_oli";
for "_i" from 1 to 3 do {_this addItemToBackpack "Titan_AA";};
_this addHeadgear "H_HelmetIA";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";
_this addWeapon "Rangefinder";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Assist Auto Rifleman - Done
If (typeOf _this == "I_Soldier_AAR_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_tshirt";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";};
_this addVest "V_Chestrig_oli";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_30Rnd_556x45_SOST_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "hlc_30Rnd_556x45_SPR_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_this addItemToVest "I_IR_Grenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "B_TacticalPack_oli";
_this addItemToBackpack "optic_tws_mg";
_this addItemToBackpack "hlc_muzzle_556NATO_KAC";
for "_i" from 1 to 2 do {_this addItemToBackpack "hlc_200rnd_556x45_B_SAW";};
_this addItemToBackpack "hlc_200rnd_556x45_M_SAW";
_this addItemToBackpack "hlc_200rnd_556x45_T_SAW";
_this addHeadgear "H_HelmetIA";
_this addGoggles "G_Tactical_Black";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";
_this addWeapon "Rangefinder";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Heli Pilot - Done
If (typeOf _this == "I_helipilot_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_HeliPilotCoveralls";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 2 do {_this addItemToUniform "hlc_30Rnd_9x19_B_MP5";};
_this addItemToUniform "Chemlight_green";
_this addVest "V_TacVest_oli";
_this addItemToVest "hlc_30Rnd_9x19_GD_MP5";
_this addItemToVest "SmokeShellGreen";
_this addItemToVest "SmokeShellOrange";
_this addItemToVest "SmokeShellPurple";
_this addItemToVest "Chemlight_green";
_this addHeadgear "H_PilotHelmetHeli_I";

comment "Add weapons";
_this addWeapon "hlc_smg_mp5k_PDW";
_this addPrimaryWeaponItem "optic_Holosight_smg";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Heli Crew - Done
If (typeOf _this == "I_helicrew_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_HeliPilotCoveralls";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 2 do {_this addItemToUniform "hlc_25Rnd_9x19mm_M882_AUG";};
_this addItemToUniform "hlc_25Rnd_9x19mm_JHP_AUG";
_this addVest "V_TacVest_oli";
_this addItemToVest "SmokeShellGreen";
_this addItemToVest "SmokeShellOrange";
_this addItemToVest "SmokeShellPurple";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addHeadgear "H_CrewHelmetHeli_I";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga2para_b";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Pilot - Done
If (typeOf _this == "I_pilot_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_pilotCoveralls";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 2 do {_this addItemToUniform "hlc_30Rnd_9x19_B_MP5";};
_this addItemToUniform "hlc_30Rnd_9x19_GD_MP5";
_this addItemToUniform "SmokeShell";
_this addItemToUniform "SmokeShellGreen";
_this addItemToUniform "Chemlight_green";
_this addBackpack "B_Parachute";
_this addHeadgear "H_PilotHelmetFighter_I";
_this addGoggles "G_Lowprofile";

comment "Add weapons";
_this addWeapon "hlc_smg_mp5k_PDW";
_this addPrimaryWeaponItem "optic_Holosight_smg";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";

};

// Medic - Done
If (typeOf _this == "I_medic_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_shortsleeve";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 2 do {_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";};
_this addItemToUniform "hlc_30Rnd_556x45_SOST_AUG";
_this addVest "V_PlateCarrierIA2_dgtl";
_this addItemToVest "hlc_30Rnd_556x45_SOST_AUG";
_this addItemToVest "hlc_30Rnd_556x45_SPR_AUG";
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
_this addItemToVest "SmokeShellOrange";
_this addItemToVest "SmokeShellPurple";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "B_FieldPack_oli";
_this addItemToBackpack "Medikit";
for "_i" from 1 to 15 do {_this addItemToBackpack "FirstAidKit";};
_this addHeadgear "H_HelmetIA";
_this addGoggles "G_Tactical_Black";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// AmmoBearer - Done
If (typeOf _this == "I_Soldier_A_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_shortsleeve";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";};
_this addVest "V_PlateCarrierIA1_dgtl";
_this addItemToVest "hlc_30Rnd_556x45_B_AUG";
for "_i" from 1 to 3 do {_this addItemToVest "hlc_30Rnd_556x45_SOST_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "hlc_30Rnd_556x45_SPR_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "B_FieldPack_oli";
for "_i" from 1 to 4 do {_this addItemToBackpack "FirstAidKit";};
for "_i" from 1 to 4 do {_this addItemToBackpack "hlc_30Rnd_556x45_B_AUG";};
for "_i" from 1 to 3 do {_this addItemToBackpack "hlc_30Rnd_556x45_SOST_AUG";};
_this addItemToBackpack "hlc_200rnd_556x45_B_SAW";
_this addItemToBackpack "NLAW_F";
for "_i" from 1 to 2 do {_this addItemToBackpack "HandGrenade";};
for "_i" from 1 to 2 do {_this addItemToBackpack "MiniGrenade";};
for "_i" from 1 to 6 do {_this addItemToBackpack "1Rnd_HE_Grenade_shell";};
_this addItemToBackpack "hlc_20Rnd_762x51_B_M14";
_this addItemToBackpack "hlc_20Rnd_762x51_barrier_M14";
_this addItemToBackpack "hlc_20Rnd_762x51_mk316_M14";
_this addHeadgear "H_HelmetIA_net";
_this addGoggles "G_Sport_Greenblack";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Explosive Specialist - Done
If (typeOf _this == "I_Soldier_EXP_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_shortsleeve";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_25Rnd_9x19mm_M882_AUG";};
_this addItemToUniform "SmokeShellGreen";
_this addItemToUniform "Chemlight_green";
_this addVest "V_PlateCarrierIAGL_dgtl";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_25Rnd_9x19mm_JHP_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 3 do {_this addItemToVest "APERSMine_Range_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "Chemlight_green";
_this addBackpack "B_Carryall_oli";
_this addItemToBackpack "ToolKit";
for "_i" from 1 to 1 do {_this addItemToBackpack "MineDetector";};
for "_i" from 1 to 4 do {_this addItemToBackpack "APERSBoundingMine_Range_Mag";};
for "_i" from 1 to 2 do {_this addItemToBackpack "ClaymoreDirectionalMine_Remote_Mag";};
for "_i" from 1 to 2 do {_this addItemToBackpack "SLAMDirectionalMine_Wire_Mag";};
_this addItemToBackpack "DemoCharge_Remote_Mag";
_this addHeadgear "H_HelmetIA";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga2para_b";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Repair Specialist - Done
If (typeOf _this == "I_Soldier_repair_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_shortsleeve";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 2 do {_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";};
_this addItemToUniform "hlc_30Rnd_556x45_SPR_AUG";
_this addVest "V_PlateCarrierIA1_dgtl";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_30Rnd_556x45_SOST_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
_this addItemToVest "SmokeShellOrange";
_this addItemToVest "SmokeShellPurple";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "B_FieldPack_oli";
_this addItemToBackpack "ToolKit";
_this addItemToBackpack "DemoCharge_Remote_Mag";
for "_i" from 1 to 2 do {_this addItemToBackpack "SmokeShell";};
_this addItemToBackpack "SmokeShellRed";
_this addItemToBackpack "SmokeShellGreen";
_this addItemToBackpack "SmokeShellYellow";
_this addHeadgear "H_HelmetIA_net";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Engineer - Done
If (typeOf _this == "I_engineer_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_25Rnd_9x19mm_M882_AUG";};
_this addVest "V_PlateCarrierIA1_dgtl";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_25Rnd_9x19mm_JHP_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
_this addItemToVest "SmokeShellOrange";
_this addItemToVest "SmokeShellPurple";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "B_Carryall_oli";
for "_i" from 1 to 1 do {_this addItemToBackpack "ToolKit";};
for "_i" from 1 to 1 do {_this addItemToBackpack "MineDetector";};
_this addItemToBackpack "SatchelCharge_Remote_Mag";
for "_i" from 1 to 2 do {_this addItemToBackpack "DemoCharge_Remote_Mag";};
_this addHeadgear "H_HelmetIA";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga2para_b";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Soldier Unarmed - Done
If (typeOf _this == "I_Soldier_unarmed_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform";
_this addItemToUniform "FirstAidKit";
_this addHeadgear "H_HelmetIA";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";

};

// Crew - Done
If (typeOf _this == "I_crew_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_25Rnd_9x19mm_M882_AUG";};
_this addVest "V_BandollierB_oli";
for "_i" from 1 to 2 do {_this addItemToVest "hlc_25Rnd_9x19mm_JHP_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addHeadgear "H_HelmetCrew_I";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga2para_b";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// UAV Operator - Done
If (typeOf _this == "I_soldier_UAV_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_30Rnd_556x45_B_AUG";};
_this addVest "V_PlateCarrierIA2_dgtl";
for "_i" from 1 to 3 do {_this addItemToVest "hlc_30Rnd_556x45_SOST_AUG";};
for "_i" from 1 to 3 do {_this addItemToVest "hlc_30Rnd_556x45_SPR_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "I_UAV_01_backpack_F";
_this addHeadgear "H_HelmetIA_camo";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga3";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "I_UavTerminal";
_this linkItem "NVGoggles_INDEP";

};

// Assistent Support AMG - Done
If (typeOf _this == "I_support_AMG_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_tshirt";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_25Rnd_9x19mm_M882_AUG";};
_this addVest "V_Chestrig_oli";
_this addItemToVest "hlc_25Rnd_9x19mm_M882_AUG";
for "_i" from 1 to 3 do {_this addItemToVest "hlc_25Rnd_9x19mm_JHP_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_this addItemToVest "I_IR_Grenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "I_HMG_01_support_F";
_this addHeadgear "H_HelmetIA";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga2para_b";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Assistent Support Mortar - Done
If (typeOf _this == "I_support_AMort_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_tshirt";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_25Rnd_9x19mm_M882_AUG";};
_this addVest "V_Chestrig_oli";
for "_i" from 1 to 4 do {_this addItemToVest "hlc_25Rnd_9x19mm_JHP_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_this addItemToVest "I_IR_Grenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "I_Mortar_01_support_F";
_this addGoggles "G_Sport_Blackyellow";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga2para_b";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Support GMG - Done
If (typeOf _this == "I_support_GMG_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_tshirt";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_25Rnd_9x19mm_M882_AUG";};
_this addVest "V_Chestrig_oli";
for "_i" from 1 to 4 do {_this addItemToVest "hlc_25Rnd_9x19mm_JHP_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_this addItemToVest "I_IR_Grenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "I_GMG_01_weapon_F";
_this addHeadgear "H_HelmetIA";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga2para_b";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Support MG - Done
If (typeOf _this == "I_support_MG_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_tshirt";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_25Rnd_9x19mm_JHP_AUG";};
_this addVest "V_Chestrig_oli";
for "_i" from 1 to 4 do {_this addItemToVest "hlc_25Rnd_9x19mm_M882_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_this addItemToVest "I_IR_Grenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "I_HMG_01_weapon_F";
_this addHeadgear "H_HelmetIA";
_this addGoggles "G_Tactical_Black";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga2para_b";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};

// Support Mortar - Done
If (typeOf _this == "I_support_Mort_F") Then {

comment "Add containers";
_this forceAddUniform "U_I_CombatUniform_tshirt";
_this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_this addItemToUniform "hlc_25Rnd_9x19mm_JHP_AUG";};
_this addVest "V_Chestrig_oli";
for "_i" from 1 to 4 do {_this addItemToVest "hlc_25Rnd_9x19mm_M882_AUG";};
for "_i" from 1 to 2 do {_this addItemToVest "9Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_this addItemToVest "I_IR_Grenade";};
_this addItemToVest "SmokeShell";
_this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_this addItemToVest "Chemlight_green";};
_this addBackpack "I_Mortar_01_weapon_F";
_this addHeadgear "H_HelmetIA";
_this addGoggles "G_Lowprofile";

comment "Add weapons";
_this addWeapon "hlc_rifle_auga2para_b";
_this addPrimaryWeaponItem "acc_pointer_IR";
_this addPrimaryWeaponItem "optic_ACO_grn";
_this addWeapon "hgun_ACPC2_F";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "NVGoggles_INDEP";

};



I will use script like a template:
 

_replacefor_Katiba = ["hlc_rifle_auga3","hlc_30Rnd_556x45_B_AUG"];
_replacefor_KatibaGL = ["hlc_rifle_auga3_GL","hlc_30Rnd_556x45_B_AUG"];
_replacefor_KatibaC = ["",""];
_replacefor_Zafir = ["",""];

By the way i'am using Larrow Code Just like you

Share this post


Link to post
Share on other sites

Progress Update:

I created one Array with all available Ammo

_replacefor_Ammo = [
"MagazineKatiba",
"MagazineKatibaTracer",
"MagazineZafir",
"MagazineZafirTracer",
"MagazineRahin",
"MagazineLynx",
"MagazineLynxSpecial",
"MagazineSting",
"GLAmmo 1",
"GLAmmo 2",
"GLSmoke 1",
"GLSmoke 2",
"GLSmoke 3",
"GLSmoke 4"
]; 

After that i get all magazines on unit and consolidate the array to bring right quantity:

_magazinesArray = magazines _this;
_magazinesArray = _magazinesArray call BIS_fnc_consolidateArray;

The replace code start a search for magazines:
(Here i need help with the logic, i want search all matching between _magazinesArray and _replacefor_Ammo and add the right ammo and quantity)

If ( _currentWeapon == "arifle_Katiba_F" ) then {
	
	{_findmagazine = _magazinesArray find _x;
	_this addMagazines [_findmagazine ,_magazines];
	} forEach _replacefor_Ammo;
	
	_this addweapon _replacefor_Katiba;
	{_this addPrimaryWeaponItem _x} forEach _getItems;
	
};

I will be very happy if this script works. I want to launch a public release. As i said this is my first real script

Share this post


Link to post
Share on other sites

Script is working well now, i'am using Zenophon ArrayGetNestedIndex function to found the right match on array . But i'am still trying to improve that. I want to do a loop to search for all magazines.

Here is the code now:

// Replace CSAT Weapons Script

// Put desire Weapon/Ammo Classname to replace
_replacefor_Katiba = "hlc_rifle_auga3";
_replacefor_KatibaGL = "hlc_rifle_auga3";
_replacefor_KatibaC = "hlc_rifle_auga3";
_replacefor_Zafir = "hlc_rifle_auga3";
_replacefor_Rahin = "hlc_rifle_auga3";
_replacefor_Lynx = "hlc_rifle_auga3";
_replacefor_Sting = "hlc_rifle_auga3";

/*Only Primary Weapons for now
_replacefor_Zubr = [""];
_replacefor_Rook = [""];
*/

// Dont leave any empty
/* AmmoArray = [
"MagazineKatiba",
"MagazineKatibaTracer",
"MagazineZafir",
"MagazineZafirTracer",
"MagazineRahin",
"MagazineLynx",
"MagazineLynxSpecial",
"MagazineSting",
"GLAmmo 1",
"GLAmmo 2",
"GLSmoke 1",
"GLSmoke 2",
"GLSmoke 3",
"GLSmoke 4"
]*/

_replacefor_Ammo = [
"hlc_30Rnd_556x45_B_AUG",
"MagazineKatibaTracer",
"MagazineZafir",
"MagazineZafirTracer",
"MagazineRahin",
"MagazineLynx",
"MagazineLynxSpecial",
"MagazineSting",
"GLAmmo 1",
"GLAmmo 2",
"GLSmoke 1",
"GLSmoke 2",
"GLSmoke 3",
"GLSmoke 4"
];

/* DO NOT EDIT BELLOW THIS LINE IF YOU DONT KNOW WHARE YOU DOING */

execVM "Zen_ArrayGetNestedIndex.sqf";

// Get Unit Current Weapon and remove
_getItems = primaryWeaponItems _this;
_currentWeapon = [primaryWeapon _this] call BIS_fnc_baseWeapon;
_this removeWeapon _currentWeapon;

_magazinesArray = magazines _this;
_magazinesArray = _magazinesArray call BIS_fnc_consolidateArray;

_compatibleMags = [];
{
_mags = [];
if ( _x != "this" ) then {
_mags = getArray( configFile >> "CfgWeapons" >> _currentWeapon >> _x >> "magazines" );
}else{
_mags = getArray( configFile >> "CfgWeapons" >> _currentWeapon >> "magazines" );
};
_compatibleMags = _compatibleMags + _mags;
}forEach getArray( configFile >> "CfgWeapons" >> _currentWeapon >> "muzzles" );
{
if ( _x in _compatibleMags ) then {
_this removeMagazine _x;
}
} forEach magazines _this;

sleep 0.2;


//Replace Katiba
If ( _currentWeapon == "arifle_Katiba_F" ) then {

// CODE SEARCH MAGAZINE //
_index = [_magazinesArray, "30Rnd_65x39_caseless_green", 0] call Zen_ArrayGetNestedIndex;
_magazineName = (_magazinesArray select _index) select 0;
_magazineAmount = (_magazinesArray select _index) select 1;

// FOUNDED - ADD AMMO //
_this addMagazines [_replacefor_Ammo select 0, 1];
_this addMagazines [_replacefor_Ammo select 0 ,_magazineAmount];

_this addweapon _replacefor_Katiba;
{_this addPrimaryWeaponItem _x} forEach _getItems;

};

/*
If ( _currentWeapon == "arifle_Katiba_C_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
if (magazines _this find "30Rnd_65x39_caseless_green" >= 0) then {
_magazines = {_x == "30Rnd_65x39_caseless_green"} count magazines _this;
_this addMagazines [_newAmmo ,_magazines];
};
_this addweapon _newWeapon;
{_this addPrimaryWeaponItem _x} forEach _getItems;
};

If ( _currentWeapon == "arifle_Katiba_GL_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
if (magazines _this find "30Rnd_65x39_caseless_green" >= 0) then {
_magazines = {_x == "30Rnd_65x39_caseless_green"} count magazines _this;
_this addMagazines [_newAmmo ,_magazines];
};
_this addweapon _newWeapon;
{_this addPrimaryWeaponItem _x} forEach _getItems;
};

If ( _currentWeapon == "LMG_Zafir_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
if (magazines _this find "30Rnd_65x39_caseless_green" >= 0) then {
_magazines = {_x == "30Rnd_65x39_caseless_green"} count magazines _this;
_this addMagazines [_newAmmo ,_magazines];
};
_this addweapon _newWeapon;
{_this addPrimaryWeaponItem _x} forEach _getItems;
};

If ( _currentWeapon == "srifle_DMR_01_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
if (magazines _this find "30Rnd_65x39_caseless_green" >= 0) then {
_magazines = {_x == "30Rnd_65x39_caseless_green"} count magazines _this;
_this addMagazines [_newAmmo ,_magazines];
};
_this addweapon _newWeapon;
{_this addPrimaryWeaponItem _x} forEach _getItems;
};

If ( _currentWeapon == "srifle_GM6_F" ) then {
_newWeapon = _replacefor_Katiba select 0 ;
_newAmmo = _replacefor_Katiba select 1 ;
if (magazines _this find "30Rnd_65x39_caseless_green" >= 0) then {
_magazines = {_x == "30Rnd_65x39_caseless_green"} count magazines _this;
_this addMagazines [_newAmmo ,_magazines];
};
_this addweapon _newWeapon;
{_this addPrimaryWeaponItem _x} forEach _getItems;
};
*/

Share this post


Link to post
Share on other sites

Is it possible to use something like this replace all the weapons in the original Arma 3 SP campaign missions (including enemy and AI's)?

 

I'd like to be able to replace the fictional weapons with real world alternatives from a mod (eg. MX = M4, MXSW = M249, MK200 = Mk48, Katiba = AK74, etc)

Share this post


Link to post
Share on other sites

Another update

The script is broken for some reason i dont know. Here:
 

If ( _currentWeapon == "arifle_Katiba_F" ) then {

// CODE SEARCH MAGAZINE //
_countArrayIndex = 0;
{
_index = [_magazinesArray, _x, 0] call Zen_ArrayGetNestedIndex;

// FOUNDED - ADD AMMO //
if (_index >= 0) then {
_magazineName = (_magazinesArray select _index) select 0;
_magazineAmount = (_magazinesArray select _index) select 1;
_this addMagazines [_replacefor_Ammo select _countArrayIndex ,_magazineAmount];
};

_countArrayIndex = _countArrayIndex + 1;

} forEach _replaceAmmoIndex;

_this addMagazines [_replacefor_Ammo select 0, 1];

_this addweapon _replacefor_Katiba;
{_this addPrimaryWeaponItem _x} forEach _getItems;
_this forceWeaponFire [_replacefor_Katiba, "Single"];
};



I got this message: Error Undefined variable in expression: zen_arraygetnestedindex
I changed something and the script stopped =/

Share this post


Link to post
Share on other sites

 

For now don't. Maybe later when the script is finished i will try to use it on a mod :)
Stay tune :P

If you want that mod replaces default weapon but you dont have any configuration:

http://forums.bistudio.com/showthread.php?189122-All-The-Weapons

 

 

Thanks flymaker. Unfortunately that one just randomly assigns different weapons all the time without any control over them. I was hoping to specify or control which weapons replace the original Arma3 ones.

 

For example, MX always gets replaced with an M4, MX w/ grenade launcher always gets replaced with an M4 w/ M203, MXM always gets replaced with a Mk12 SPR 9or M16A4 w/ ACOG), MXSW always gets replaced with a M249 SAW, etc.

Share this post


Link to post
Share on other sites

I'm trying to convert this script in Addon. For now i dont know how to execute it to all units =/

Here is what i'm make until now:
 

class CfgPatches
{
class FLY_ChangeWeapons
{
units[] = {};
weapons[] = {};
requiredVersion = 1.0;
requiredAddons[] = {"Extended_EventHandlers"};


};
};


class Extended_PostInit_EventHandlers
{


FLY_ChangeWeapons_Post_Init = "_handle = {[_x] execVM ""\FLY_ChangeWeapons\equip_change.sqf""} forEach allUnits";


};

I dont know if forEach works inside a CPP file. This code is not working =/

I tried to move this forEach to the script but dont work too.

// Replace CSAT Weapons Script

private ["_replacefor_Katiba", "_replacefor_KatibaGL", "_replacefor_KatibaC", "_replacefor_Zafir", "_replacefor_Rahim", "_replacefor_Lynx", "_replacefor_Sting", "_replacefor_Zubr", "_replacefor_Rook", "_replacefor_Ammo", "_replaceAmmoIndex", "_moreReplaceAmmo", "_replaceWeaponIndex", "_function", "_getItems", "_currentWeapon", "_magazinesArray", "_compatibleMags"
, "_countArrayIndex", "_index", "_magazineName", "_magazineAmount"];

// Put desire Weapon/Ammo Classname to replace
_replacefor_Katiba = "hlc_rifle_ak12";
_replacefor_KatibaGL = "hlc_rifle_ak12GL";
_replacefor_KatibaC = "hlc_rifle_aku12";
_replacefor_Zafir = "hlc_rifle_RPK12";
_replacefor_Rahim = "srifle_DMR_04_F";
_replacefor_Lynx = "hlc_rifle_awcovert_BL";
_replacefor_Sting = "hlc_rifle_aku12";

/*Only Primary Weapons for now
_replacefor_Zubr = [""];
_replacefor_Rook = [""];
*/

// Dont leave any empty
/* AmmoArray = [
"MagazineKatiba",
"MagazineKatibaTracer",
"MagazineZafir",
"MagazineZafirTracer",
"MagazineRahin",
"MagazineLynx",
"MagazineLynxSpecial",
"MagazineSting",
"GLAmmo 1",
"GLAmmo 2",
"GLSmoke 1",
"GLSmoke 2",
"GLSmoke 3",
"GLSmoke 4"
]*/

_replacefor_Ammo = [
"hlc_30Rnd_545x39_B_AK",
"hlc_30Rnd_545x39_t_ak",
"hlc_60Rnd_545x39_t_rpk",
"hlc_60Rnd_545x39_t_rpk",
"10Rnd_127x54_Mag",
"hlc_5rnd_300WM_mk248_AWM",
"hlc_5rnd_300WM_AP_AWM",
"hlc_30Rnd_545x39_B_AK",
"hlc_VOG25_AK",
"nul",
"hlc_GRD_White",
"hlc_GRD_Red",
"hlc_GRD_green",
"hlc_GRD_yellow"
];

/* DO NOT EDIT BELLOW THIS LINE IF YOU DONT KNOW WHARE YOU DOING */

_replaceAmmoIndex = ["30Rnd_65x39_caseless_green","30Rnd_65x39_caseless_green_mag_Tracer","150Rnd_762x54_Box","150Rnd_762x54_Box_Tracer","10Rnd_762x51_Mag","5Rnd_127x108_Mag","5Rnd_127x108_APDS_Mag","30Rnd_9x21_Mag","1Rnd_HE_Grenade_shell","Blank","1Rnd_Smoke_Grenade_shell","1Rnd_SmokeRed_Grenade_shell","1Rnd_SmokeGreen_Grenade_shell","1Rnd_SmokeYellow_Grenade_shell"
];
_moreReplaceAmmo = ["10Rnd_93x64_DMR_05_Mag","10Rnd_762x51_Mag"];

_replaceWeaponIndex = ["arifle_Katiba_F","arifle_Katiba_GL_F","arifle_Katiba_C_F","LMG_Zafir_F","srifle_DMR_01_F","srifle_GM6_F","SMG_02_F"];

_function = execVM "\FLY_ChangeWeapons\Zen_ArrayGetNestedIndex.sqf";

waitUntil { scriptDone _function };

// Get Unit Current Weapon and remove

_getItems = primaryWeaponItems _this;
_currentWeapon = [primaryWeapon _this] call BIS_fnc_baseWeapon;
_this removeWeapon _currentWeapon;

_magazinesArray = magazines _this;
_magazinesArray = _magazinesArray call BIS_fnc_consolidateArray;

_compatibleMags = [];
{
_mags = [];
if ( _x != "this" ) then {
_mags = getArray( configFile >> "CfgWeapons" >> _currentWeapon >> _x >> "magazines" );
}else{
_mags = getArray( configFile >> "CfgWeapons" >> _currentWeapon >> "magazines" );
};
_compatibleMags = _compatibleMags + _mags;
}forEach getArray( configFile >> "CfgWeapons" >> _currentWeapon >> "muzzles" );
{
if ( _x in _compatibleMags ) then {
_this removeMagazine _x;
}
} forEach magazines _this;

{_this removeMagazines _x;} forEach _replaceAmmoIndex;
//{_this removeMagazines _x;} forEach _moreReplaceAmmo;

//Replace Katiba

If ( _currentWeapon == "arifle_Katiba_F" ) then {

// CODE SEARCH MAGAZINE //
_countArrayIndex = 0;
{

_index = [_magazinesArray, _x, 0] call Zen_ArrayGetNestedIndex;

// FOUNDED - ADD AMMO //
if (_index >= 0) then {
_magazineName = (_magazinesArray select _index) select 0;
_magazineAmount = (_magazinesArray select _index) select 1;
_this addMagazines [_replacefor_Ammo select _countArrayIndex ,_magazineAmount];
};

_countArrayIndex = _countArrayIndex + 1;

} forEach _replaceAmmoIndex;

_this addMagazines [_replacefor_Ammo select 0, 1];

_this addweapon _replacefor_Katiba;
{_this addPrimaryWeaponItem _x} forEach _getItems;
_this selectWeapon ( primaryWeapon _this );
};
If ( _currentWeapon == "arifle_Katiba_GL_F" ) then {

// CODE SEARCH MAGAZINE //
_countArrayIndex = 0;
{

_index = [_magazinesArray, _x, 0] call Zen_ArrayGetNestedIndex;

// FOUNDED - ADD AMMO //
if (_index >= 0) then {
_magazineName = (_magazinesArray select _index) select 0;
_magazineAmount = (_magazinesArray select _index) select 1;
_this addMagazines [_replacefor_Ammo select _countArrayIndex ,_magazineAmount];
};

_countArrayIndex = _countArrayIndex + 1;

} forEach _replaceAmmoIndex;

_this addMagazines [_replacefor_Ammo select 0, 1];

_this addweapon _replacefor_KatibaGL;
{_this addPrimaryWeaponItem _x} forEach _getItems;
_this selectWeapon ( primaryWeapon _this );
};
If ( _currentWeapon == "arifle_Katiba_C_F" ) then {

// CODE SEARCH MAGAZINE //
_countArrayIndex = 0;
{

_index = [_magazinesArray, _x, 0] call Zen_ArrayGetNestedIndex;

// FOUNDED - ADD AMMO //
if (_index >= 0) then {
_magazineName = (_magazinesArray select _index) select 0;
_magazineAmount = (_magazinesArray select _index) select 1;
_this addMagazines [_replacefor_Ammo select _countArrayIndex ,_magazineAmount];
};

_countArrayIndex = _countArrayIndex + 1;

} forEach _replaceAmmoIndex;

_this addMagazines [_replacefor_Ammo select 0, 1];

_this addweapon _replacefor_KatibaC;
{_this addPrimaryWeaponItem _x} forEach _getItems;
_this selectWeapon ( primaryWeapon _this );
};
If ( _currentWeapon == "LMG_Zafir_F" ) then {

// CODE SEARCH MAGAZINE //
_countArrayIndex = 0;
{
_index = [_magazinesArray, _x, 0] call Zen_ArrayGetNestedIndex;

// FOUNDED - ADD AMMO //
if (_index >= 0) then {
_magazineName = (_magazinesArray select _index) select 0;
_magazineAmount = (_magazinesArray select _index) select 1;
_this addMagazines [_replacefor_Ammo select _countArrayIndex ,_magazineAmount];
};

_countArrayIndex = _countArrayIndex + 1;

} forEach _replaceAmmoIndex;

_this addMagazines [_replacefor_Ammo select 0, 1];

_this addweapon _replacefor_Zafir;
{_this addPrimaryWeaponItem _x} forEach _getItems;
_this selectWeapon ( primaryWeapon _this );
};
If ( _currentWeapon == "srifle_DMR_01_F" ) then {

// CODE SEARCH MAGAZINE //
_countArrayIndex = 0;
{
_index = [_magazinesArray, _x, 0] call Zen_ArrayGetNestedIndex;

// FOUNDED - ADD AMMO //
if (_index >= 0) then {
_magazineName = (_magazinesArray select _index) select 0;
_magazineAmount = (_magazinesArray select _index) select 1;
_this addMagazines [_replacefor_Ammo select _countArrayIndex ,_magazineAmount];
};

_countArrayIndex = _countArrayIndex + 1;

} forEach _replaceAmmoIndex;

_this addMagazines [_replacefor_Ammo select 0, 1];

_this addweapon _replacefor_Rahim;
{_this addPrimaryWeaponItem _x} forEach _getItems;
_this selectWeapon ( primaryWeapon _this );
};
If ( _currentWeapon == "srifle_GM6_camo_F" ) then {

// CODE SEARCH MAGAZINE //
_countArrayIndex = 0;
{
_index = [_magazinesArray, _x, 0] call Zen_ArrayGetNestedIndex;

// FOUNDED - ADD AMMO //
if (_index >= 0) then {
_magazineName = (_magazinesArray select _index) select 0;
_magazineAmount = (_magazinesArray select _index) select 1;
_this addMagazines [_replacefor_Ammo select _countArrayIndex ,_magazineAmount];
};

_countArrayIndex = _countArrayIndex + 1;

} forEach _replaceAmmoIndex;

_this addMagazines [_replacefor_Ammo select 0, 1];

_this addweapon _replacefor_Lynx;
{_this addPrimaryWeaponItem _x} forEach _getItems;
_this selectWeapon ( primaryWeapon _this );
};
If ( _currentWeapon == "SMG_02_F" ) then {

// CODE SEARCH MAGAZINE //
_countArrayIndex = 0;
{
_index = [_magazinesArray, _x, 0] call Zen_ArrayGetNestedIndex;

// FOUNDED - ADD AMMO //
if (_index >= 0) then {
_magazineName = (_magazinesArray select _index) select 0;
_magazineAmount = (_magazinesArray select _index) select 1;
_this addMagazines [_replacefor_Ammo select _countArrayIndex ,_magazineAmount];
};

_countArrayIndex = _countArrayIndex + 1;

} forEach _replaceAmmoIndex;

_this addMagazines [_replacefor_Ammo select 0, 1];

_this addweapon _replacefor_Sting;
{_this addPrimaryWeaponItem _x} forEach _getItems;
_this selectWeapon ( primaryWeapon _this );
};

For now its just for OPFOR and NIArms but i want to create a userconfig to choose other weapons and sides.

Share this post


Link to post
Share on other sites


class Extended_PostInit_EventHandlers

{

class FLY_ChangeWeapons_Post_Init

{

init = "_handle = {[_x] execVM ""\FLY_ChangeWeapons\equip_change.sqf""} forEach allUnits;";

};

};

Share this post


Link to post
Share on other sites

Thx jshock now the script is running. But i have an error. This not happen on placed mission script

primaryWeaponItems: Type Array, expected object;

EDIT - My mistake, sorry. I already fixed :)

Share this post


Link to post
Share on other sites

Hi guys.

The script is running well but now i want to get values from userconfig folder. Something like that:

 

Script:

_replacefor_Katiba = userconfig_option1;
_replacefor_KatibaGL = userconfig_option2;

Userconfig File:

_replacefor_Katiba = "hlc_rifle_ak12";
_replacefor_KatibaGL = "hlc_rifle_ak12GL";

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  

×