Could some C# experts check this part of script for errors. Trying to randomize submission loading here. Thanks to Groundhog for idea.
Intended to run in cycle forever. Does not work for me (
Need help please.
Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
public class Mission : AMission
{
// loading sub-missions
public override void OnTickGame()
{
if (Time.tickCounter() % 54000 == 12600) // 54000=30 min repeat. 12600=7 min delay.
{
// randomly selects 1 of several submissions
Random RandomIncident = new Random();
switch (RandomIncident.Next(1, 3))
{
case 1:
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/BoF1/BoF1_air01.mis");
// GamePlay.gpHUDLogCenter("mis1 loaded!");
double initTime = 0.0;
Timeout(initTime += 600, () =>
{
GamePlay.gpHUDLogCenter("Attention! Enemy activity is expected at E3!");
});
Timeout(initTime += 600, () =>
{
GamePlay.gpHUDLogCenter("Attention! Help is needed at E3/D4!");
});
break;
case 2:
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/BoF1/BoF1_sea01.mis");
// GamePlay.gpHUDLogCenter("mis2 loaded");
double initTime = 0.0;
Timeout(initTime += 500, () =>
{
GamePlay.gpHUDLogCenter("Attention! Cover your shipping at C4!");
});
Timeout(initTime += 300, () =>
{
GamePlay.gpHUDLogCenter("Attention! Ships are under attack at C4!");
});
break;
case 3:
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/BoF1/BoF1_air02.mis");
// GamePlay.gpHUDLogCenter("mis3 loaded!");
double initTime = 0.0;
Timeout(initTime += 600, () =>
{
GamePlay.gpHUDLogCenter("Attention! Enemy activity is expected at E2!");
});
Timeout(initTime += 300, () =>
{
GamePlay.gpHUDLogCenter("Attention! All airgroups please proceed to E2/D3!");
});
break;
}
}
///////////////////////
//loads small submissions w/o messages
if (Time.tickCounter() % 216000 == 108000) // 216000=120 min repeat. 108000=60 min delay.
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/BoF1/BoF1_small01.mis");
}
if (Time.tickCounter() % 216000 == 215999) // 216000=120 min repeat. 215999=120 min delay.
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/BoF1/BoF1_small02.mis");
}
}
}