your old code
Code:
public override void OnTickGame()
{
if (Time.tickCounter() % 540000 == 27000) // 108000 = 60 min repeat, 27000 = 15 min delay.
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/July1940_v10/Missionen/Mission2.mis");
GamePlay.gpHUDLogCenter(null, "RAF fly CAP between Calais and Dover. Minutes left: {0}", new object[] {});
GamePlay.gpHUDLogCenter(null, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.!\nEscort them to Dover!", new object[] {});
}
}
replace section with
Code:
int timevalue = 10; // a value for test purpose, set to what ever you require noting it could be a varible that changes
public override void OnTickGame()
{
if (Time.tickCounter() % 540000 == 27000) // 108000 = 60 min repeat, 27000 = 15 min delay.
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/July1940_v10/Missionen/Mission2.mis");
ScreenMsg(-1, "MissionMessageToALL");
Timeout(2.0, () =>
{
ScreenMsg(1, "RAF fly CAP between Calais and Dover");
ScreenMsg(2, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.! Escort them", new object[] { timevalue });
});
}
}
The screen message method can go more or less anywhere in the code as its own block. Although must be between the "AMission".
Code:
public class Mission : AMission
{
///your code
private void ScreenMsg(int army, string msg, 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, msg, args);
GamePlay.gpLogServer(null, msg, args);
}
else if (Consignees.Exists(item => item.Army() == army))
{
GamePlay.gpHUDLogCenter(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
GamePlay.gpLogServer(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
}
}
//note the wrapping bracket for AMission
}
C# runs in sequence within methods and classes, but outside each method, classes can more or less be in any order.(new to this myself so still getting to grips)