Jump to content
Sign in to follow this  
TEFLON DON

How to add custom units into existing factions as an addon?

Recommended Posts

Hi, I'm wondering how to add custom made units into the factions already in game. I have the gear load out made for them in the virtual arsenal, now it's just a matter of making it an add on that people can download. I've looked around for guides, they're usually all pertaining to custom gear set-ups which isn't needed anymore due to the virtual arsenal.

 

thanks.

Share this post


Link to post
Share on other sites

As far as I know it's not possible to use Arsenal presets as an unit type.

 

The only way to do this is by creating the (new) unit in CfgVehicles with the modified gear (as described at https://community.bistudio.com/wiki/Arma_3_Characters_And_Gear_Encoding_Guide#Character_configuration).

 

eg.

// Character classes are defined under cfgVehicles.
class cfgVehicles
{
    // Base class (unit class of other mod)
    class OtherMod_soldier;
    // Your class (unit class of your mod, which extends the other unit class)
    class YourMod_soldier: OtherMod_soldier
    {
        // The name of the author of the asset, which is displayed in the editor.
        author = "Your Name";
        // The name of the soldier, which is displayed in the editor.
        displayName = "New Soldier";
        // Which backpack the character is wearing.
        backpack = "B_Kitbag_mcamo_Eng";
        // Which weapons the character has.
        weapons[] = {arifle_MX_ACO_pointer_F, hgun_P07_F, Throw, Put};
        // Which weapons the character respawns with.
        respawnWeapons[] = {arifle_MX_ACO_pointer_F, hgun_P07_F, Throw, Put};
        // Which items the character has.
        Items[] = {FirstAidKit};
        // Which items the character respawns with.
        RespawnItems[] = {FirstAidKit};
        // What ammunition the character has.
        magazines[] = {mag_10(30Rnd_65x39_caseless_mag),mag_3(16Rnd_9x21_Mag), SmokeShell, SmokeShellGreen, Chemlight_green, Chemlight_green, mag_2(HandGrenade)};
        // What ammunition the character respawns with.
        respawnMagazines[] = {mag_10(30Rnd_65x39_caseless_mag),mag_3(16Rnd_9x21_Mag), SmokeShell, SmokeShellGreen, Chemlight_green, Chemlight_green ,mag_2(HandGrenade)};
        // Which items the character has.
        linkedItems[] = {V_PlateCarrier1_rgr, H_HelmetB, ItemMap, ItemCompass, ItemWatch, ItemRadio, NVGoggles};
        // Which items the character respawns with.
        respawnLinkedItems[] = {V_PlateCarrier1_rgr, H_HelmetB, ItemMap, ItemCompass, ItemWatch, ItemRadio, NVGoggles};
    };
};

It might be possible to use the 'init' variable to execute a script (instead of setting the weapons/items/gear), other this isn't prefered since it causes lag every time an unit spawns.

Share this post


Link to post
Share on other sites

As far as I know it's not possible to use Arsenal presets as an unit type.

 

The only way to do this is by creating the (new) unit in CfgVehicles with the modified gear (as described at https://community.bistudio.com/wiki/Arma_3_Characters_And_Gear_Encoding_Guide#Character_configuration).

 

eg.

// Character classes are defined under cfgVehicles.
class cfgVehicles
{
    // Base class (unit class of other mod)
    class OtherMod_soldier;
    // Your class (unit class of your mod, which extends the other unit class)
    class YourMod_soldier: OtherMod_soldier
    {
        // The name of the author of the asset, which is displayed in the editor.
        author = "Your Name";
        // The name of the soldier, which is displayed in the editor.
        displayName = "New Soldier";
        // Which backpack the character is wearing.
        backpack = "B_Kitbag_mcamo_Eng";
        // Which weapons the character has.
        weapons[] = {arifle_MX_ACO_pointer_F, hgun_P07_F, Throw, Put};
        // Which weapons the character respawns with.
        respawnWeapons[] = {arifle_MX_ACO_pointer_F, hgun_P07_F, Throw, Put};
        // Which items the character has.
        Items[] = {FirstAidKit};
        // Which items the character respawns with.
        RespawnItems[] = {FirstAidKit};
        // What ammunition the character has.
        magazines[] = {mag_10(30Rnd_65x39_caseless_mag),mag_3(16Rnd_9x21_Mag), SmokeShell, SmokeShellGreen, Chemlight_green, Chemlight_green, mag_2(HandGrenade)};
        // What ammunition the character respawns with.
        respawnMagazines[] = {mag_10(30Rnd_65x39_caseless_mag),mag_3(16Rnd_9x21_Mag), SmokeShell, SmokeShellGreen, Chemlight_green, Chemlight_green ,mag_2(HandGrenade)};
        // Which items the character has.
        linkedItems[] = {V_PlateCarrier1_rgr, H_HelmetB, ItemMap, ItemCompass, ItemWatch, ItemRadio, NVGoggles};
        // Which items the character respawns with.
        respawnLinkedItems[] = {V_PlateCarrier1_rgr, H_HelmetB, ItemMap, ItemCompass, ItemWatch, ItemRadio, NVGoggles};
    };
};

It might be possible to use the 'init' variable to execute a script (instead of setting the weapons/items/gear), other this isn't prefered since it causes lag every time an unit spawns.

 

 

Dirty method example with arsenal and randomization:

class CfgPatches {
	class fox_somali {
		units[] = {"fox_somali_base","fox_somali_tigr_3camo","fox_somali_KORD_high_MSV","fox_somali_2b14_82mm_msv","fox_somali_Ural_MSV_01"};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] = {"fox_core","cba_xeh"};
	};
};

class defaultUserActions;
class DefaultEventhandlers;
class EventHandlers;
class CfgVehicleClasses
{
	class fox_som_men
	{
		displayName="Somali Terrorists";
	};
	
	class fox_som_veh
	{
		displayName="Somali Vehicles";
	};
	
	class fox_som_static
	{
		displayName="Somali Statics";
	};
};
class CfgFactionClasses
{
	class fox_somali_terror
	{
		displayName="Somali Terrorists";
		priority=5;
		side=1;
	};
};


#define UNIFORM(NAME,DN,PIC,TEX,SOLDIER,LOAD,WEIGHT) \
    class ##NAME##: Uniform_Base \
    { \
        author = "Splendid Modder"; \
        scope = 2; \
        displayName = ##DN##; \
        picture = "\A3\characters_f\data\ui\icon_##PIC##_ca.paa"; \
        model = "\A3\Characters_F\Common\Suitpacks\suitpack_original_F.p3d"; \
        hiddenSelections[] = {"camo"}; \
        hiddenSelectionsTextures[] = {"\A3\Characters_F_New\BLUFOR\Data\##TEX##.paa"}; \
        \
        class ItemInfo: UniformItem \
        { \
            uniformModel = "-"; \
            uniformClass = ##SOLDIER##; \
            containerClass = Supply##LOAD##; \
            mass = ##WEIGHT##; \
        }; \
    };
	
class cfgVehicles
{

	
	class I_Soldier_base_F;
	class B_Soldier_base_F;
	class O_Soldier_base_F;
	
	class fox_somali_base: I_Soldier_base_F
	{
		scope=2;
		side=2;
		displayName="Somali Soldier(RND)";
		uniformClass="U_BG_leader";
		faction="fox_somali_terror";
		vehicleClass="fox_som_men";
		author="nzdfcrash";
		identityTypes[]=
		{
			"LanguageENGB_F",
			"Head_Euro"
		};
		headgearList[] = {
			"",0.5,
			"H_Bandanna_gry",0.5,
			"H_Bandanna_sgg",0.5,
			"H_Cap_blk",0.5,
			"H_Cap_oli",0.5,
			"H_Cap_grn",0.5,
			"H_Shemag_olive",0.5,
			"H_ShemagOpen_tan",0.5
		}; 

		class EventHandlers: EventHandlers
        {
            // The function must be triggered to benefit from the randomization, its usage is documented in its header (see link above) 
            init = "if (local (_this select 0)) then {[(_this select 0), [], []] call BIS_fnc_unitHeadgear;};";
        };
		
		faceType="Man_A3";
		icon="iconMan";
		rank="Private";
		nakedUniform="U_BasicBody";
		weapons[]=
		{
			"rhs_weap_akm",
			"Throw",
			"Put"
		};
		magazines[]=
		{
			"rhs_30Rnd_762x39mm",
			"HandGrenade",
			"HandGrenade",
			"SmokeShell",
			"SmokeShell",
			"Chemlight_green"
		};
		respawnweapons[]=
		{
			"rhs_weap_akm",
			"Throw",
			"Put"
		};
		respawnmagazines[]=
		{
			"rhs_30Rnd_762x39mm",
			"HandGrenade",
			"HandGrenade",
			"SmokeShell",
			"SmokeShell",
			"Chemlight_green"
		};
		Items[]=
		{
			"FirstAidKit"
		};
		respawnItems[]=
		{
			"FirstAidKit"
		};
		linkeditems[]=
		{
			"V_HarnessO_brn",
			"ItemMap",
			"ItemCompass",
			"ItemWatch",
			"ItemRadio"
		};
		respawnLinkedItems[]=
		{
			"V_HarnessO_brn",
			"ItemMap",
			"ItemCompass",
			"ItemWatch",
			"ItemRadio"
		};

	};
	
	
	
	class rhs_tigr_3camo_msv;
	class fox_somali_tigr_3camo : rhs_tigr_3camo_msv {
		scope=2;
		side=2;
		crew = "fox_somali_base";
		typicalCargo[] = {"fox_somali_base"};
		editorSubcategory = "EdSubcat_Cars";
		vehicleClass="fox_som_veh";
		faction = "fox_somali_terror";
		author=" RHS | FOX ";
		
	};
	
	class rhs_KORD_high_MSV;
	class fox_somali_KORD_high_MSV : rhs_KORD_high_MSV {
		scope=2;
		side=2;
		crew = "fox_somali_base";
		typicalCargo[] = {"fox_somali_base"};
		editorSubcategory = "EdSubcat_Turrets";
		vehicleClass="fox_som_static";
		faction = "fox_somali_terror";
		author=" RHS | FOX ";
		
	};
	
	class rhs_2b14_82mm_msv;
	class fox_somali_2b14_82mm_msv : rhs_2b14_82mm_msv {
		scope=2;
		side=2;
		crew = "fox_somali_base";
		typicalCargo[] = {"fox_somali_base"};
		editorSubcategory = "EdSubcat_Turrets";
		vehicleClass="fox_som_static";
		faction = "fox_somali_terror";
		author=" RHS | FOX ";
		
	};
	
	
	class RHS_Ural_MSV_01;
	class fox_somali_Ural_MSV_01 : RHS_Ural_MSV_01 {
		scope=2;
		side=2;
		crew = "fox_somali_base";
		typicalCargo[] = {"fox_somali_base"};
		editorSubcategory = "EdSubcat_Cars";
		vehicleClass="fox_som_veh";
		faction = "fox_somali_terror";
		author=" RHS | FOX ";
		
	};
	
	class I_Quadbike_01_F;
	class fox_somali_Quadbike_01_F : I_Quadbike_01_F {
		scope=2;
		side=2;
		crew = "fox_somali_base";
		typicalCargo[] = {"fox_somali_base"};
		vehicleClass="fox_som_veh";
		faction = "fox_somali_terror";
		author=" RHS | FOX ";
		
	};
	
	class O_Boat_Armed_01_hmg_F;
	class fox_somali_Boat_Armed_01_hmg_F : O_Boat_Armed_01_hmg_F {
		scope=2;
		side=2;
		crew = "fox_somali_base";
		typicalCargo[] = {"fox_somali_base"};
		vehicleClass="fox_som_veh";
		faction = "fox_somali_terror";
		author=" RHS | FOX ";
		
	};
	
	class I_Heli_light_03_unarmed_F;
	class fox_somali_Heli_light_03_unarmed_F : I_Heli_light_03_unarmed_F {
		scope=2;
		side=2;
		crew = "fox_somali_base";
		typicalCargo[] = {"fox_somali_base"};
		vehicleClass="fox_som_veh";
		faction = "fox_somali_terror";
		author=" RHS | FOX ";
		
	};
};


class Extended_InitPost_EventHandlers  {

	class fox_somali_base
	{
			fox_somali_base_init = "(_this select 0) execVM '\fox_somali\functions\fn_uniform.sqf';";
	};


};

/////Groups
class CfgGroups{
	
	class Indep{
		 	  
		class fox_somali_terror{
			name = "Somalis";
			side = 2;
			
			class Infantry{
				name = "Infantry";
	 

				class fox_somali_sq2{
					name = "Rifle Squad (2)";
					side = 2;
					faction = "fox_somali_terror";
					icon = "\A3\ui_f\data\map\markers\nato\n_inf.paa";
					
					class Unit0{
						
						side = 2;
						vehicle = "fox_somali_base";
						rank = "CORPORAL";
						position[] = {0,0,0};
					  
					};
					class Unit1{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {0,-5,0};
					};
				};
				class fox_somali_sq4{
					name = "Rifle Squad (4)";
					side = 2;
					faction = "fox_somali_terror";
					icon = "\A3\ui_f\data\map\markers\nato\n_inf.paa";
					
					class Unit0{
						
						side = 2;
						vehicle = "fox_somali_base";
						rank = "CORPORAL";
						position[] = {0,0,0};
					  
					};
					class Unit1{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {0,-5,0};
					};
					class Unit2{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {-5,-5,0};
					};		
					class Unit3{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {+5,-5,0};
					};					
				};
				
				class fox_somali_sq6{
					name = "Rifle Squad (6)";
					side = 2;
					faction = "fox_somali_terror";
					icon = "\A3\ui_f\data\map\markers\nato\n_inf.paa";
					
					class Unit0{
						
						side = 2;
						vehicle = "fox_somali_base";
						rank = "CORPORAL";
						position[] = {0,0,0};
					  
					};
					class Unit1{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {0,-5,0};
					};
					class Unit2{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {-5,-5,0};
					};		
					class Unit3{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {+5,-5,0};
					};		
					class Unit4{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {-5,-10,0};
					};		
					class Unit5{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {+5,-10,0};
					};						
				};
				class fox_somali_sq8{
					name = "Rifle Squad (8)";
					side = 2;
					faction = "fox_somali_terror";
					icon = "\A3\ui_f\data\map\markers\nato\n_inf.paa";
					
					class Unit0{
						
						side = 2;
						vehicle = "fox_somali_base";
						rank = "CORPORAL";
						position[] = {0,0,0};
					  
					};
					class Unit1{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {0,-5,0};
					};
					class Unit2{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {-5,-5,0};
					};		
					class Unit3{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {+5,-5,0};
					};		
					class Unit4{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {-5,-10,0};
					};		
					class Unit5{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {+5,-10,0};
					};		
					class Unit6{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {-5,-15,0};
					};		
					class Unit7{
						side = 2;
						vehicle = "fox_somali_base";
						rank = "PRIVATE";
						position[] = {+5,-15,0};
					};							
				};
			};
		};
	};
};

Script:

_soldier = _this;

if(!local _soldier)exitWith{};

removeAllWeapons _soldier;
removeAllItems _soldier;
removeAllAssignedItems _soldier;
removeUniform _soldier;
removeVest _soldier;
removeBackpack _soldier;


//Uniform

_uniformArray = [
	"U_C_Poloshirt_blue",
	"U_C_Poloshirt_tricolour",
	"rhs_uniform_gorka_r_g",
	"U_BG_Guerrilla_6_1",
	"U_BG_Guerilla1_1",
	"U_BG_Guerilla2_3",
	"U_BG_Guerilla3_1",
	"U_BG_leader"
];

_soldier forceAddUniform (_uniformArray call BIS_fnc_selectRandom);

_vestArray = [
	"V_TacVestIR_blk",
	"V_BandollierB_blk",
	"V_BandollierB_rgr",
	"V_BandollierB_oli",
	"V_TacVest_blk",
	"V_TacVest_camo",
	"V_I_G_resistanceLeader_F"
];

_soldier addVest (_vestArray call BIS_fnc_selectRandom);

_soldier addItemToVest "FirstAidKit";
for "_i" from 1 to 2 do {_soldier addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_soldier addItemToVest "SmokeShell";};




//Weapon

_weaponArray = [
	["rhs_weap_akm","rhs_30Rnd_762x39mm",5],
	["rhs_weap_akms","rhs_30Rnd_762x39mm",5],
	["rhs_weap_m16a4","rhs_mag_30Rnd_556x45_Mk318_Stanag",5],
	["rhs_weap_pkm","rhs_100Rnd_762x54mmR",2],
	["rhs_weap_svdp_wd","rhs_10Rnd_762x54mmR_7N1",5],
	["srifle_DMR_06_olive_F","20Rnd_762x51_Mag",5],
	["rhs_weap_ak74m_plummag_npz","rhs_30Rnd_545x39_AK",5]
];

_w = _weaponArray call BIS_fnc_selectRandom;
_weapon = _w select 0;
_magazine = _w select 1;
_magazineAmount = _w select 2;

_soldier addWeapon _weapon;

for "_i" from 1 to _magazineAmount do {_soldier addItemToVest _magazine;};

if(random 100 < 20)then{
//add igla or rocket

_rocketArray = [
	["rhs_weap_rpg26","rhs_rpg26_mag",1],
	["rhs_weap_rpg7","rhs_rpg7_PG7VL_mag",3],
	["rhs_weap_igla","rhs_mag_9k38_rocket",2]
];

_rArray = _rocketArray call BIS_fnc_selectRandom;
_rlauncher = _rArray select 0;
_rammo = _rArray select 1;
_ramount = _rArray select 2;

_soldier addWeapon _rlauncher;
_soldier addBackpack "rhs_sidor";

for "_i" from 1 to _ramount do {_soldier addItemToBackpack _rammo;};
for "_i" from 1 to _magazineAmount do {_soldier addItemToBackpack _magazine;};

};


_soldier addWeapon "rhs_weap_makarov_pmm";
for "_i" from 1 to 3 do {_soldier addItemToUniform "rhs_mag_9x18_12_57N181S";};

//Standart
_soldier linkItem "ItemMap";
_soldier linkItem "ItemCompass";
_soldier linkItem "ItemWatch";
_soldier linkItem "ItemRadio";

 
if( isClass(configFile >> "cfgPatches" >> "task_force_radio") )then { 
	//tfar
	_soldier linkItem "tf_fadak_3";
};

if( isClass(configFile >> "cfgPatches" >> "ace_main") )then { 
	//ace3
	for "_i" from 1 to 2 do {_soldier addItemToUniform "ACE_fieldDressing";};
	for "_i" from 1 to 2 do {_soldier addItemToUniform "ACE_morphine";};
	for "_i" from 1 to 2 do {_soldier addItemToUniform "ACE_epinephrine";};
};

_id = ["PersianHead_A3_01","AfricanHead_02","PersianHead_A3_02","AfricanHead_03","PersianHead_A3_03","AfricanHead_01"];
_soldier setFace (_id call BIS_fnc_selectRandom );
fd

Arsenal Export:

_soldier = _this;

if(!local _soldier)exitWith{};

ARSENAL EXPORT HERE
REPLACE PLAYER WITH _soldier !!!!

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  

×