heli gunner used for ground patrol

osmox1971

Member
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]};
};
};
};
};
 
Changing the lines
_gunner assignAsCargo _vehicle;
_gunner moveInCargo [_vehicle,_i];
to
_gunner assignAsGunner _vehicle;
_gunner moveInGunner _vehicle;
in spawn_functions\spawf_vehPatrol.sqf seems to do the trick.
 
If you change the assignAsGunner and moveInTurret lines to this, you will be able to use armed vehicles with multiple gunner seats:

Code:
_gunner assignAsGunner _vehicle;
_gunner moveInTurret [_vehicle,[_i]];

I was not kidding at all when I said the land vehicle patrols were for experimentation only and not fit for everyday use.
 
If you change the assignAsGunner and moveInTurret lines to this, you will be able to use armed vehicles with multiple gunner seats:

Code:
_gunner assignAsGunner _vehicle;
_gunner moveInTurret [_vehicle,[_i]];

I was not kidding at all when I said the land vehicle patrols were for experimentation only and not fit for everyday use.



thx. Your the best.
 
If you change the assignAsGunner and moveInTurret lines to this, you will be able to use armed vehicles with multiple gunner seats:

Code:
_gunner assignAsGunner _vehicle;
_gunner moveInTurret [_vehicle,[_i]];

I was not kidding at all when I said the land vehicle patrols were for experimentation only and not fit for everyday use.
Nice, I'll try that. I tried to use moveInTurret [_vehicle, _i], that's _i, not your [_i] and got an error about array arguments, so I went for moveInGunner which got a nice result (gunner shot me ;-) with an M240 Humvee :)

Regarding the experimental status, I had read and noted that and I'm happy being able to fiddle a bit, realizing that you aren't giving any warranty.
Nevertheless I'm very impressed even with the status quo!
 
Back
Top