View Single Post
  #1  
Old 02-24-2014, 07:31 PM
theOden theOden is offline
Approved Member
 
Join Date: May 2011
Location: Sweden
Posts: 221
Default OnAircraftTookOff broken?

I have these simple overrides but "OnAircraftTookOff" just refuse to trigger.
Back in the old days I built a simple BoB campaign using this among others and unless I'm way too senile by now this used to work?

I slapped in "OnPlaceEnter" for reference and that bugger does work.

Anyone more up-to-date with Dover than me who knows what might be missing?

TF 4.0 is in use btw and no errors in log.txt and the gpLogServer never shows in the log either.

Code:

    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);

        GamePlay.gpLogServer(null, "OnPlaceEnter '{0}' '{1}'", new object[] { actor.Name(), placeIndex });
        GamePlay.gpHUDLogCenter("OnPlaceEnter");
    }

    public override void OnAircraftTookOff(int missionNumber, string shortName, AiAircraft aircraft)
    {
        GamePlay.gpLogServer(null, "OnAircraftTookOff '{0}' '{1}'", new object[] { shortName, aircraft.TypedName() });
        GamePlay.gpHUDLogCenter("OnAircraftTookOff");
        bool activateBombers = false;
        if (GamePlay.gpIsServerSingle())
        {   // player CAP
            if (aircraft.Player(0) != null)
                if (!activateBombers)
                    activateBombers = true;
        } else {
            if(aircraft.Player(0) != null)
                activateBombers = true;
            if (!activateBombers)
                foreach (Player p in GamePlay.gpRemotePlayers())
                    if (aircraft == (AiAircraft)p.Place())
                        activateBombers = true;
        };
        activateBombers = true;
        if(activateBombers)
        {
            if (!bWellington)
            {
                GamePlay.gpHUDLogCenter("Wellington bombers are inbound from the north, escort them to target");
                bWellington = true;
                AiAction action = GamePlay.gpGetAction("redAirborne");
                if (action != null) action.Do();
            };
        };
    }



Edit:
Ok, this function is singleplayer only it seems.
Starting to remember why I dropped this product a few ago..
Pure Quality.

Edit2:
Nope, function runs ok in both SP and MP - unless you delete all SP planes when hosted in MP.
Need to create another solution I guess.
__________________

Last edited by theOden; 02-25-2014 at 12:35 PM.
Reply With Quote