Jump to content

Recommended Posts

Hi there,

 

I have issues with my code coming from the fact that i don't really know of to use the configFile and everything that comes with it.

I want to return all vehicles including those with "skins".

 

So here is a part of the code i'm trying to use:

_allClassNames = [];
_Cfg = configFile >> "CfgVehicles";
for "_i" from 0 to (count _Cfg)-1 do
{
	_class = _Cfg select _i;
	_className = configName _class;
	_allClassNames pushback _className;
};
copyToClipBoard str _allClassNames;

/*
Extract of _allClassNames:

"O_Heli_Transport_04_bench_F",
"O_Heli_Transport_04_box_F",

----------------------------
Extract of a list of all class names :

"O_Heli_Transport_04_bench_F",
	"O_Heli_Transport_04_bench_black_F",
"O_Heli_Transport_04_box_F",
*/

I'm clearly missing some vehicles here.

(Also how do i get the sqf highlighting when posting code on the forums ?)

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Not sure what you mean with skins, but you can get all classes that meet a certain criteria using configClasses.

 

_configs = "getNumber (_x >> 'scope') >= 2 AND configName _x isKindof 'Helicopter'" configClasses (configFile >> "CfgVehicles");

 

This will return all editor placeable helicopter configs. To get an array of classNames simply do this:

_configs = "getNumber (_x >> 'scope') >= 2 AND configName _x isKindof 'Helicopter'" configClasses (configFile >> "CfgVehicles");
_classNames = _configs apply {configName _x};

 

Cheers

  • Like 2

Share this post


Link to post
Share on other sites

Thanks for your help ! Wasn't expecting some until at least next week, guess i should've come here sooner...

 

Well i tried :

_configs = "getNumber (_x >> 'scope') >= 2" configClasses (configFile >> "CfgVehicles");
_classNames = _configs apply {configName _x};
copyToClipBoard str _classNames;

And i still can't find my "O_Heli_Transport_04_bench_black_F" in _classNames

Share this post


Link to post
Share on other sites
1 hour ago, SSgt 'Ice Cold' Sykes said:

Thanks for your help ! Wasn't expecting some until at least next week, guess i should've come here sooner...

 

Well i tried :


_configs = "getNumber (_x >> 'scope') >= 2" configClasses (configFile >> "CfgVehicles");
_classNames = _configs apply {configName _x};
copyToClipBoard str _classNames;

And i still can't find my "O_Heli_Transport_04_bench_black_F" in _classNames

That's because the scope value probably doesn't return 2+, so it's configured to not be placed in the editor.

 

Try the snippet and check for scope >= 1.

 

Cheers

Share this post


Link to post
Share on other sites

 

How do i make sure that the classnames returned don't have any subClasses in them ?

 

Meaning from this :

	"B_Heli_Light_01_F",
		"B_Heli_Light_01_stripped_F",
"Heli_Light_01_armed_base_F",
	"Heli_Light_01_dynamicLoadout_base_F",
		"B_Heli_Light_01_dynamicLoadout_F",
	"B_Heli_Light_01_armed_F"

I would return :

"B_Heli_Light_01_F",
"B_Heli_Light_01_stripped_F",
"B_Heli_Light_01_dynamicLoadout_F",
"B_Heli_Light_01_armed_F"

 

Share this post


Link to post
Share on other sites

Thanks it helped a lot ! Do you know where i can find a list of all things like : 'displayName', 'vehicleClass', 'textureSource', 'hardpoints' (idk what they're called) ?

Share this post


Link to post
Share on other sites

Example for display name, for helicopter:

 

"getNumber (_x >> 'scope') >= 2 && configName _x isKindOf 'helicopter' " configClasses (configFile >> "CfgVehicles") apply {getText (_x >> "displayName")}

 

 

 

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

×