Forum Jump :

Author Message


Posts: 86
Rank:


Level: Member

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

 
#1 Posted at 2017-06-02 10:14        
     
By default fighter aircraft in arma 2 only engage enemy armor,static weapons and enemy vehicles, this script enables aircraft (A-10,AV-8,Su-25,Su-34) to engage enemy infantry units with their rockets,cannons etc.Once u give planes a target the planes will then circle around and then conduct attack runs.
Place a infantry unit as player on map and group one or more fighter aircraft (set to flying) under player group of lower rank than player.
And place this in init of all aircraft-
engageAI = [this] execVM "CAS.sqf";

place CAS.sqf in mission folder.
cas.sqf
_aircraft = _this select 0;
_target = _aircraft findNearestEnemy player;

while {alive _aircraft} do {
if (!alive _target) then {}
else
{
if (alive _target) then {
_aircraft setcombatmode "RED";
_aircraft setbehaviour "COMBAT";
_aircraft knowsabout _target;
_aircraft domove getpos _target;
_aircraft lookat _target;
_aircraft dowatch _target;
_aircraft doTarget _target;
};
};
sleep 0.1;
};

During mission order aircraft by selecting them (F3,F4 keys) to engage enemy infantry.If u use this script with WW2 planes then the planes will engage enemy infantry with cannons/mg strafing runs.

Map-click CAS script version.
Place on map
invisible H = h1
destroy marker = cas_target
Jets set to flying and named as A1,A2 etc.
player radio trigger-
null = [h1] execVM "callcas.sqf";

Place callCAS.sqf and cas.sqf in mission folder.
callCas.sqf
CASPos = _this select 0;

sleep 1;
titleText ["Click on map position to mark target!","plain down"];
sleep 0.1;
mapclick = true;
onMapSingleClick "casPos setPos _pos;""cas_target"" setMarkerPos _pos;mapclick = false;
onMapSingleClick ''; true;";
waitUntil {!mapClick};

sleep 1;
cas1 = [a1,casPos] execVM "CAS.sqf";
cas2 = [a2,CasPos] execVM "CAS.sqf";

CAS.sqf
_aircraft = _this select 0;
_casPos = _this select 1;
_target = _aircraft findNearestEnemy _casPos;

while {alive _aircraft} do {
if (!alive _target) then {
_aircraft lookat objnull;
_aircraft dowatch objnull;
_aircraft doTarget objnull;
}
else
{
if (alive _target) then {
_aircraft setcombatmode "RED";
_aircraft setbehaviour "COMBAT";
_aircraft knowsabout _target;
_aircraft domove getpos _target;
_aircraft lookat _target;
_aircraft dowatch _target;
_aircraft doTarget _target;
};
};
sleep 0.1;
};

This post was edited by warbird (2017-08-13 12:15, 64 days ago)