Next block is constants and parameters, although I have listed some despawntime variables in here as well, these are for altered the despawning time period for AI in game, depending on flight paths and so on and mission design you alter this period for ai time in game before despawn. I have 3 timers, for different conditions. The main, despawntime is set to 2700 or 45mins.
Code:
/*=========================================*/
#region const's and params
//Tx's To
private const int All = -1;
private const int Allies = 1;
private const int Axis = 2;
//Despawner time varible
//To times 5min=300 10min=600 15min=900 30min=1800 45min=2700 60min=3600
private double despawntime = 2700;//ai aircraft despawn
private double despawntime2 = 300;//secondary ai aircraft despawn
private double despawntime3 = 2700;//ground ai despawn
//Goes with time indicator, set period for cycle repeat period: value = seconds
//1mins=60sec=1800ticks
private double ts = 60;
//trigger boolean start point condition
bool pDE1 = false;
bool pDE2 = false;
bool pDE3 = false;
bool pDE4 = false;
bool pUK1 = false;
bool pUK2 = false;
bool pUK3 = false;
bool pUK4 = false;
private int rm;
private int bm;
/*
[Trigger]
uk1 TPassThrough 5 2 12025 10315 15000
uk2 TPassThrough 5 2 12025 10315 10000
uk3 TPassThrough 5 2 12025 10315 5000
de1 TPassThrough 5 1 30440 31260 15000
de2 TPassThrough 5 1 30440 31260 10000
de3 TPassThrough 5 1 30440 31260 5000
*/
Point2d DEr1 = new Point2d(30440, 31260);// radar trigger(Red active)
Point2d UKr1 = new Point2d(12025, 10315);// radar trigger(Blue active)
//listen to events from all missions.
public override void OnBattleStarted()
{
base.OnBattleStarted();
MissionNumberListener = -1;
}
#endregion
/*=========================================*/
The next block is the main core engine for sub mission loading on random selection. Before I explain operation here I need to mention alterations to the messaging setup, otherwise it will look complex when it is not.
This is Kodiaks last messaging script, but I have modified with abbreviations, because the other code becomes smaller when you do this. The core change is the abbreviation “STxA” which means Screen text to armies and “Tx”, which means text.
Code:
/*=========================================*/
#region STxA Screen Text to Armies
private void STxA(int army, string Tx, params object[] args)
{
List<Player> Consignees = new List<Player>();
if (GamePlay.gpPlayer() != null)
Consignees.Add(GamePlay.gpPlayer());
if (GamePlay.gpRemotePlayers() != null)
Consignees.AddRange(GamePlay.gpRemotePlayers());
if (army == -1)
GamePlay.gpHUDLogCenter(null, Tx);
else if (Consignees.Exists(item => item.Army() == army))
GamePlay.gpHUDLogCenter(Consignees.FindAll(item => item.Army() == army).ToArray(), Tx);
}
#endregion
/*=========================================*/