View Single Post
  #23  
Old 10-15-2011, 05:11 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

It's possible, the easy way.

Code:
using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{

    public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);

        if (actor is AiAircraft)
        {
            switch ((actor as AiAircraft).InternalTypeName())
            {
                case "bob:Aircraft.Ju-87B-2":
                case "bob:Aircraft.Ju-88A-1":
                case "bob:Aircraft.He-111H-2":
                case "bob:Aircraft.He-111P-2":

                    Timeout(60, () =>    // Time in Seconds
                         {
                             (actor as AiAircraft).Destroy();
                         });
                    break;
            }
        }
    }

}
The script destroy()ing the planes after an amount of time (in the example 60sec). So by creation of the plane you give a "selfdestruct" command that are executed the time you specified. To avoid vanishing of other planes you should specify the planes. In example only the Stukas, Ju88, He111H2 und P2 will be destroy()ed. Destroy() means the plane is removed from game.

An other possibility is to check if the plane reach the last waypoint and then destroy it, but this is a little bit more complicated.

Last edited by FG28_Kodiak; 10-15-2011 at 05:13 PM.
Reply With Quote