Jump to content
Prancer

How to disable aircraft evasive Action

Recommended Posts

First things first i have searched for an answer and i couldn't find one that works for me.i am Trying to get planes to fly straight path to waypoints through anti aircraft fire and trigger ejects paras halfway to waypoint. My issue is that the planes continue to take evasive action scattering troops (some may say realistically) over half the map. I have tried setting unit/waypoint behaviour to careless and stealth, setting combat mode to never fire and hold fire, setting them captive, removing there ammo, letting them handle damage, disabling ai "target" and "autotarget" and still at the first site of enemy AA they wet their pants and take evasive action!! Has anyone got any ideas on how to stop this?

Share this post


Link to post
Share on other sites

In the plane's init:

this setBehaviour "CARELESS";

You might try rearranging attackers as well to provide a path. More likely it's terrain that's getting in your way, if you have a large plane flying at a hill or something they'll turn away often. Play around with flight paths and placement and see if it changes things.

Share this post


Link to post
Share on other sites

I have tried using careless in init but it had no effect. Also this map is virtually flat (i44 Omaha) so has no effect and when AA removed they fly straight to waypoint

Share this post


Link to post
Share on other sites

I may have a work around other than making them the same side, it's a fixed up version of Zapats scrpt http://forums.bistudio.com/showpost.php?p=1907375&postcount=3

I'm not sure it's all that use full as the planes can't hit anything unless the object is exactly in the right place, maybe releasing the Auto pilot a little earlier would give them time to adjust.

private ["_vehicle","_direction","_side","_spawnDistance","_altitude","speed","_speedms","_rDir","_targetPos","_spawnPos","_HeliCrew","_Huey","_pilot","_wait"];

// ****** VARIABLES
_vehicle = "A10";
_direction = 220; //direction @ Chernarus airfield with good view
_side = west;
_spawnDistance = 1500; 
_altitude = 60;
_speed = 200; 
_height = 40;  // Min Height before AutoPilot cancelled 
_damage = 0.5; // Damage before AutoPilot cancelled 

_speedms = _speed / 3.6;
_rDir = _direction + 180;
if (_rDir > 360) then {_rDir = _rDir - 360};

// ****** SPAWNPOS
_targetPos = position player; 
_spawnPos = [(_targetPos select 0) + sin _direction * _spawnDistance,(_targetPos select 1) + cos _direction * _spawnDistance,_altitude];

// ****** CREATE PLANE
_HeliCrew = creategroup _side;

_Huey = ([_spawnPos, _rDir, _vehicle, _HeliCrew] call BIS_fnc_spawnVehicle) select 0;
_Huey setVelocity [sin _rDir *_speedms,cos _rDir *_speedms,0];

_pilot = driver _Huey;

If you wish the AI to return fire you will need to remove the folowing 4 lines
_pilot disableAI "TARGET";
_pilot disableAI "AUTOTARGET";  
_HeliCrew setCombatMode "blue";
_HeliCrew setBehaviour "careless";


// ****** FLYIN
_Huey flyInHeight _altitude;
_pilot doMove _targetPos;

// *******  Basic Auto Pilot

// **** Get Current velocity and place in x,y,z coords
_xv = velocity _Huey select 0;
_yv = velocity _Huey select 1;
_zv = velocity _Huey select 2;

// Get the current pitch of the plane 

_pitchbank = _Huey call BIS_fnc_getPitchBank;
_pitch     = _pitchbank select 0;
_bank      = _pitchbank select 1;

// Keep velocity constant and stop wings from banking
while {alive _Huey and (getdammage _Huey < _Damage) and (getpos _Huey select 2 > _Height) } do
{
 _Huey setVelocity [_xv,_yv,0];                // fixes the velocity and overrides AI, there maybe slight flicker as they fight this.
[_Huey, _pitch,_bank] Call BIS_fnc_setPitchBank;// used to keep wings level
sleep 0.1                                      ;// increase this and planes wonder off course
};

//*******WAIT UNTIL @ TARGET
_wait = true;
while {_wait} do
{
   _Huey limitSpeed _speed + 20; //limit speed (works only in loops)

   if (_Huey distance player < 200) then
   {
       _wait = false; //we are @ targetPos, exit loop
   };
   sleep 1;
};

// ****** WAIT and DELETE
sleep 20;

deleteVehicle _pilot;
deleteGroup _HeliCrew;
deleteVehicle _Huey;  

If you do wish the AI to return fire you will need to remove the following four lines.

_pilot disableAI "TARGET";
_pilot disableAI "AUTOTARGET";  
_HeliCrew setCombatMode "blue";
_HeliCrew setBehaviour "careless";

It does need the function module placing on the map.

.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

just a note for OP, using the script, gives you total control of the plane, and AI has no control at all until its released with the _wait variable.

You are basically pushing it around as a puppet.

Share this post


Link to post
Share on other sites

Thanks for the help guys. With some fiddling after looking at the links posted I have found a code free solution to my problems. That is to put simply into the units init code that it's cowardice level is set so the planes are at their most brave ( I forget the exact phrase). This causes no evasive action at all if plane speed set to limited and some slight banking from side to side whilst directly over AA when speed set to full.

Share this post


Link to post
Share on other sites
Thanks for the help guys. With some fiddling after looking at the links posted I have found a code free solution to my problems. That is to put simply into the units init code that it's cowardice level is set so the planes are at their most brave ( I forget the exact phrase). This causes no evasive action at all if plane speed set to limited and some slight banking from side to side whilst directly over AA when speed set to full.

please post solution for others :)

Share this post


Link to post
Share on other sites
please post solution for others :)

I think he just did.

this allowfleeing 0;

Share this post


Link to post
Share on other sites

naah, alowfleeing doesn't work asfarasiknow. The evasive action is defined in the danger.fsm. If pilot sees smoke, or a friendly going down, he will evade that route, he is not fleeing, just taking another path. PAth is interesting though if you experiment with various enemy-destination setups.

Share this post


Link to post
Share on other sites

yes, as zapat says its an automatic AI response to a threat or possible threat, any other workaround exept for using script like F2k Sel posted or unitcapture will fail for attack air planes when encountering enemy hostiles like AA or armor even regular t72´s will alter the planes path, if its a attack pattern or evasive action is unsure, even though disableAI is used for both target and autotarget, danger.fsm kicks in regardless.

all kinds of variations was tested in the thread i linked above, danger.fsm overides any input, afaik.

Share this post


Link to post
Share on other sites

Just a quick idea (which I won't be able to test this week):

What if we do something like a donkey and carrot setup? DoMove to 20meters ahead, then repeat. Wouldn't it be possible that this way the 20meter long waypoints won't interfere with enemy targets since they are that short?

If you put the waypoint right before the enemy unit, pilot won't go on a detour, that's why I this thought came up... would be interesting to see what it does in practice.

Share this post


Link to post
Share on other sites

i tried something similar before, but not that short, but basically the autocomplete distance of a air vehicle wp is quite big, maybe 1-300m or something.

so a too close doMove command would result in plane turning around to get to the wp, it did not calculate the position to move to before it was already passed, at least that how it looked like.

In my tests the A10 kept doing roundabouts with 300 inbetween doMoves, and proved useless.

but i did not check 20 m or even shorter, maybe AI can calculate that fast enough....

Share this post


Link to post
Share on other sites

Demonized is right I tried different vehicles in the past and they all have a different completion radius.

I really wish careless was exactly that and all units would follow the plan you give them.

Share this post


Link to post
Share on other sites

For the helo's the completion radius seems to be around 70m.

I really wish careless was exactly that and all units would follow the plan you give them.

Ditto. This would really make things a lot easier.

Share this post


Link to post
Share on other sites

I think i found a fix. Place a hostile anti aircraft unit near the starting position of your aircraft, but give it no ammunition. The planes ignore it and then then fly Straight over the "live" enemy units without any evasive moves. Hope this helps, was bugging me for ages :D

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

×