Jump to content
davidoss

get certain vehicle type class from config

Recommended Posts

Hi.

I am looking for possibility how to get array of attack helicopter from config.

I knew how to iterate trough config for classes but i do not knew how to filter for attack helicopter.

Is there ultimate config entry which defines an gunship, valid for any side and any mod?

Maybe  textSingular = "gunship"; ?

 

 

Share this post


Link to post
Share on other sites

Perhaps, you can find if a helo is armed (has some magazines in turrets except flare chaff) with:

 

count ((magazinesAllTurrets _yourHelo) select { !(["chaff",_x select 0] call bis_fnc_inString)}) > 0

 

Share this post


Link to post
Share on other sites

Nice try but useless. Need something working on non existing vehicle (classname)

Share this post


Link to post
Share on other sites

I think the result you want to obtain is dependent upon your definition of a gunship. However, in my attempt I assume that it is a gunship if it has "CAS_Heli" in the array returned from the config value "availableForSupportTypes": 

//--- Get vehicles which are aircraft and can be spawned in the editor
_allHelicoptersCfgPaths = "getNumber (_x >> 'type') isEqualTo 2 && getNumber (_x >> 'scope') >= 2" configClasses (configFile >> "cfgVehicles");

//--- Get all vehicles which have the 'helicopter' simulation and are not autonomous
_allHelicoptersCfgPaths = _allHelicoptersCfgPaths select {toLower getText (_x >> 'simulation') isEqualTo "helicopterrtd" && {toLower getText (_x >> 'vehicleClass') != "autonomous"}};

//--- All Vehicles which are allowed to be used in cas module
// _allHelicoptersCfgPaths = _allHelicoptersCfgPaths select {isClass (_x >> "Components" >> "TransportPylonsComponent")};
_allHelicoptersCfgPaths = _allHelicoptersCfgPaths select {"CAS_Heli" in (getArray (_x >> 'availableForSupportTypes'))};

//--- Dump config names to the clipboard
copyToClipboard (_allHelicoptersCfgPaths apply {configName _x} joinString endl);

(you could do this all in one line but it's easier to read like this)

Obviously, this will only work if the helicopter has "CAS_Heli" in the array for "availableForSupportTypes" in the config. You could, however, modify the script to instead verify if the helicopter can equip missiles (might help for mods).

 

  • Like 3

Share this post


Link to post
Share on other sites

Without any module reference, you can grab the helos with a significant threat on infantry, armored, air  enemies.

I'm working with threat [] token in config classes, but it needs to choose a threshold. If set to 1 (max) some light helicopters will not present (but heavy CUP ones are OK).

If you lower the threshold less than 0.3 you'll grab some helos with flares only.

 

So, what I suggest here: one of the threat >0.5:

 

"_class = _x; {if (_x > 0.5) exitWith {true};false} forEach (getArray (_class >> 'threat')) && (getNumber (_class >> 'scope') >= 2) && ('Helicopter' in ([_class,true ] call BIS_fnc_returnParents))" configClasses (configFile >> "cfgVehicles") apply {configName _x }

 

You catch the idea. If you want ot select "armor threatening" helicopter only, you can play with (getArray (_class >> 'threat')) select 1. etc.

Share this post


Link to post
Share on other sites

oh i see "get proper killer for kind of enemy".  Looks promising and complicated.

 

For now i have this:

 

#define GVAR_PARAM(NUM)							(paramsArray select NUM)
#define GVAR_FSIDE  							([EAST,WEST,INDEPENDENT] select GVAR_PARAM(6))

_side = [0,1,2] select ([EAST,WEST,INDEPENDENT] find GVAR_FSIDE);
_allSideAirCfgPaths = "
	getNumber (_x >> 'type') isEqualTo 2 &&
	{getNumber (_x >> 'side') isEqualTo _side} &&
	{getNumber (_x >> 'scope') >= 2}
" configClasses (configFile >> "cfgVehicles");

_allHeliCfgPaths = _allSideAirCfgPaths select {
	toLower getText (_x >> 'simulation') isEqualTo "helicopterrtd" &&
	{toLower getText (_x >> 'vehicleClass') != "autonomous"}
};

_allAttackHeliCfgPaths = _allHeliCfgPaths select {
	"CAS_Heli" in (getArray (_x >> 'availableForSupportTypes'))
};

_allTransportkHeliCfgPaths = _allHeliCfgPaths select {
	"Transport" in (getArray (_x >> 'availableForSupportTypes')) ||
	{"Drop" in (getArray (_x >> 'availableForSupportTypes'))}
};
_allUAVCfgPaths = _allSideAirCfgPaths select {
toLower getText (_x >> 'vehicleClass') == "autonomous"
};

_allPlaneCfgPaths = _allSideAirCfgPaths select {
	toLower getText (_x >> 'simulation') isEqualTo "airplanex" && 
	{"CAS_Bombing" in (getArray (_x >> 'availableForSupportTypes'))} &&
	 {toLower getText (_x >> 'vehicleClass') != "autonomous"}
 };

_attackHelis  = +(_allAttackHeliCfgPaths apply {configName _x});
_transportHelis = +(_allTransportkHeliCfgPaths apply {configName _x});
_uavs = +(_allUAVCfgPaths apply {configName _x});
_planes = +(_allPlaneCfgPaths apply {configName _x});

[_attackHelis,_transportHelis,_uavs,_planes]

How to glue together?

 

Share this post


Link to post
Share on other sites

 

you just need to change for:

 

_allAttackHeliCfgPaths = _allHeliCfgPaths select { _class = _x; {if (_x > 0.5) exitWith {true};false} forEach (getArray (_class >>"threat")) };

 

Should work.

 

Share this post


Link to post
Share on other sites
On 2/1/2018 at 7:25 PM, pierremgi said:

 

you just need to change for:

 

_allAttackHeliCfgPaths = _allHeliCfgPaths select { _class = _x; {if (_x > 0.5) exitWith {true};false} forEach (getArray (_class >>"threat")) };

 

Should work.

 

Are you still active on the forum? Need help!

Share this post


Link to post
Share on other sites
14 hours ago, LLM777 said:

Are you still active on the forum? Need help!

Far less. I'm busy these weeks.

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

×