davidoss 552 Posted February 1, 2018 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
pierremgi 4840 Posted February 1, 2018 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
davidoss 552 Posted February 1, 2018 Nice try but useless. Need something working on non existing vehicle (classname) Share this post Link to post Share on other sites
HallyG 239 Posted February 1, 2018 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). 3 Share this post Link to post Share on other sites
davidoss 552 Posted February 1, 2018 What's a beauty way. Thanks. Share this post Link to post Share on other sites
pierremgi 4840 Posted February 1, 2018 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
davidoss 552 Posted February 1, 2018 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
pierremgi 4840 Posted February 1, 2018 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
LLM777 2 Posted April 1 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
pierremgi 4840 Posted April 2 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