Jump to content
razzored

Help with spawnAI CFGclasses

Recommended Posts

Hello again!
I don't want to necro an old thread, so ill bring up the elephant here.
Someone needed help with custom factions using the spawn ai module, Larrow was so nice to share a CFG he made, which works perfectly.
HOWEVER, whenever adding tanks, motorized and such, it breaks the scripts even though I've tried a million ways and OP never shared how he made it work.
So my questions are.
A. How to i put in the Armor, motorized and mechanized and format it, without breaking the whole thing.

B. This question is not as relevant but i figured i asked it here, since i need it for the same project. I want Air vehicles to spawn aswell, which the module cannot do, so i was going to sync AI in air vehicles aswell as their vehicle to the tactics module. HOWEVER, i need to figure out how to make them spawn ect mid-mission and be synced.. or to make them "respawn" and still be synced. (I am ofc aware that respawning AI is not a thing, but regardless, I want so somehow simulate the effect.)

Original code by Larrow
 

Spoiler

class CfgGroups {

    class west {

        class myCustomWestFaction { //Name for your custom faction

            class Infantry {    //SpawnAI module looks for this class

            	class myCustomWestInfGroup_1units {    //Can be called anything, name used for blacklisting

                    class unit0 {
                        vehicle = "B_Soldier_F";     //Class name of unit/vehicle
                        side = 1;                    //index of unit side being [ east, west, independent, civilian ]
                        rank = "SERGANT";            //rank name from CfgRanks
                        position[] = { 0, 0, 0 };    //offset position unit spawns from spawn point
                    };
                };

                class myCustomWestInfGroup_3units {    //Can be called anything, name used for blacklisting

                    class unit0 {
                        vehicle = "B_Soldier_F";    //Class name of unit/vehicle
                        side = 1;                   //index of unit side being [ east, west, independent, civilian ]
                        rank = "SERGANT";           //rank name from CfgRanks
                        position[] = { 0, 0, 0 };   //offset position unit spawns from spawn point
                    };

                    class unit1 {
                        vehicle = "B_Soldier_F";    //Class name of unit/vehicle
                        side = 1;                   //index of unit side being [ east, west, independent, civilian ]
                        rank = "PRIVATE";           //rank name from CfgRanks
                        position[] = { 5, -5, 0 };  //offset position unit spawns from spawn point
                    };

                    class unit2 {
                        vehicle = "B_Soldier_F";    //Class name of unit/vehicle
                        side = 1;                   //index of unit side being [ east, west, independent, civilian ]
                        rank = "PRIVATE";           //rank name from CfgRanks
                        position[] = { -5, -5, 0 }; //offset position unit spawns from spawn point
                    };

                };

                class myCustomWestInfGroup_6units {    //Can be called anything, name used for blacklisting

                    class unit0 {
                        vehicle = "B_Soldier_F";    //Class name of unit/vehicle
                        side = 1;                   //index of unit side being [ east, west, independent, civilian ]
                        rank = "SERGANT";           //rank name from CfgRanks
                        position[] = { 0, 0, 0 };   //offset position unit spawns from spawn point
                    };

                    class unit1 {
                        vehicle = "B_Soldier_F";    //Class name of unit/vehicle
                        side = 1;                   //index of unit side being [ east, west, independent, civilian ]
                        rank = "PRIVATE";           //rank name from CfgRanks
                        position[] = { 5, -5, 0 };  //offset position unit spawns from spawn point
                    };

                    class unit2 {
                        vehicle = "B_Soldier_F";    //Class name of unit/vehicle
                        side = 1;                   //index of unit side being [ east, west, independent, civilian ]
                        rank = "PRIVATE";           //rank name from CfgRanks
                        position[] = { -5, -5, 0 }; //offset position unit spawns from spawn point
                    };

                    class unit3 {
                        vehicle = "B_Soldier_F";    //Class name of unit/vehicle
                        side = 1;                   //index of unit side being [ east, west, independent, civilian ]
                        rank = "PRIVATE";           //rank name from CfgRanks
                        position[] = { 10, -10, 0 }; //offset position unit spawns from spawn point
                    };

                    class unit4 {
                        vehicle = "B_Soldier_F";    //Class name of unit/vehicle
                        side = 1;                   //index of unit side being [ east, west, independent, civilian ]
                        rank = "PRIVATE";           //rank name from CfgRanks
                        position[] = { -10, -10, 0 }; //offset position unit spawns from spawn point
                    };

                    class unit5 {
                        vehicle = "B_Soldier_F";    //Class name of unit/vehicle
                        side = 1;                   //index of unit side being [ east, west, independent, civilian ]
                        rank = "PRIVATE";           //rank name from CfgRanks
                        position[] = { 15, -15, 0 }; //offset position unit spawns from spawn point
                    };

                };
            };

            class Motorized {};     //SpawnAI module looks for this class for
            class Mechanized {};    //SpawnAI module looks for this class
            class Armored {};       //SpawnAI module looks for this class
        };
    };

 

 

Share this post


Link to post
Share on other sites

I haven't created a cfgGroup in a long time.

I have tested and it works.
It should get you started with adding Mechanized and Armoured groups.

 

 

Spoiler


class CfgFactionClasses
{
	access = 1;
	class myCustomWestFaction
	{
		displayName = "Razzored Faction";
		priority = 1;
		side = 1;
		icon = "\a3\Data_f\cfgFactionClasses_BLU_ca.paa";
		//flag = "\a3\Data_f\Flags\flag_nato_co.paa";
	};
};

class CfgGroups
{
    class west
	{
        class myCustomWestFaction
		{
			name = "Razzored Faction";
            class Infantry
			{
				name = "Infantry";
            	class myCustomWestInfGroup_1units
				{
					name = "Infantry 1 Man";
					side = 1;
					faction = "myCustomWestFaction";
                    class unit0
					{
                        vehicle = "B_Soldier_F";
                        side = 1;
                        rank = "SERGANT";
                        position[] = { 0, 0, 0 };
                    };
                };
                class myCustomWestInfGroup_3units
				{
					name = "Infantry 3 Men";
					side = 1;
					faction = "myCustomWestFaction";
                    class unit0
					{
                        vehicle = "B_Soldier_F";
                        side = 1;
                        rank = "SERGANT";
                        position[] = { 0, 0, 0 };
                    };
                    class unit1
					{
                        vehicle = "B_Soldier_F";
                        side = 1;
                        rank = "PRIVATE";
                        position[] = { 5, -5, 0 };
                    };
                    class unit2
					{
                        vehicle = "B_Soldier_F";
                        side = 1;
                        rank = "PRIVATE";
                        position[] = { -5, -5, 0 };
                    };

                };
                class myCustomWestInfGroup_6units
				{
					name = "Infantry 6 Men";
					side = 1;
					faction = "myCustomWestFaction";
                    class unit0
					{
                        vehicle = "B_Soldier_F";
                        side = 1;
                        rank = "SERGANT";
                        position[] = { 0, 0, 0 };
                    };
                    class unit1
					{
                        vehicle = "B_Soldier_F";
                        side = 1;
                        rank = "PRIVATE";
                        position[] = { 5, -5, 0 };
                    };
                    class unit2
					{
                        vehicle = "B_Soldier_F";
                        side = 1;
                        rank = "PRIVATE";
                        position[] = { -5, -5, 0 };
                    };
                    class unit3
					{
                        vehicle = "B_Soldier_F";
                        side = 1;
                        rank = "PRIVATE";
                        position[] = { 10, -10, 0 };
                    };
                    class unit4
					{
                        vehicle = "B_Soldier_F";
                        side = 1;
                        rank = "PRIVATE";
                        position[] = { -10, -10, 0 };
                    };
                    class unit5
					{
                        vehicle = "B_Soldier_F";
                        side = 1;
                        rank = "PRIVATE";
                        position[] = { 15, -15, 0 };
                    };
                };
            };

			class Motorized
			{
				name = "Motorized Infantry";
				class myCustomWestMotInfTeam
				{
					name = "Motorized Team";
					side = 1;
					faction = "myCustomWestFaction";
					icon = "\A3\ui_f\data\map\markers\nato\b_motor_inf.paa";
					class Unit0
					{
						side = 1;
						vehicle = "B_MRAP_01_gmg_F";
						rank = "SERGEANT";
						position[] = {0, 0, 0};
					};
					class Unit1
					{
						side = 1;
						vehicle = "B_soldier_AR_F";
						rank = "CORPORAL";
						position[] = {5, -5, 0};
					};
					class Unit2
					{
						side = 1;
						vehicle = "B_soldier_LAT_F";
						rank = "PRIVATE";
						position[] = {-5, -5, 0};
					};
				};

				class myCustomWestMotAT
				{
					name = "Motorized Anti-armor Team";
					side = 1;
					faction = "myCustomWestFaction";
					icon = "\A3\ui_f\data\map\markers\nato\b_motor_inf.paa";
					class Unit0
					{
						side = 1;
						vehicle = "B_MRAP_01_F";
						rank = "SERGEANT";
						position[] = {0, 0, 0};
					};
					class Unit1
					{
						side = 1;
						vehicle = "B_soldier_AT_F";
						rank = "CORPORAL";
						position[] = {5, -5, 0};
					};
					class Unit2
					{
						side = 1;
						vehicle = "B_soldier_AT_F";
						rank = "CORPORAL";
						position[] = {-5, -5, 0};
					};
					class Unit3
					{
						side = 1;
						vehicle = "B_soldier_AAT_F";
						rank = "PRIVATE";
						position[] = {0, -10, 0};
					};
				};
			};

			class Helicopters
			{
				name = "Helicopters";
				class myCustomWestHeli1
				{
					name = "Helicopter 1";
					side = 1;
					faction = "myCustomWestFaction";
					class Unit0
					{
						side = 1;
						vehicle = "B_Heli_Transport_01_F";
						rank = "LIEUTENANT";
						position[] = {0, 0, 25};
					};
				};
				class myCustomWestHeli2
				{
					name = "Helicopter 2";
					side = 1;
					faction = "myCustomWestFaction";
					class Unit0
					{
						side = 1;
						vehicle = "B_Heli_Transport_01_F";
						rank = "LIEUTENANT";
						position[] = {-25, 0, 25};	//	Shame Z doesn't work.
					};
					class Unit1
					{
						side = 1;
						vehicle = "B_Heli_Transport_01_F";
						rank = "LIEUTENANT";
						position[] = {25, 0, 25};
					};
				};
			};
		};
	};
};

 

 

 

Edit: Apologies for the crap formatting. 

Edited by Maff
  • Like 2

Share this post


Link to post
Share on other sites

Will try out ASAP, Thanks man, i like that you added helicopters, but i am unsure if they SpawnAI module will actually spawn and utilize helis. Guess ill find out 😛

Share this post


Link to post
Share on other sites

The settings for Armored is the same as you can see in CfgGroups for the base game.

Something like...

            class Armored {			//SpawnAI module looks for this class

                class myCustomWestTanks_2 {    //Can be called anything, name used for blacklisting

                    class unit0 {
                        vehicle = "B_MBT_01_cannon_F";     //Class name of unit/vehicle
                        side = 1;                    //index of unit side being [ east, west, independent, civilian ]
                        rank = "SERGANT";            //rank name from CfgRanks
                        position[] = { 0, 0, 0 };    //offset position unit spawns from spawn point
                    };

                    class unit1 {
                        vehicle = "B_MBT_01_cannon_F";     //Class name of unit/vehicle
                        side = 1;                    //index of unit side being [ east, west, independent, civilian ]
                        rank = "SERGANT";            //rank name from CfgRanks
                        position[] = { -10, -10, 0 };    //offset position unit spawns from spawn point
                    };
                };
            };

BUT Make sure your manpower cap is big enough to spawn at least something. Currently there is a bug in one of the module functions, where if it cannot spawn something then it errors due to a wrong variable used in the spawnAI modules script. FB_Ticket

  • Like 2

Share this post


Link to post
Share on other sites

Thanks Larrow.
Yeah the problem i experienced before where it did not spawn anything, most likely weren't due to manpower as it was set to 50.
And i only added class to the WEST faction, east also broke every time, so it was 100% a formatting issue, due to not closing off the config correctly 🙂 Haven't tested any of the things submitted yet, but i will get on that later today/night depending on whereabouts people are in the world 🙂

Share this post


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

The settings for Armored is the same as you can see in CfgGroups for the base game.

Something like...



            class Armored {			//SpawnAI module looks for this class

                class myCustomWestTanks_2 {    //Can be called anything, name used for blacklisting

                    class unit0 {
                        vehicle = "B_MBT_01_cannon_F";     //Class name of unit/vehicle
                        side = 1;                    //index of unit side being [ east, west, independent, civilian ]
                        rank = "SERGANT";            //rank name from CfgRanks
                        position[] = { 0, 0, 0 };    //offset position unit spawns from spawn point
                    };

                    class unit1 {
                        vehicle = "B_MBT_01_cannon_F";     //Class name of unit/vehicle
                        side = 1;                    //index of unit side being [ east, west, independent, civilian ]
                        rank = "SERGANT";            //rank name from CfgRanks
                        position[] = { -10, -10, 0 };    //offset position unit spawns from spawn point
                    };
                };
            };

BUT Make sure your manpower cap is big enough to spawn at least something. Currently there is a bug in one of the module functions, where if it cannot spawn something then it errors due to a wrong variable used in the spawnAI modules script. FB_Ticket

Btw I see you only put vehicle class name in the unit section? whereas another guy who seemed to get it working seamlessly also put infantry units in the "vehicle groups".. Will the vehicles spawn in empty or with AI in them?
I also noticed that when adding vehicles manually and then adding a script to make AI get in vehicles on their own.. vehicles whose squad leader was inside the vehicle instead of outside, were really bad at moving to sectors and would rather just fuck around.

TLDR;
Don't i need to add crew members to armor class?
Why do they turn off their brain when a teamleader drives?

Share this post


Link to post
Share on other sites
33 minutes ago, razzored said:

Don't i need to add crew members to armor class?

No.

 

35 minutes ago, razzored said:

Will the vehicles spawn in empty or with AI in them?

The vehicle will have crew already mounted based on the classname config.

 

 

 

37 minutes ago, razzored said:

I see you only put vehicle class name in the unit section?

whereas another guy who seemed to get it working seamlessly also put infantry units in the "vehicle groups".

You can configure a group containing both vehicles and infantry.

See my Motorized example, which I copied from the base config.
The vehicle will already have a crew, and your infantry will be dismounted.

 

41 minutes ago, razzored said:

Why do they turn off their brain when a teamleader drives?

What do you mean? 🤣
 

Share this post


Link to post
Share on other sites

Thanks for the clarification 😛 
 

1 hour ago, Maff said:

What do you mean? 🤣

I did a workaround initially with script spawned vehicles, then i modified the AI to enter vehicles on own accord.
What I learned was this.

Exhibit A
5 man squad, leader and other guy goes on foot to objective/sector, while 3 other guys enter apc ect, follows leader and provides excellent fire support and DOMINATE the AO.

Exhibit B
5 man team all enter vehicle ect a APC. They stay at vehicle location for like 10 minutes, while their understaffed team is loosing sectors.. they finally move out move close to first sector (which they already have) and take a coffee break for another 10 mins.. then they move a slight bit again (maybe) before taking another break.

A few times a whole team would enter a vehicle and do exhibit A.. IE actually be combat efficient, but 7/10 times, if the whole crew was mounted, they would just mess around and do fuck all 😛 (my only guess would be that infantry linked to sector tactics, get confused when forced to be a vehicle crew by another script?)
Apart from custom AI behavior messing with them, i cannot find any other explanation.

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

×