Hi hipparch,
In the 1st post of this thread there's a sample mission that is attached. It is an old ATAG mission that has AI and should help you get going on to making some of your own.
Within the mission file (.mis file) see below to adjust time of day. So it is showing 10:30AM. For instance set TIME to 14 and that is 2:00PM.
Code:
[MAIN]
MAP Land$English_Channel_1940
BattleArea 157500 150000 200000 120000 10000
TIME 10.5
WeatherIndex 1
CloudsHeight 1500
BreezeActivity 7
ThermalActivity 7
The way the commander works is by using using a script that kills it's process. Basically that script shuts down the server and the commander then switches missions to the next mission. This is found in the scripting file or the ".cs" file in a mission. Please look at the mission attached in the 1st post in this thread. The cs file is also there. Here's a short example of the script just to set mission length.
This is the main command that stops the server: Process.GetCurrentProcess().Kill();
So basically in this case, the if the objectives weren't destroyed within 6 hours or 720000 ticks, the mission results in a tie and moves on to the next one.
There is also quite a few more missions in the download section of the forum to play with.
Code:
public override void OnTickGame()
{
Tick_Mission_Time = 720000 - Time.tickCounter();
var Mission_Time = Tick_Mission_Time / 2000;
TimeSpan Convert_Ticks = TimeSpan.FromMinutes(Mission_Time);
string Time_Remaining = string.Format("{0:D2}:{1:D2}:{2:D2}", Convert_Ticks.Hours, Convert_Ticks.Minutes, Convert_Ticks.Seconds);
if (Time.tickCounter() % 30000 == 1000)
{
GamePlay.gpLogServer(null, "Completed Red Objectives:", new object[] { });
GamePlay.gpLogServer(null, (Objective_Total_Red), new object[] { });
Timeout(10, () =>
GamePlay.gpLogServer(null, "Completed Blue Objectives:", new object[] { }));
Timeout(11, () =>
GamePlay.gpLogServer(null, (Objective_Total_Blue), new object[] { }));
Timeout(12, () =>
GamePlay.gpLogServer(null, "Time Remaining In Mission: " + Time_Remaining, new object[] { }));
}
if (Time.tickCounter() == 720000)// Out of time.
{
Timeout(10, () =>
{
GamePlay.gpLogServer(null, "The match ends in a tie! Objectives still left for both sides!!!", new object[] { });
GamePlay.gpHUDLogCenter("The match ends in a tie! Objectives still left for both sides!!!");
});
Timeout(30, () =>
{
GamePlay.gpLogServer(null, "Mission is restarting soon!!!", new object[] { });
GamePlay.gpHUDLogCenter("Mission is restarting soon!!!");
});
Timeout(60, () =>
{
GamePlay.gpLogServer(null, "Server Restarting in 1 minute!!!", new object[] { });
GamePlay.gpHUDLogCenter("Server Restarting in 1 minute!!!");
});
Timeout(120, () =>
{
GamePlay.gpLogServer(null, "Mission ended. Please wait 2 minutes to reconnect!!!", new object[] { });
GamePlay.gpHUDLogCenter("Mission ended. Please wait 2 minutes to reconnect!!!");
});
Timeout(125, () =>
{
Process.GetCurrentProcess().Kill();
});
}
}
}
Bookmarks