Jump to content
dragonflyfan

Multiple AI spawn vehicles via CfgGroups file

Recommended Posts

Good morning all, I hope everyone had a super weekend.

 

Im hoping someone can you give me some advice on creating AI spawn groups please?

 

In my support based mission I reference a 'cfgGroups' file in order to control the AI spawns, see part of it below. What I am wanting to do is spawn 2x 'vehicles' in the group rather than just one.

 

You'll be able to see where I have tried to spawn both a UN truck and a UN armed jeep however only the UN truck spawns.

 

Is there a way to great 2x sub-groups within the main group for spawning AI? 

 

Cheers,

 

Jas

 

class Mechanized
            {
                name = $str_a3_cfggroups_west_blu_f_mechanized0;
                class LB_Support_BMechL
                {
                    name = $str_a3_cfggroups_west_blu_f_mechanized_bus_mechinfsquad0;
                    side = 1;
                    faction = BLU_F;
                    class Unit0        {side = 1; vehicle = sab_UN_Truck_O; rank = "SERGEANT";};
                    class Unit1        {side = 1; vehicle = sab_UN_Crew; rank = "SERGEANT";};
                    class Unit2        {side = 1; vehicle = rhsusf_usmc_marpat_wd_teamleader; rank = "PRIVATE";};
                    class Unit3        {side = 1; vehicle = sab_UN_Offroad_gun; rank = "CORPORAL";};
                    class Unit4        {side = 1; vehicle = rhsusf_usmc_marpat_wd_autorifleman_m249; rank = "PRIVATE";};
                    class Unit5        {side = 1; vehicle = rhsusf_usmc_marpat_wd_autorifleman_m249; rank = "PRIVATE";};
                    class Unit6        {side = 1; vehicle = rhsusf_usmc_marpat_wd_riflemanat; rank = "PRIVATE";};
                    class Unit7        {side = 1; vehicle = rhsusf_navy_marpat_wd_medic; rank = "PRIVATE";};
                    class Unit8        {side = 1; vehicle = rhsusf_usmc_marpat_wd_rifleman; rank = "PRIVATE";};
                };

  • Like 2

Share this post


Link to post
Share on other sites

vehicle = "sab_UN_Truck_O" ... should be an existing class string

 

Don't use spawnGroup for spawning vehicles, especially in cities. They collide with any object/house/wall...

 

  • Like 2

Share this post


Link to post
Share on other sites
7 hours ago, pierremgi said:

should be an existing class string

 

Sorry mate, I'm not a coder (just someone who has a crack) .... would you mind giving me more information on what you mean by this please? 

Share this post


Link to post
Share on other sites

In general, in programming a string is a sequence of characters enclosed in double quotes like

"this is a string"

What pierremgi means is that instead of writing the class name of the object you want to spawn, you have to make it a string. This, effectively means that you should encolse it into double quotes. So, the "solution" would be something like (duplicating pierremgi's text)

// Your script
class Unit0	{side = 1; vehicle = sab_UN_Truck_O; rank = "SERGEANT";};

// What pierremgi suggests
class Unit0 {side = 1; vehicle = "sab_UN_Truck_O"; rank = "SERGEANT";};

If you notice, the only difference is in the name of the class of the vehicle, which in the second case is enclosed in double quotes (i.e. it is a string). It is pretty much the same as the "SERGEANT" rank you provide for the vehicles. If you were to omit the double quotes in the rank you would encounter the same issues.

 

Hope this clarifies a bit the situation with strings and is somehow helpful.

 

Please don't hesitate to ask again if you need anything else.

Edited by ZaellixA
Corrected type in script snippet

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

×