Jump to content
Sign in to follow this  
La Croxyy

Getting CfgVehicle Classnames into an array

Recommended Posts

The title pretty much explains it all. How would i proceed with getting the class names of vehicles in CfgVehicles and putting them into an array so i could add them to a listbox.

Share this post


Link to post
Share on other sites

Well the classnames of pretty much every ArmA III asset can be found on the Biki. BLUFOR cfgvehicles for example: https://community.bistudio.com/wiki/Arma_3_CfgVehicles_WEST

 

As for putting them into an array, I believe that you just name an array and put the classnames inside it.

 

_exampleArray = ["classname1","classname2",classname3"]; //and so on and so on

I`m not too experienced at scripting so maybe one of the pros will be along shortly :D

Share this post


Link to post
Share on other sites

Use configClasses:

_allVehicleConfigs = "true" configClasses (configFile >> "CfgVehicles");
_allVehicleConfigNames = _allVehicleConfigs apply {configName _x};

First one will hold all config paths, second one will hold all config class names, like "B_Rifleman_F".

 

Cheers

Share this post


Link to post
Share on other sites
1 hour ago, Grumpy Old Man said:

Use configClasses:


_allVehicleConfigs = "true" configClasses (configFile >> "CfgVehicles");
_allVehicleConfigNames = _allVehicleConfigs apply {configName _x};

First one will hold all config paths, second one will hold all config class names, like "B_Rifleman_F".

 

Cheers

I'll try it, thanks.

Share this post


Link to post
Share on other sites

@Grumpy Old Man It works but how would i proceed with making it only hold the class names of vehicles like, "Car","Air","Ship","Armoured" all in one array?

Share this post


Link to post
Share on other sites
10 hours ago, La Croxyy said:

@Grumpy Old Man It works but how would i proceed with making it only hold the class names of vehicles like, "Car","Air","Ship","Armoured" all in one array?

Check the comment from iceman77, it has an example how to filter for specific types.

 

Cheers

Share this post


Link to post
Share on other sites
5 hours ago, Grumpy Old Man said:

Check the comment from iceman77, it has an example how to filter for specific types.

 

Cheers

I don't see iceman's comment, perhaps he has deleted it?

Share this post


Link to post
Share on other sites
38 minutes ago, La Croxyy said:

I don't see iceman's comment, perhaps he has deleted it?

First comment on the page I linked.

 

Cheers

Share this post


Link to post
Share on other sites

In other words:

("(configname _x isKindOf 'LandVehicle' or configname _x isKindOf 'Air' or configname _x isKindOf 'Ship') && getNumber (_x >> 'scope') == 2 " configClasses (configfile >> "CfgVehicles")) apply {configName _x};

  • Like 1

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  

×