Jump to content
Sign in to follow this  
clydefrog

Aircraft only attack targets above specified height

Recommended Posts

Hi, I'm wondering if it's possible to put an AI jet on a seek and destroy waypoint or something else, and make it only attack targets that are above a specified height? My problem is I have an AI AV8B which scrambles to attack a helicopter but it also goes around bombing stuff too before it shoots the helicopter, once the helicopter is damaged the av8b is deleted so there is no problem after. I'd like to be able to tell it only attack anything that's 10 metres above ground or something. Is this doable? I've tried using the destroy waypoint on the helicopter but it doesn't seem to work. Thanks.

Edited by clydefrog

Share this post


Link to post
Share on other sites

I only have a workaround. If the helicopter is always roughly in the same place then you could do the following.

1. Remove ammo from the harrier

2. Make a trigger somewhere i a good place near the helicopter

3. Make the trigger to be activated by the harrier

4. (name your helicopter helo1). In the trigger type in (in the on act section): "helo1 setdamage 1" without the quotes (0 is fully functional, 1 is completly destroyed).

If you are good at spawning things then you could always spawn a missile that impacts the chopper but i don't know how to do that.

I think the ai engagement is pretty hardcoded in to the engine. As i said, this doesn't really solve your problem, just allows you to get around it.

Share this post


Link to post
Share on other sites

EDIT: fully tested - works for "AV8B2" - to work on any air - remove the correct magazines to be certain.

//init line of aircraft
//hdl = [(vehicle this)] execVM "aironly.sqf";

private ["_target","_pln","_psbltgts","_i","_tgtarr"];

_pln = _this select 0;

_pln removeMagazinesTurret ["14Rnd_FFAR",[-1]];
_pln removeMagazinesTurret ["6Rnd_Mk82",[-1]];
{_pln addMagazine "2Rnd_Sidewinder_AH1Z";} foreach [1,2];


while {alive _pln} do {
 _i = 0;
 _psbltgts = nearestObjects [_pln, ["Air"], 10000];
_tgtarr = [];

{if (side _x == EAST) then {_tgtarr set [_i, _x]; _i = _i + 1;};} forEach _psbltgts;
 {_pln reveal _x;} forEach _psbltgts;
   player sidechat format ["total air targets:%1",count _tgtarr];//debug

_pln doTarget (_tgtarr select 0);

_target = assignedTarget _pln;

if (!(isNull _target) && _target isKindOf "Air") then {
 _pln setBehaviour "AWARE";
   _pln setCombatMode "Red";};

if (!(isNull _target) && !(_target isKindOf "Air")) then {
 _pln setBehaviour "SAFE";
   _pln setCombatMode "White";
 };
   sleep 5;
};

http://community.bistudio.com/wiki/setCombatMode

http://community.bistudio.com/wiki/setBehaviour

Edited by Mattar_Tharkari

Share this post


Link to post
Share on other sites

Sorry - error in the above - conditions at bottom changed - AV8B2 will now totally ignore all ground targets - no engagement at all, no slow diving etc:

//init line of aircraft
//hdl = [(vehicle this)] execVM "aironly.sqf";

private ["_target","_pln","_psbltgts","_i","_tgtarr"];

_pln = _this select 0;
(group _pln) setSpeedMode "LIMITED";

_pln removeMagazinesTurret ["14Rnd_FFAR",[-1]];
 _pln removeMagazinesTurret ["6Rnd_Mk82",[-1]];
   {_pln addMagazine "2Rnd_Sidewinder_AH1Z";} foreach [1,2,3,4];


while {alive _pln} do {
 _i = 0;
 _psbltgts = nearestObjects [_pln, ["Air"], 10000];
_tgtarr = [];

{if (side _x == EAST) then {_tgtarr set [_i, _x]; _i = _i + 1;};} forEach _psbltgts;
 {_pln reveal _x;} forEach _psbltgts;
   player sidechat format ["total air targets:%1",count _tgtarr];

_pln doTarget (_tgtarr select 0);

_target = assignedTarget _pln;

if (!(isNull _target) && _target isKindOf "Air") then {
 _pln setBehaviour "AWARE";
   _pln setCombatMode "Red";};

if (isNull _target || !(_target isKindOf "Air")) then {
 _pln setBehaviour "CARELESS";
   _pln setCombatMode "Blue";
 };
   sleep 10;
};

Edited by Mattar_Tharkari

Share this post


Link to post
Share on other sites

Thanks for this, I'm sure it will still come in useful at some point.

Share this post


Link to post
Share on other sites

Mattar if you can get the planes to not target ground units on the whole map. why can't I limit the planes to only target units like a 3000 by 3000 AO.

Share this post


Link to post
Share on other sites

thanks im using this for a mission where 1 flight of planes is doing air cover while the other flight is bombing in support of an invasion.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×