Forum Jump :

Author Message


Posts: 86
Rank:


Level: Member

Country: in
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2017-08-04 02:32        
     
Hello,this script enables player or AI flown aircrafts & helicopters to automatically release flares if under enemy surface-to-air SAM missile attack(e.g stinger,igla).
Script uses-
(1) Adds extra flares to aircraft & helicopters of any side.
(2) Fixes AI aircraft not releasing their flares if under SAM missile attack.
(3) Best for flying CAS missions alongside AI aircraft and increases aircraft survivability
in hostile missions.

Limitations-
- this script increases AI aircrafts defence against enemy SAMs,though helicopters are still
vulnerable because they fly at slower speeds in arma 2/OA.

Supported types-
-fighters (e.g AV-8,A-10,su-25,su-34,modded fighter jets.)
-transports (e.g C-130,AN-2, modded transport planes.civilian versions)
-helicopters (e.g mv-22,uh-60,ah-64,mi-8,mi-24,civilian versions)

Note - if any fighter or transport aircraft doesn't release flares then change line
_plane action ["useweapon",vehicle _plane,driver _plane,11]; to
_plane fire "CMFlarelauncher"; in autoflares_fighters.sqf & autoflares_transports.sqf

To use this script,add code to player/AI-controlled aircraft or helicopters init after placing them on map in mission editor.
Next create & place sqf files as described below in mission folder.

fighter aircraft version-
place in init of fighter aircraft-
null = [this] execVM "autoflares_fighters.sqf";
autoflares_fighters.sqf
//countermeasures autoflares script fighter aircraft version.
//Place code in any fighter aircrafts init of any side-
//null = [this] execVM "autoflares_fighters.sqf";

_plane = _this select 0;
_plane addweapon "CMFlareLauncher";
_plane addMagazineTurret ["120Rnd_CMFlareMagazine",[-1]];

_plane addEventHandler ["incomingmissile",{
_this spawn {
_plane = _this select 0;
_pilot = driver _plane;
_plane selectweapon "CMFlareLauncher";
_pilot sidechat "SAM Launch!,SAM Launch!!";
for "_i" from 0 to 4 do {sleep 0.5;
_plane action ["useweapon",vehicle _plane,driver _plane,11];};
};      
}];

transport aircraft version-
place in init of transport aircraft-
 null = [this] execVM "autoflares_transports.sqf";

autoflares_transports.sqf
//countermeasures autoflares script transport aircraft (military & civilian) version.
//Place code in any transport aircraft init of any side-
//null = [this] execVM "autoflares_transports.sqf";

_plane = _this select 0;
_plane addweapon "CMFlareLauncher";
_plane addMagazineTurret ["120Rnd_CMFlareMagazine",[-1]];

_plane addEventHandler ["incomingmissile",{
_this spawn {
_plane = _this select 0;
_pilot = driver _plane;
_plane selectweapon "CMFlareLauncher";
_pilot sidechat "SAM Launch!,SAM Launch!!";
for "_i" from 0 to 6 do {sleep 0.3;_plane action ["useweapon",vehicle _plane,driver _plane,0];};
};      
}];

helicopter version-
place in init of helicopter-
null = [this] execVM "autoflares_heli.sqf";
autoflares_heli.sqf
//countermeasures autoflares script helicopter (miltary & civilian) version.
//Place code in any helicopters init of any side-
//null = [this] execVM "autoflares_heli.sqf";

//Autofire flares if helicopter under SAM missile attack.
_heli = _this select 0;
_heli addweapon "CMFlareLauncher";
_heli addMagazineTurret ["120Rnd_CMFlareMagazine",[-1]];

_heli addEventHandler ["incomingmissile",{
_this spawn {
_heli = _this select 0;
_pilot = driver _heli;
_heli selectweapon "CMFlareLauncher";
_pilot sidechat "SAM Launch!,SAM Launch!!";
for "_i" from 0 to 4 do {sleep 0.01;_heli fire "CMFlarelauncher";};
};      
}];

If any idea to improve this script, anyone can post replies.

This post was edited by warbird (2017-08-11 23:04, 67 days ago)