View Single Post
  #1  
Old 04-01-2012, 09:32 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default Aircraft abort mission (RTB) if damaged?

I'm trying to get an individual aircraft in an airgroup to RTB if a certain amount of damage or a particularly vital ststem is damaged. As a start, I'm just seeing if I can get the group or an airvraft in the group to RTB with the code below. I recall reading somewhere that you can't assign AI's new waypoints on the fly & that they have to go to their next waypoint before any dynamically added waypoints become active. Am I on the right track here? can anyone suggest a methodology?

Code:
    public override void OnAircraftDamaged(int missionNumber, string shortName, AiAircraft aircraft, AiDamageInitiator initiator, part.NamedDamageTypes damageType)
    {
        base.OnAircraftDamaged(missionNumber, shortName, aircraft, initiator, damageType);

        if (aircraft is AiAircraft && aircraft != null)
        {
            aircraft.AirGroup().setTask(AiAirGroupTask.LANDING, null);
         }
    }
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE
Reply With Quote