Jump to content
SwissArmy1984

Is there a simple way to get all the class names of all the objects in any specific mod?

Recommended Posts

Is there a simple way to get all the class names of all the objects in any specific mod?  Something that would simply generate a text list?

Share this post


Link to post
Share on other sites

Taken from Authority project. Adjust this to your needs. It uses author atm but you can modify it to check for prefix if needed.

_OnlyA3VanillaWeapons = TRUE;

private _configClasses = if (!_OnlyA3VanillaWeapons) then {"(getNumber (_x >> 'scope') >= 2)" configClasses (configFile >> "CfgWeapons")} else {"(getNumber (_x >> 'scope') >= 2) && getText ( _x >> 'author' ) == 'Bohemia Interactive'" configClasses (configFile >> "CfgWeapons")};

private _weapons = [];
private _blacklistedWeapons = ["LMG_Zafir_F"];
{
	if !(configName _x in _blacklistedWeapons) then
	{
		_weapons pushBack (configName _x);
	};
} forEach _configClasses;
hintSilent str _weapons;

[
	ammobox,
	_weapons,
	FALSE,
	TRUE
] call BIS_fnc_addVirtualWeaponCargo;

 

Share this post


Link to post
Share on other sites

Hello there SwissArmy1984 !

 

You can use scripts in order to get certain configs .

For any examples you can check all of my scripts that start with the word GF_Auto_

Here :

 

 

Check also this :

 

 

 

 

Thanks also HazJ for the snippet above !!!  :thumb:

Share this post


Link to post
Share on other sites
"'expansion' in (configSourceModList _x)" configClasses (configFile >> "CfgWeapons") apply {configName _x};

This is simplest way IMO, this returns all weapons configured in Apex Expansion files. Of course, you need to modify the condition to search only like for scope = 2; assets.

Share this post


Link to post
Share on other sites

the:

" filter here " configClasses (configFile >> "CfgWeapons") apply {configName _x};

is the handy way to obtain what classes you want.

The problem in to define this filter for the best result.

First of all, the "working" classes for most of your project are filtered by:

" getNumber (_x >> 'scope') >= 2 ", which should be embedded in a BI parameter, imho, in regard of its almost permanent use.

Then,

Arma vanilla keeps some logical sorting like 'DLC'. Example: "getText (_x >> 'DLC') != 'KART' "

 

Things are harder for mods.

Some of them have their 'DLC' entry. Fine!

Some of them have their own 'author' entry (check the class at author)

But most of them don't mention neither DLC (normal), nor specific author (less normal)

Sorting "All objects" means the huge quantity of units, vehicles, weapons, mags, houses, things, etc.

You can try to work with specific editorSubcategory (also in the class definitions). Sometimes big mods have their own editor category/ subcategory.

If not, you can try, some filters  by

" ['Mod_',configName _x] call Bis_fnc_instring", where Mod_ can be CUP_ or RHS_ for example.

 

Last but not least, the more loaded mod, the slower sorting. Do not hesistate to had some {} for successive condition check, then optimization. Test your request in debug console performance.

As example:

 _weapons_RHSUSAF = ("getText (_x >>'DLC') == 'RHS_USAF' && {getNumber (_x >> 'scope') >= 2} && {(getNumber (_x >> 'type') in [1,2,4])}" configClasses (configfile >> "CfgWeapons"));

Test shifting the conditions and the speed can be different.

 

Share this post


Link to post
Share on other sites
On 2/16/2019 at 7:04 PM, pierremgi said:

getNumber (_x >> 'scope') >= 2

Scope bigger than 2 is invalid. Not much sense checking for it being bigger.

 

On 2/15/2019 at 11:09 PM, SwissArmy1984 said:

Is there a simple way to get all the class names of all the objects in any specific mod?

What kind of classnames are you talking about? Weapons? Vehicles, Buildings, Units?

 

Every mod is supposed to have a list of all weapons/units they add in their CfgPatches entry, you can just pick the array out of there if you know what CfgPatches entry you are looking for.

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

×