View Single Post
  #6  
Old 08-09-2012, 03:43 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

There are different ways to spawn a new aircraft. Via action is the simplest .

To do so, create a new mission, place the Airgroup on the map, enable only script spawn in the Object Options (if you don't do that your Airgroup spawns at beginning of the mission and than again if you call it via action.Do()). Create an action for it in the script -> action tab, give a simple name for example SpawnEnemyPlane, select the airgroup to spawn. Then save and save the mission.


Add a flag to the cs file, to avoid multiple spawning of the airgroup
Code:
    bool Spawned = false;

Then in your OnTickGame
Code:
if (I_Altitude > 400 && !Spawned)
{
    Spawned = true;
    GamePlay.gpHUDLogCenter("above 400");
    AiAction action = GamePlay.gpGetAction("SpawnEnemyPlane"));
    if (action != null)
    {
        action.Do();
    }
}
Reply With Quote