is it possible to make this work from ground veh with turrets so ai can shoot on land?
//Fill all available helicopter gunner seats.
_heliTurrets = configFile >> "CfgVehicles" >> _heliType >> "turrets";
if ((count _heliTurrets) > 0) then {
for "_i" from 0 to ((count _heliTurrets) - 1) do {
private["_gunner"];
_gunner = _unitGroup createUnit [(DZAI_BanditTypes call BIS_fnc_selectRandom2), [0,0,0], [], 1, "NONE"];
_gunner assignAsGunner _helicopter;
_gunner moveInTurret [_helicopter,[_i]];
0 = [_gunner,"helicrew"] call DZAI_setSkills;
0 = [_gunner,_weapongrade] call DZAI_setupLoadout;
_gunner setVariable ["unithealth",[12000,0,false]];
_gunner setVariable ["unconscious",true]; //Prevent AI heli crew from being knocked unconscious
//_gunner setVariable ["DZAI_deathTime",time];
_gunner setVariable ["bodyName",(name _gunner)];
if (!(_gunner hasWeapon "NVGoggles")) then {
_gunner addWeapon "NVGoggles";
_gunner setVariable ["removeNVG",1];
};
_gunner addEventHandler ["HandleDamage",{_this call DZAI_AI_handledamage}];
[_gunner] joinSilent _unitGroup;
//diag_log format ["DEBUG :: Assigned gunner %1 of %2 to AI %3.",(_i+1),(count _heliTurrets),_heliType];
};
} else {
if (((count (weapons _helicopter)) < 1) && {(_heliType in (DZAI_airWeapons select 0))}) then {
private ["_index","_vehWeapon","_vehMag","_check"];
_index = (DZAI_airWeapons select 0) find _heliType;
if (_index > -1) then {
_vehWeapon = (DZAI_airWeapons select 1) select _index;
_check = [_vehWeapon,"weapon"] call DZAI_checkClassname;
if (_check) then {
_helicopter addWeapon _vehWeapon;
_vehMag = getArray (configFile >> "CfgWeapons" >> _vehWeapon >> "magazines") select 0;
_helicopter addMagazine _vehMag;
if (DZAI_debugLevel > 0) then {diag_log format ["DZAI Debug: Added weapon %1 and magazine %2 to air vehicle %3.",_vehWeapon,_vehMag,_heliType]};
};
};
};
};
//Fill all available helicopter gunner seats.
_heliTurrets = configFile >> "CfgVehicles" >> _heliType >> "turrets";
if ((count _heliTurrets) > 0) then {
for "_i" from 0 to ((count _heliTurrets) - 1) do {
private["_gunner"];
_gunner = _unitGroup createUnit [(DZAI_BanditTypes call BIS_fnc_selectRandom2), [0,0,0], [], 1, "NONE"];
_gunner assignAsGunner _helicopter;
_gunner moveInTurret [_helicopter,[_i]];
0 = [_gunner,"helicrew"] call DZAI_setSkills;
0 = [_gunner,_weapongrade] call DZAI_setupLoadout;
_gunner setVariable ["unithealth",[12000,0,false]];
_gunner setVariable ["unconscious",true]; //Prevent AI heli crew from being knocked unconscious
//_gunner setVariable ["DZAI_deathTime",time];
_gunner setVariable ["bodyName",(name _gunner)];
if (!(_gunner hasWeapon "NVGoggles")) then {
_gunner addWeapon "NVGoggles";
_gunner setVariable ["removeNVG",1];
};
_gunner addEventHandler ["HandleDamage",{_this call DZAI_AI_handledamage}];
[_gunner] joinSilent _unitGroup;
//diag_log format ["DEBUG :: Assigned gunner %1 of %2 to AI %3.",(_i+1),(count _heliTurrets),_heliType];
};
} else {
if (((count (weapons _helicopter)) < 1) && {(_heliType in (DZAI_airWeapons select 0))}) then {
private ["_index","_vehWeapon","_vehMag","_check"];
_index = (DZAI_airWeapons select 0) find _heliType;
if (_index > -1) then {
_vehWeapon = (DZAI_airWeapons select 1) select _index;
_check = [_vehWeapon,"weapon"] call DZAI_checkClassname;
if (_check) then {
_helicopter addWeapon _vehWeapon;
_vehMag = getArray (configFile >> "CfgWeapons" >> _vehWeapon >> "magazines") select 0;
_helicopter addMagazine _vehMag;
if (DZAI_debugLevel > 0) then {diag_log format ["DZAI Debug: Added weapon %1 and magazine %2 to air vehicle %3.",_vehWeapon,_vehMag,_heliType]};
};
};
};
};