PDA

View Full Version : Rotating server missions


salmo
11-26-2011, 12:20 AM
I'm trying to script the rotation (restarting same mission) of server missions every 2 hrs. The mission restarts OK, but it appears that existing planes are not destroyed before launching the mssion again. This leads to an excess of planes sitting around the airfields radius. Can anyone suggest how to correct this. Here's the comand scripts I'm using, I start the server with using
f start1.cmd.

START1.CMD

battles stop

difficulty AntropomorphicControl 0
difficulty ComplexEManagement 1
difficulty TorqueGyroEffects 1
difficulty EngineTemperatureEffects 1
difficulty FlutterEffects 1
difficulty WindTurbulence 1
difficulty StallSpins 1
difficulty Vulnerabilty 1
difficulty BlackoutsRedouts 1
difficulty Realisticgunnery 1
difficulty RealisticBombing 1
difficulty LimitedAmmo 1
difficulty LimitedFuel 1
difficulty CockpitAlwaysOn 0
difficulty NoOutsideViews 0
difficulty HeadShake 1
difficulty NoIcons 1
difficulty NoPadlock 1
difficulty Clouds 1
difficulty TakeoffLanding 1
difficulty RealisticLandings 1
difficulty NoMapIcons 1
difficulty NoMinimapPath 1
difficulty NoAutopilot 1
difficulty NoReplacementPlace 0
difficulty NoReplacement 0
difficulty NoSelect 0
difficulty NoReplacementArmy 0
difficulty NoSelectArmy 0
difficulty NoCreate 0

missLoad "missions\Multi\Dogfight\aus1\main.mis"

REM === 5 min message ===============
timeout 180.00 chat Welcome to AUS_Nations@War server ALL
timeout 200.00 chat please report problems to salmo@netspace.net.au ALL
timeout 340.00 chat Map restarts every 2 hours ALL

REM === 1/2 hr message ===============
timeout 1800.00 chat Welcome to AUS_Nations@War server ALL
timeout 1920.00 chat please report problems to salmo@netspace.net.au ALL
timeout 1860.00 chat Map restarts every 2 hours ALL


REM === 1 hr message ===============
timeout 3600.00 chat Welcome to AUS_Nations@War server ALL
timeout 3620.00 chat please report problems to salmo@netspace.net.au ALL
timeout 3660.00 chat Map restarts every 2 hours ALL


REM === 1 & 1/2 hr message ===============
timeout 5400.00 chat Welcome to AUS_Nations@War server ALL
timeout 5420.00 chat please report problems to salmo@netspace.net.au ALL
timeout 5460.00 chat Map restarts every 2 hours ALL

REM === 2 hr message ===============
timeout 6960.000 chat Map will change in 5 minutes ALL
timeout 7140.000 chat Map will change in 2 minutes ALL
timeout 7200.000 chat Map will change in 1 minutes ALL
timeout 7255.000 chat Map will change in 5 seconds ALL

battle start
timeout 7260.000 f stop.cmd



STOP.CMD

battle stop
file start1.cmd

Ataros
11-26-2011, 06:57 AM
If you do not change map you do not have to use battle stop command. Just destroy all unnecessary actors of the previous mission with a script and load new mission.

salmo
11-26-2011, 10:23 AM
Thanks for advice, changed some of the cmd file text. I'm now using these cmd files. RotateMap.mis contains just the volcano map. Seems to work, but load times between missions can be 1-2 minutes & I'm not sure if this is the most efficient method. I start the server with using f start1.cmd.

Start1.cmd


difficulty AntropomorphicControl 0
difficulty ComplexEManagement 1
difficulty TorqueGyroEffects 1
difficulty EngineTemperatureEffects 1
difficulty FlutterEffects 1
difficulty WindTurbulence 1
difficulty StallSpins 1
difficulty Vulnerabilty 1
difficulty BlackoutsRedouts 1
difficulty Realisticgunnery 1
difficulty RealisticBombing 1
difficulty LimitedAmmo 1
difficulty LimitedFuel 1
difficulty CockpitAlwaysOn 0
difficulty NoOutsideViews 0
difficulty HeadShake 1
difficulty NoIcons 1
difficulty NoPadlock 1
difficulty Clouds 1
difficulty TakeoffLanding 1
difficulty RealisticLandings 1
difficulty NoMapIcons 1
difficulty NoMinimapPath 1
difficulty NoAutopilot 1
difficulty NoReplacementPlace 0
difficulty NoReplacement 0
difficulty NoSelect 0
difficulty NoReplacementArmy 0
difficulty NoSelectArmy 0
difficulty NoCreate 0

missLoad "missions\Multi\Dogfight\aus1\main.mis"

REM === 5 min message ===============
timeout 180.00 chat Welcome to AUS_Nations@War server ALL
timeout 200.00 chat please report problems to salmo@netspace.net.au ALL
timeout 340.00 chat Map restarts every 2 hours ALL

REM === 1/2 hr message ===============
timeout 1800.00 chat Welcome to AUS_Nations@War server ALL
timeout 1920.00 chat please report problems to salmo@netspace.net.au ALL
timeout 1860.00 chat Map restarts every 2 hours ALL


REM === 1 hr message ===============
timeout 3600.00 chat Welcome to AUS_Nations@War server ALL
timeout 3620.00 chat please report problems to salmo@netspace.net.au ALL
timeout 3660.00 chat Map restarts every 2 hours ALL


REM === 1 & 1/2 hr message ===============
timeout 5400.00 chat Welcome to AUS_Nations@War server ALL
timeout 5420.00 chat please report problems to salmo@netspace.net.au ALL
timeout 5460.00 chat Map restarts every 2 hours ALL

REM === 2 hr message ===============
timeout 6960.000 chat Map will change in 5 minutes ALL
timeout 7140.000 chat Map will change in 2 minutes ALL
timeout 7200.000 chat Map will change in 1 minutes ALL
timeout 7255.000 chat Map will change in 5 seconds ALL
timeout 7260.000 f stop.cmd

battle start



Stop.cmd


battle stop
missLoad "missions\Multi\Dogfight\aus1\misc\RotateMap.mis"
battle stop
file start1.cmd

salmo
11-27-2011, 12:15 AM
If you do not change map you do not have to use battle stop command. Just destroy all unnecessary actors of the previous mission with a script and load new mission.

Are you able to supply a script to destroy all actors please. I'm guessing it will be something like...

using maddox.game.world;

public void DestroyAllActors()
{
for each AiActor a in maddox.game.world
{
a.destroy();
}
}

Ataros
11-27-2011, 04:14 PM
Are you able to supply a script to destroy all actors please.

Sorry, I do not have a script which destroys all actors (never used it) but there are some examples in a sticky thread in the FMB section. E.g. I did a timeout OnActorCreated to destroy ground actors in some time.

wildwillie
12-09-2011, 10:59 AM
Salmo -

This is what I use to destroy actors between missions:

1st create a list to store all the objects at the top of the mission script:
private Dictionary<String, AiActor> allActors = new Dictionary<String, AiActor>();

Then I modify the OnActorCreated Script:
public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
{
#region stats
base.OnActorCreated(missionNumber, shortName, actor);
// Add actor to list of all Actors
if (!allActors.ContainsKey(shortName))
allActors.Add(shortName, actor);
try
{
stats.newActor(shortName, actor);
}
catch (Exception ex)
{
System.Console.WriteLine("Stats.OnActorCreated - Exception: " + ex);
}
#endregion
}

Just use the IF statement part. The rest is for my ClodCommander program.

Finally I use the OnBattleStopped trigger to destroy any Actors which have not already been destroyed.

public override void OnBattleStoped()
{
#region stats
base.OnBattleStoped();
try
{
stats.battleStopped();
// Loop through list of AiActors and destroy them all
List<string> keys = new List<string>(allActors.Keys);
for (int i = 0; i < keys.Count; i++)
{
AiActor a = allActors[keys[i]];
AiAircraft aircraft = a as AiAircraft;
if (aircraft != null)
{
aircraft.Destroy();
}
else
{
AiGroundActor aiGroundActor = a as AiGroundActor;
if (aiGroundActor != null)
{
aiGroundActor.Destroy();
}
else
{
System.Console.WriteLine("Stats.OnBattleStoped - Unknown Actor (" + a.Name()+") ShortName ("+keys[i]+")");
}
}
}
}
catch (Exception ex)
{
System.Console.WriteLine("Stats.OnBattleStoped - Exception: " + ex);
}
#endregion
//add your code here
}

Again any code starting with "stats." links to the ClodCommander program.
WildWillie