Jump to content
jandrews

can anyone share a script for AI loadouts that loops for respawn?

Recommended Posts

I saw some others scripts already made however I would like specific loadouts for unit classes. My current script is not being read. May be some could share theirs or give me some advice.

 

Spoiler

//null = [] execVM "scripts\loadouts\Cobra_loadout.sqf";

_x = units;

switch (true) do {
//----------------------------------------------------------------------------------------------------
    case independent: {

//-------------------------squadleader
    if (typeOf _x == "I_Soldier_SL_F") then
        {
            null = [] execVM "scripts\loadouts\cobra_SL.sqf";
        };

//-------------------------teamleader
    if (typeOf _x == "I_Soldier_TL_F") then
        {
            null = [] execVM "scripts\loadouts\cobra_TL.sqf";
        };
//-------------------------AT
        if (typeOf _x == "I_Soldier_LAT_F") then
        {
            null = [] execVM "scripts\loadouts\cobra_AT.sqf";
        };
//-------------------------medic
    if (typeOf _x == "I_medic_F") then
        {
            null = [] execVM "scripts\loadouts\cobra_medic.sqf";
        };
//-------------------------sniper
    if (typeOf _x == "I_Soldier_exp_F") then
        {
            null = [] execVM "scripts\loadouts\cobra_sniper_v1.sqf";
        }
        else
        {
            null = [] execVM "scripts\loadouts\cobra_sniper_v2.sqf";
        };
//-------------------------spotter
    if (typeOf _x == "I_Spotter_F") then
        {
            null = [] execVM "scripts\loadouts\cobra_spotter.sqf";
        };
//-------------------------rifleman
    if (typeOf _x == "I_soldier_F") then
        {
            null = [] execVM "scripts\loadouts\cobra_rifle_v1.sqf";
        }
        else
        {
            null = [] execVM "scripts\loadouts\cobra_rifle_v2.sqf";
        };    
//-------------------------marksmen
    if (typeOf _x == "I_Soldier_M_F") then
        {
            null = [] execVM "scripts\loadouts\cobra_MMR_v1.sqf";
        }
        else
        {
            null = [] execVM "scripts\loadouts\cobra_MMR_v2.sqf";
        };
//-------------------------autorifleman
    if (typeOf _x == "I_Soldier_AR_F" ) then
        {
            null = [] execVM "scripts\loadouts\cobra_LMG.sqf";
        };
//-------------------------pilot
    if (typeOf _x == "I_pilot_F") then
        {
            null = [] execVM "scripts\loadouts\cobra_pilot.sqf";
        };
//-------------------------crewmen
    if (typeOf _x == "I_crew_F") then
        {
        null = [] execVM "scripts\loadouts\cobra_crewman.sqf";
        };
//------------------------commander        
        if (typeOf _x == "I_officer_F") then
        {
        null = [] execVM "scripts\loadouts\cobra_commander.sqf";
        };                     
    };
};

 

 

Thanks for your response.

 

Edit:  nope. thought i had it. didn't work 

Share this post


Link to post
Share on other sites

Quickly threw this together... Modify accordingly to your needs. Not tested!

[player] call TAG_fnc_loadouts;
params ["_unit"];

removeAllAssignedItems _unit;
removeAllItems _unit;
removeAllWeapons _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

switch (true) do
{
	case (side _unit isEqualTo blufor && {typeOf _unit in ["B_Story_Engineer_F", "B_engineer_F", "B_Patrol_Engineer_F", "B_CTRG_soldier_engineer_exp_F"]}) :
	{
		_unit forceAddUniform "";
		_unit addVest "";
		_unit addBackpackGlobal "";
		_unit addHeadgear "";
		_unit addMagazines ["", 2]; // magazine classname | amount of magazines
		_unit addWeaponGlobal "";
		_unit addHandgunItem "acc_flashlight_pistol";
		_unit addHandgunItem "muzzle_snds_acp";
	};
	case (typeOf _unit in ["B_medic_F", "O_medic_F", "I_medic_F"]) :
	{
		if (side _unit isEqualTo blufor) then
		{
			// blufor
		} else
		{
			if (side _unit isEqualTo opfor) then
			{
				// opfor
			} else
			{
				// independent
			};
		};
	};
};

{
	_unit addItem _x;
	_unit assignItem _x;
} forEach
[
	"ItemMap",
	"ItemRadio",
	"ItemCompass",
	"ItemWatch"
];

 

Share this post


Link to post
Share on other sites

HazJ got you an answer for (wich it is rigth, now you need to do somechanges like the classname in the line <typeOf _unit in ["B_Story_Engineer_F", "B_engineer_F"...]> of a unit and whatever you want to add as for example a _unit addweapon.....). But i got you a question. Arent you asking for the map preload rol?, i mean like in apex campaign when you die, you can choose your rol. If it is this way you can use BIS_fnc_addRespawnInventory; which is a little similar to HazJ

 

Share this post


Link to post
Share on other sites

Huh??? Finding it difficult to understand you... The OP didn't ask for that. That being, respawn loadout selection.

Share this post


Link to post
Share on other sites
Just now, HazJ said:

Huh??? Finding it difficult to understand you... The OP didn't ask for that. That being, respawn loadout selection.

Sorry LOL, i missed the AI word by the way. 

Share this post


Link to post
Share on other sites

Yeah, you also added some words... :rofl:

Share this post


Link to post
Share on other sites
3 hours ago, HazJ said:

Quickly threw this together... Modify accordingly to your needs. Not tested!


[player] call TAG_fnc_loadouts;

params ["_unit"];

removeAllAssignedItems _unit;
removeAllItems _unit;
removeAllWeapons _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

switch (true) do
{
	case (side _unit isEqualTo blufor && {typeOf _unit in ["B_Story_Engineer_F", "B_engineer_F", "B_Patrol_Engineer_F", "B_CTRG_soldier_engineer_exp_F"]}) :
	{
		_unit forceAddUniform "";
		_unit addVest "";
		_unit addBackpackGlobal "";
		_unit addHeadgear "";
		_unit addMagazines ["", 2]; // magazine classname | amount of magazines
		_unit addWeaponGlobal "";
		_unit addHandgunItem "acc_flashlight_pistol";
		_unit addHandgunItem "muzzle_snds_acp";
	};
	case (typeOf _unit in ["B_medic_F", "O_medic_F", "I_medic_F"]) :
	{
		if (side _unit isEqualTo blufor) then
		{
			// blufor
		} else
		{
			if (side _unit isEqualTo opfor) then
			{
				// opfor
			} else
			{
				// independent
			};
		};
	};
};

{
	_unit addItem _x;
	_unit assignItem _x;
} forEach
[
	"ItemMap",
	"ItemRadio",
	"ItemCompass",
	"ItemWatch"
];

 

Hey thanks hazj.

 

Just want to make sure, these loadouts are from arsenal / export / clipboard.  So will that be any different then whaymt you already stated?  I presume just paste in:

 

switch (true) do {

case (side _unit isEqualTo independent && {typeOf _unit "I_engineer_F" }) :

 

{ blah };

 

case (side _unit isEqualTo independent && {typeOf _unit is "I_medic_F" }) :

 

{ blah} else {blah}; 

 

};

and do this for each unit type?

Share this post


Link to post
Share on other sites

Copy case block, adjust unit types classname(s) and add your own classnames in.

Share this post


Link to post
Share on other sites
4 hours ago, HazJ said:

Copy case block, adjust unit types classname(s) and add your own classnames in.

 

Hey man,

I did mention this for enemy AI right? Anyway since this is do I need to place "player" in the [] on the call line? And can I just call this script in the initServer?

 

[] call Cobra_fnc_loadouts;
Spoiler


params ["_unit"];

removeAllAssignedItems _unit;
removeAllItems _unit;
removeAllWeapons _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

switch (true) do
{
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_medic_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit03";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 7 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 5 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	this addBackpack "B_FieldPack_blk";
	for "_i" from 1 to 10 do {this addItemToBackpack "FirstAidKit";};
	this addItemToBackpack "Medikit";
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	this addHeadgear "cobra_scho";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Soldier_SL_F")]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit03";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	for "_i" from 1 to 4 do {this addItemToVest "1Rnd_SmokeBlue_Grenade_shell";};
	for "_i" from 1 to 4 do {this addItemToVest "1Rnd_HE_Grenade_shell";};
	this addBackpack "B_FieldPack_blk";
	for "_i" from 1 to 3 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 8 do {this addItemToBackpack "30Rnd_762x39_Mag_F";};
	for "_i" from 1 to 3 do {this addItemToBackpack "1Rnd_HE_Grenade_shell";};
	for "_i" from 1 to 3 do {this addItemToBackpack "1Rnd_SmokeBlue_Grenade_shell";};
	this addHeadgear "cobra_scho";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_GL_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	this addWeapon "Binocular";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in "I_Soldier_TL_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit03";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 5 do {this addItemToUniform "30Rnd_65x39_caseless_green";};
	for "_i" from 1 to 3 do {this addItemToUniform "1Rnd_SmokeBlue_Grenade_shell";};
	for "_i" from 1 to 3 do {this addItemToUniform "1Rnd_HE_Grenade_shell";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 5 do {this addItemToVest "30Rnd_65x39_caseless_green";};
	for "_i" from 1 to 3 do {this addItemToVest "1Rnd_HE_Grenade_shell";};
	for "_i" from 1 to 6 do {this addItemToVest "1Rnd_SmokeBlue_Grenade_shell";};
	this addBackpack "B_FieldPack_blk";
	for "_i" from 1 to 4 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 4 do {this addItemToBackpack "30Rnd_65x39_caseless_green";};
	for "_i" from 1 to 4 do {this addItemToBackpack "1Rnd_HE_Grenade_shell";};
	for "_i" from 1 to 3 do {this addItemToBackpack "1Rnd_SmokeBlue_Grenade_shell";};
	this addHeadgear "cobra_scho";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_Katiba_GL_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	this addWeapon "Binocular";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Soldier_LAT_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit03";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 7 do {this addItemToBackpack "FirstAidKit";};
	this addItemToBackpack "Medikit";
	for "_i" from 1 to 3 do {this addItemToBackpack "RPG32_HE_F";};
	this addHeadgear "cobra_scho";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	this addWeapon "launch_RPG32_F";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Soldier_GL_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 2 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 5 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 2 do {this addItemToVest "1Rnd_HE_Grenade_shell";};
	for "_i" from 1 to 5 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 4 do {this addItemToBackpack "SmokeShellBlue";};
	for "_i" from 1 to 10 do {this addItemToBackpack "1Rnd_HE_Grenade_shell";};
	for "_i" from 1 to 6 do {this addItemToBackpack "1Rnd_SmokeBlue_Grenade_shell";};
	for "_i" from 1 to 4 do {this addItemToBackpack "30Rnd_762x39_Mag_F";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_GL_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Soldier_A_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 2 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 7 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	this addBackpack "B_ViperLightHarness_blk_F";
	for "_i" from 1 to 8 do {this addItemToBackpack "30Rnd_762x39_Mag_F";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 4 do {this addItemToBackpack "SmokeShellBlue";};
	this addItemToBackpack "RPG32_HE_F";
	this addItemToBackpack "130Rnd_338_Mag";
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Sniper_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit01";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "5Rnd_127x108_Mag";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToVest "5Rnd_127x108_APDS_Mag";};
	for "_i" from 1 to 3 do {this addItemToVest "5Rnd_127x108_Mag";};
	this addBackpack "B_ViperLightHarness_blk_F";
	for "_i" from 1 to 4 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 4 do {this addItemToBackpack "SmokeShellBlue";};
	for "_i" from 1 to 3 do {this addItemToBackpack "5Rnd_127x108_Mag";};
	for "_i" from 1 to 3 do {this addItemToBackpack "5Rnd_127x108_APDS_Mag";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "srifle_GM6_F";
	this addPrimaryWeaponItem "optic_LRPS";
	this addWeapon "Binocular";
	}
	else
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit01";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "7Rnd_408_Mag";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 5 do {this addItemToVest "7Rnd_408_Mag";};
	this addBackpack "B_ViperLightHarness_blk_F";
	for "_i" from 1 to 4 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 6 do {this addItemToBackpack "7Rnd_408_Mag";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 4 do {this addItemToBackpack "SmokeShellBlue";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "srifle_LRR_F";
	this addPrimaryWeaponItem "optic_LRPS";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Spotter_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 5 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 2 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	this addBackpack "B_FieldPack_blk";
	for "_i" from 1 to 5 do {this addItemToBackpack "30Rnd_762x39_Mag_F";};
	for "_i" from 1 to 3 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 5 do {this addItemToBackpack "SmokeShellBlue";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	this addWeapon "Rangefinder";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_soldier_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 2 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 7 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 8 do {this addItemToBackpack "30Rnd_762x39_Mag_F";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 4 do {this addItemToBackpack "SmokeShellBlue";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	}
	else
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "30Rnd_65x39_caseless_green";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToVest "30Rnd_65x39_caseless_green";};
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 4 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToBackpack "30Rnd_65x39_caseless_green";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 3 do {this addItemToBackpack "SmokeShellBlue";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_ARX_blk_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Soldier_M_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "20Rnd_762x51_Mag";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToVest "20Rnd_762x51_Mag";};
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 3 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 6 do {this addItemToBackpack "20Rnd_762x51_Mag";};
	for "_i" from 1 to 3 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 3 do {this addItemToBackpack "SmokeShellBlue";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_SPAR_03_blk_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_DMS";
	}
	else
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 5 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "10Rnd_93x64_DMR_05_Mag";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 4 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 6 do {this addItemToVest "10Rnd_93x64_DMR_05_Mag";};
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 3 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToBackpack "10Rnd_93x64_DMR_05_Mag";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 3 do {this addItemToBackpack "SmokeShellBlue";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "srifle_DMR_05_blk_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_DMS";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Soldier_AR_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit01";
	for "_i" from 1 to 4 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "130Rnd_338_Mag";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 2 do {this addItemToVest "FirstAidKit";};
	this addItemToVest "130Rnd_338_Mag";
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 4 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToBackpack "130Rnd_338_Mag";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "MMG_02_black_F";
	this addPrimaryWeaponItem "optic_MRCO";
	this addPrimaryWeaponItem "bipod_01_F_blk";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_pilot_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "U_I_pilotCoveralls";
	for "_i" from 1 to 3 do {this addItemToUniform "9Rnd_45ACP_Mag";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "hgun_ACPC2_F";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in "I_crew_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 3 do {this addItemToUniform "9Rnd_45ACP_Mag";};
	this addVest "V_LegStrapBag_black_F";
	this addBackpack "B_LegStrapBag_black_F";
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "hgun_ACPC2_F";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_officer_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit03";
	for "_i" from 1 to 3 do {this addItemToUniform "9Rnd_45ACP_Mag";};
	for "_i" from 1 to 2 do {this addItemToUniform "FirstAidKit";};
	this addItemToUniform "1Rnd_SmokeBlue_Grenade_shell";
	this addVest "V_PlateCarrier1_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToVest "1Rnd_HE_Grenade_shell";};
	for "_i" from 1 to 6 do {this addItemToVest "1Rnd_SmokeBlue_Grenade_shell";};
	this addHeadgear "H_HelmetSpecO_blk";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "hgun_ACPC2_F";
	this addWeapon "Binocular";
	};
};
{
	_unit addItem _x;
	_unit assignItem _x;
} forEach
[
	"ItemMap",
	"ItemRadio",
	"ItemCompass",
	"ItemWatch",
	"ItemGPS"
];

 

Thanks for the help.

Share this post


Link to post
Share on other sites
16 hours ago, jandrews said:

AI loadouts that loops for respawn

How exactly are your AI units respawning? AI do not respawn (handled by the engine like players) and require a script or some module that recreates them, of which you would be better of using any available method from, to run the loadout code on these newly spawned AI.

 

16 hours ago, jandrews said:

My current script is not being read.

You have some errors in there.

 

16 hours ago, jandrews said:

_x = units;

switch (true) do {
//----------------------------------------------------------------------------------------------------
    case independent: {

//-------------------------squadleader
    if (typeOf _x == "I_Soldier_SL_F") then

 

units needs to be followed by a GROUP or UNIT, and returns the units of said group or units group.

_x would be an ARRAY of units. typeOf ARRAY, is incorrect syntax.

A switch statement (true) and a case statement (independent) have to match for that case to be executed. A SIDE does not, and never could, match a BOOLEAN.

{
	_unit = _x;
	
	//Find case statements that are true
	switch (true) do {
	
		//Does this match the switch statement
		case ( side _unit isEqualTo independent ) : { //TRUE or FALSE
	
			//squadleader
			if (typeOf _unit == "I_Soldier_SL_F") then
			{
				//Pass the unit to the script so you can use it to
				//add or remove inventory from within the script
				null = [ _unit ] execVM "scripts\loadouts\cobra_SL.sqf";
			};
		
		};
	};
}forEach ( allUnits - allPlayers ); //For each alive AI unit

Not particularly a solution for you, more to help you understand why your code was not working. Hope it helps.

  • Like 2

Share this post


Link to post
Share on other sites

Depends on how you create enemy.

Eden Editor init of enemy AI:

0 = [this] call Cobra_fnc_loadouts;

AI spawning script may vary.

Share this post


Link to post
Share on other sites

@Larrow

Hey.  Thanks for taking the time to explain that.  I am a noob at best with scripting and only learn by seeing how others have done.  This attempt is me trying to use arsenal exported loadouts to work from a more recent mod release.  I have googled this and try mostly to see what others have attempted.  And go from there.  Not much out there that I found.  

Thanks to hazj he pointed me in the direction.  I will still have more questions no doubt.

 

14 hours ago, HazJ said:

Depends on how you create enemy.

Eden Editor init of enemy AI:


0 = [this] call Cobra_fnc_loadouts;

AI spawning script may vary.

 

I spawn units in dynamically.  Like create a task and spawn everything that way.  One task at a time for frames.   Just not sure where to put that line with everything else.

Share this post


Link to post
Share on other sites

hiho

 

can you post your code that spawns the unit?

in a script you can add code to an individual unit or to all units of a group, it depends a little how u spawn them.

 

this is an example from my scripts, where i spawn AI and add code to their init same time.

even if you only spawn one unit, the code works, as all spawned units need to be in a group. this uses local variables only and can be used as often as your machine can manage fps wise.

 

//

_bandits1 = createGroup east;


"B_G_Survivor_F" createUnit [([getPosATL _Pos, 5, 15, 0, 0, 0.9, 0] call BIS_fnc_findSafePos), _bandits1, "", 1, "private"];};

 

{[_x] call VD_equipper;}forEach units _bandits1;

//
 

could probably be improved but it does the job for me.

 

happy to help if you need more info.

cheers

vd

Share this post


Link to post
Share on other sites

@Vandeanson

 

Hey...  I am away from my main pc for a few days.  So I can only post a generic example.  But when I spawn units in I basically use this...once I get back I can post a more detailed version if needed.

I typically have several units to spawn with vehicles.

 

_group = createGroup west;

_units = [];

 

for "_i" from 1 to 6 do { _grp = [_markerPos, _side, (configfile >> "CfgGroups" >> "West" >> "Guerilla" >> "Infantry" >> "IRG_InfAssault")] call BIS_fnc_spawnGroup;

 

 With some task, patrol, defend, attack, occupy house.

 

It's usually 4-6 blocks of code so not sure where to call cobra_fnc_loadouts script.

Share this post


Link to post
Share on other sites
On 11/20/2018 at 5:57 PM, jandrews said:

 

Hey man,

I did mention this for enemy AI right? Anyway since this is do I need to place "player" in the [] on the call line? And can I just call this script in the initServer?

 


[] call Cobra_fnc_loadouts;
  Reveal hidden contents



params ["_unit"];

removeAllAssignedItems _unit;
removeAllItems _unit;
removeAllWeapons _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

switch (true) do
{
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_medic_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit03";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 7 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 5 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	this addBackpack "B_FieldPack_blk";
	for "_i" from 1 to 10 do {this addItemToBackpack "FirstAidKit";};
	this addItemToBackpack "Medikit";
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	this addHeadgear "cobra_scho";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Soldier_SL_F")]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit03";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	for "_i" from 1 to 4 do {this addItemToVest "1Rnd_SmokeBlue_Grenade_shell";};
	for "_i" from 1 to 4 do {this addItemToVest "1Rnd_HE_Grenade_shell";};
	this addBackpack "B_FieldPack_blk";
	for "_i" from 1 to 3 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 8 do {this addItemToBackpack "30Rnd_762x39_Mag_F";};
	for "_i" from 1 to 3 do {this addItemToBackpack "1Rnd_HE_Grenade_shell";};
	for "_i" from 1 to 3 do {this addItemToBackpack "1Rnd_SmokeBlue_Grenade_shell";};
	this addHeadgear "cobra_scho";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_GL_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	this addWeapon "Binocular";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in "I_Soldier_TL_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit03";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 5 do {this addItemToUniform "30Rnd_65x39_caseless_green";};
	for "_i" from 1 to 3 do {this addItemToUniform "1Rnd_SmokeBlue_Grenade_shell";};
	for "_i" from 1 to 3 do {this addItemToUniform "1Rnd_HE_Grenade_shell";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 5 do {this addItemToVest "30Rnd_65x39_caseless_green";};
	for "_i" from 1 to 3 do {this addItemToVest "1Rnd_HE_Grenade_shell";};
	for "_i" from 1 to 6 do {this addItemToVest "1Rnd_SmokeBlue_Grenade_shell";};
	this addBackpack "B_FieldPack_blk";
	for "_i" from 1 to 4 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 4 do {this addItemToBackpack "30Rnd_65x39_caseless_green";};
	for "_i" from 1 to 4 do {this addItemToBackpack "1Rnd_HE_Grenade_shell";};
	for "_i" from 1 to 3 do {this addItemToBackpack "1Rnd_SmokeBlue_Grenade_shell";};
	this addHeadgear "cobra_scho";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_Katiba_GL_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	this addWeapon "Binocular";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Soldier_LAT_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit03";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 7 do {this addItemToBackpack "FirstAidKit";};
	this addItemToBackpack "Medikit";
	for "_i" from 1 to 3 do {this addItemToBackpack "RPG32_HE_F";};
	this addHeadgear "cobra_scho";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	this addWeapon "launch_RPG32_F";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Soldier_GL_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 2 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 5 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 2 do {this addItemToVest "1Rnd_HE_Grenade_shell";};
	for "_i" from 1 to 5 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 4 do {this addItemToBackpack "SmokeShellBlue";};
	for "_i" from 1 to 10 do {this addItemToBackpack "1Rnd_HE_Grenade_shell";};
	for "_i" from 1 to 6 do {this addItemToBackpack "1Rnd_SmokeBlue_Grenade_shell";};
	for "_i" from 1 to 4 do {this addItemToBackpack "30Rnd_762x39_Mag_F";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_GL_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Soldier_A_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 2 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 7 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	this addBackpack "B_ViperLightHarness_blk_F";
	for "_i" from 1 to 8 do {this addItemToBackpack "30Rnd_762x39_Mag_F";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 4 do {this addItemToBackpack "SmokeShellBlue";};
	this addItemToBackpack "RPG32_HE_F";
	this addItemToBackpack "130Rnd_338_Mag";
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Sniper_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit01";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "5Rnd_127x108_Mag";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToVest "5Rnd_127x108_APDS_Mag";};
	for "_i" from 1 to 3 do {this addItemToVest "5Rnd_127x108_Mag";};
	this addBackpack "B_ViperLightHarness_blk_F";
	for "_i" from 1 to 4 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 4 do {this addItemToBackpack "SmokeShellBlue";};
	for "_i" from 1 to 3 do {this addItemToBackpack "5Rnd_127x108_Mag";};
	for "_i" from 1 to 3 do {this addItemToBackpack "5Rnd_127x108_APDS_Mag";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "srifle_GM6_F";
	this addPrimaryWeaponItem "optic_LRPS";
	this addWeapon "Binocular";
	}
	else
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit01";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "7Rnd_408_Mag";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 5 do {this addItemToVest "7Rnd_408_Mag";};
	this addBackpack "B_ViperLightHarness_blk_F";
	for "_i" from 1 to 4 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 6 do {this addItemToBackpack "7Rnd_408_Mag";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 4 do {this addItemToBackpack "SmokeShellBlue";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "srifle_LRR_F";
	this addPrimaryWeaponItem "optic_LRPS";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Spotter_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 5 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 2 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	this addBackpack "B_FieldPack_blk";
	for "_i" from 1 to 5 do {this addItemToBackpack "30Rnd_762x39_Mag_F";};
	for "_i" from 1 to 3 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 5 do {this addItemToBackpack "SmokeShellBlue";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	this addWeapon "Rangefinder";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_soldier_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 2 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToUniform "30Rnd_762x39_Mag_F";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 7 do {this addItemToVest "30Rnd_762x39_Mag_F";};
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 8 do {this addItemToBackpack "30Rnd_762x39_Mag_F";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 4 do {this addItemToBackpack "SmokeShellBlue";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_AK12_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	}
	else
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "30Rnd_65x39_caseless_green";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToVest "30Rnd_65x39_caseless_green";};
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 4 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToBackpack "30Rnd_65x39_caseless_green";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 3 do {this addItemToBackpack "SmokeShellBlue";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_ARX_blk_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_MRCO";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Soldier_M_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 3 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "20Rnd_762x51_Mag";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToVest "20Rnd_762x51_Mag";};
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 3 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 6 do {this addItemToBackpack "20Rnd_762x51_Mag";};
	for "_i" from 1 to 3 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 3 do {this addItemToBackpack "SmokeShellBlue";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "arifle_SPAR_03_blk_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_DMS";
	}
	else
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 5 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "10Rnd_93x64_DMR_05_Mag";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 4 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 6 do {this addItemToVest "10Rnd_93x64_DMR_05_Mag";};
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 3 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 4 do {this addItemToBackpack "10Rnd_93x64_DMR_05_Mag";};
	for "_i" from 1 to 4 do {this addItemToBackpack "MiniGrenade";};
	for "_i" from 1 to 3 do {this addItemToBackpack "SmokeShellBlue";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "srifle_DMR_05_blk_F";
	this addPrimaryWeaponItem "acc_flashlight";
	this addPrimaryWeaponItem "optic_DMS";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_Soldier_AR_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit01";
	for "_i" from 1 to 4 do {this addItemToUniform "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToUniform "130Rnd_338_Mag";};
	this addVest "V_Chestrig_blk";
	for "_i" from 1 to 2 do {this addItemToVest "FirstAidKit";};
	this addItemToVest "130Rnd_338_Mag";
	this addBackpack "B_ViperHarness_blk_F";
	for "_i" from 1 to 4 do {this addItemToBackpack "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToBackpack "130Rnd_338_Mag";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "MMG_02_black_F";
	this addPrimaryWeaponItem "optic_MRCO";
	this addPrimaryWeaponItem "bipod_01_F_blk";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_pilot_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "U_I_pilotCoveralls";
	for "_i" from 1 to 3 do {this addItemToUniform "9Rnd_45ACP_Mag";};
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "hgun_ACPC2_F";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in "I_crew_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit02";
	for "_i" from 1 to 3 do {this addItemToUniform "9Rnd_45ACP_Mag";};
	this addVest "V_LegStrapBag_black_F";
	this addBackpack "B_LegStrapBag_black_F";
	this addHeadgear "cobra_sche";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "hgun_ACPC2_F";
	};
	
	case (side _unit isEqualTo independent && {typeOf _unit in ["I_officer_F"]}) :
	{
	comment "Add containers";
	this forceAddUniform "cobra_troop_kit03";
	for "_i" from 1 to 3 do {this addItemToUniform "9Rnd_45ACP_Mag";};
	for "_i" from 1 to 2 do {this addItemToUniform "FirstAidKit";};
	this addItemToUniform "1Rnd_SmokeBlue_Grenade_shell";
	this addVest "V_PlateCarrier1_blk";
	for "_i" from 1 to 3 do {this addItemToVest "FirstAidKit";};
	for "_i" from 1 to 3 do {this addItemToVest "1Rnd_HE_Grenade_shell";};
	for "_i" from 1 to 6 do {this addItemToVest "1Rnd_SmokeBlue_Grenade_shell";};
	this addHeadgear "H_HelmetSpecO_blk";
	this addGoggles "G_Balaclava_TI_blk_F";

	comment "Add weapons";
	this addWeapon "hgun_ACPC2_F";
	this addWeapon "Binocular";
	};
};
{
	_unit addItem _x;
	_unit assignItem _x;
} forEach
[
	"ItemMap",
	"ItemRadio",
	"ItemCompass",
	"ItemWatch",
	"ItemGPS"
];

 

Thanks for the help.

 

Here is a basic example of my unit spawn. 

 

_side = createCenter independent;
_markerPos = getMarkerPos (_this select 0);
_units = [];

if(!isServer) exitWith{};

for "_i" from 1 to 3 do {
    _grp = [_markerPos, _side, (configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> "HAF_InfTeam"),[],[],[],[],[],(random (360))] call BIS_fnc_spawnGroup;
    [_grp,_markerPos,(random(150)+50)] call BIS_fnc_taskPatrol;
	{_units pushBack _x} forEach units _grp;
};
for "_i" from 1 to 3 do {
    _grp = [_markerPos, _side, (configfile >> "CfgGroups" >> "West" >> "Guerilla" >> "Infantry" >> "IRG_InfSentry"),[],[],[],[],[],(random (360))] call BIS_fnc_spawnGroup;
    [_grp,_markerPos,(random(150)+50)] call BIS_fnc_taskPatrol;
	{_units pushBack _x} forEach units _grp;
};
_units;

Just wondering where I could place the [] call Cobra_fnc_loadouts; line to have AI custom loadouts in place of standard?

 

In hidden drop down is the custom loadouts code.

 

Thanks

Share this post


Link to post
Share on other sites

Don't think BIS_fnc_spawnGroup has any init argument so maybe something like:

{
	0 = [_x] call Cobra_fnc_loadouts;
} forEach units _grp; // or _units
// You can also merge the above with your existing forEach

Don't forget to define the function in CfgFunctions, etc...

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

×