View Single Post
  #18  
Old 09-16-2011, 06:46 PM
Das Attorney Das Attorney is offline
Approved Member
 
Join Date: May 2011
Posts: 142
Default

Yes that's looking good

I haven't tested your one but it should work. I left in the condition to check for an airfield and added the condition to check for player planes:

Code:
    public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftLanded(missionNumber, shortName, aircraft);

        AiAirport NearestAirport = FindNearestAirport(aircraft);
        //if (NearestAirport != null)

        if ((NearestAirport != null) && (!isAiControlledPlane(aircraft)))
        {
            PlanesQueue CurPlane = new PlanesQueue(aircraft, NearestAirport, 0);
            int ArmyPos = 0;
            CurPlane.health = (float)aircraft.getParameter(part.ParameterTypes.M_Health, -1);
            if (GamePlay.gpFrontExist())
            {
                ArmyPos = GamePlay.gpFrontArmy(NearestAirport.Pos().x, NearestAirport.Pos().y);
            }
            else { ArmyPos = aircraft.Army(); };
            if (CurPlane.health < 1f)
            {
                CurPlane.State |= ServiceType.EMERGENCY;
                CurPlane.State |= ServiceType.FIRE;
            }
            else if (aircraft.Army() == ArmyPos)
            {
                CurPlane.State |= ServiceType.FUEL;
                CurPlane.State |= ServiceType.AMMO;
                if (aircraft.Type() == AircraftType.Bomber) CurPlane.State |= ServiceType.BOMBS;
            };
            if (!(aircraft.Army() == ArmyPos)) CurPlane.State |= ServiceType.PRISONERCAPTURE;
            if (!CurPlanesQueue.Contains(CurPlane))
            {
                CurPlanesQueue.Add(CurPlane);
                CheckEmrgCarOnAirport(CurPlanesQueue.Count - 1);
            }
            else
            {
                for (int i = 0; i < CurPlanesQueue.Count; i++)
                    if (CurPlanesQueue[i] == CurPlane)
                    {
                        CheckEmrgCarOnAirport(i);
                        break;
                    }
            }
            CurPlane = null;
        };

    }
There's probably a set of unnecessary brackets in there, but it works ok. I haven't tested on a dedicated server, just a hosted one.

If you've got any hints for setting up a repair script, please share I can't find the scripting commands in the beta code, so any pointers would be welcome!

I'm hoping that we can get a reference page for scripting commands on a wiki, much like this one:

http://community.bistudio.com/wiki/C...Commands_ArmA2

That would be really useful.
Reply With Quote