Add this script to your mission:
Code:
using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
public class Mission : AMission
{
public override void OnBattleStarted()
{
base.OnBattleStarted();
MissionNumberListener = -1;
}
public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceLeave(player, actor, placeIndex);
Destroy(actor);
}
private bool IsDestroyable(AiActor actor)
{
AiCart cart = actor as AiCart;
if (cart != null)
{
//check if a player is present in actor
for (int i = 0; i < cart.Places(); i++)
if (cart.Player(i) != null)
return false;
}
return true;
}
private void Destroy(AiActor actor)
{
AiCart cart = actor as AiCart;
if (cart != null && IsDestroyable(actor))
cart.Destroy();
}
}
Then the used plane will removed after leaving