Jump to content
AZCoder

AI Keep Getting Back Into Helicopters

Recommended Posts

[rant]As the title says, the AI are really annoying at times, ignoring commands issued to them in order to do whatever they feel like.[/rant]

 

The specific problem is that I have squads jumping out of helicopters. That part works fine. The issue is that the helicopters then land and pick up the AI teams again before continuing on their waypoints. OR the helicopters don't land, but they stop and hover instead of going on their waypoints. What's the trick to make things work?

 


{
        sleep 0.5;
        // _x action ["EJECT",_aircraft];
        moveOut _x;
        unassignVehicle _x;
        _x allowDamage false; // many die on landing (sigh)
    } forEach _units;
    _units allowGetIn false;

 

Share this post


Link to post
Share on other sites

try something like:

0 = [] spawn {
zz = (units sqd1 + units sqd2);
{
sleep 0.5;
moveOut _x;
_x leaveVehicle helo;
_x addBackpackGlobal "B_parachute";
helo land "none";
} forEach zz;
};

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks, Pierre. I found that the root issue is that the AI team leader is ordering the units back into the helicopter.

It's like 'unassignVehicle' doesn't work lately. I have seen units get back into ground vehicles as well as helicopters despite that command.

 

What's happening now is that as soon as units start jumping out, the pilot of the helicopter puts on the "brakes", pulling up sharply and goes into a hover. This is completely unsatisfactory. Surely it can't be this hard. I used to do this in Arma 2 without all this trouble. I achieved this goal in another mission by actually flying the helicopter myself with the UNIT_PLAY function, but that's not practical when I'm using lots of helicopters.

Share this post


Link to post
Share on other sites

I think I have it working satisfactorily. It has a couple hacks in it, one being the land "NONE" from Pierre, but I had to loop it until everyone jumps out. The other is detect if the helo stops at a waypoint and then tell it to go to the next waypoint.

 


AZC_FNC_PARADROP =
{
    params["_helo"];
    // units complain about no ammo while floating, disable radio temporarily
    enableRadio false;
    private["_units","_group1","_group2","_group3"];
    _units = fullCrew [_helo,"cargo",false] apply { _x select 0; };
    { unassignVehicle _x } forEach _units;
    _units allowGetIn false;
    
    [_units,_helo] spawn
    {
        params["_groupUnits","_helo"];
        while { { (_x in _helo) } count _groupUnits > 0 } do
        {
            _helo land "NONE";
        };
        
        // usually they stop at waypoint 2 for no reason
        waitUntil { speed _helo < 5 };
        _waypoint = currentWaypoint (group _helo);
        if (_waypoint < 3) then
        {
            (group _helo) setCurrentWaypoint [(group _helo),(_waypoint + 1)];
        }
        else
        {
            if (_waypoint == 3) then { (units group _helo) call AZC_fnc_Delete; };
        };
    };
    
    {
        sleep 0.5;
        _x addBackpack "B_Parachute";
        _x action ["Eject",(vehicle _x)];
        _x allowDamage false;
    } forEach _units;
    _units allowGetIn false;

    {
        [_x] spawn
        {
            params["_unit"];
            waitUntil { isTouchingGround _unit };
            // this code snippet is from cobra4v320 COB_HALO
            _unit setPos [(getPos _unit select 0), (getPos _unit select 1), 0];
            _unit setVelocity [0,0,0];
            _unit setVectorUp [0,0,1];
            sleep 1;
            _unit allowDamage true;
        };
    } forEach _units;
    
    waitUntil { isTouchingGround player };
    enableRadio true;
};

Share this post


Link to post
Share on other sites

Funny, I have exactly the same issue in one of my missions. No matter what I do, the stupid helicopter goes back to landing, because the ai squad wants to board it again. This certainly wasn't a thing some time ago.

  • Like 1

Share this post


Link to post
Share on other sites

Strange I have no issues with the first script after giving them a chute, even  _x action ["EJECT",_aircraft] instead of moveout works without issues.

 

I tried single and multiple groups with the chopper starting in the air and or on the ground using moveincargo and the waypoints getin  method with zero issues.

 

Even removing unassignVehicle _x; only results in chopper hovering  over the units it doesn't land.

 

Maybe post an example mission of it failing that might show something. 

 

 

 

 

Share this post


Link to post
Share on other sites

I had this problem, posted here.

(btw cba or rhs addons don't fix it)

after making sure it all worked perfectly i tried a dedicated server test and then heli's wouldn't land, I might get back to it one day and fix that issue if it can be fixed or maybe i won't.

 

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

×