ATAG_Bliss
09-24-2011, 12:30 AM
I'm sure others may have figured this out (rotating missions), but I was baffled for the longest time on how to do it. One of the things we always ran into was if you loaded another mission, even after the battle stop command, the initial mission would still be running - the server/map time would not change, the map would not change, and the only thing that would happen is the objects of the 2nd, 3rd, etc, mission being loaded would be the only thing showing up. For instance going from an English channel map to a quake map would simply keep the English channel map going, with it's current time etc and it would not change.
So here's how we've figured out how to do it. I'm sure there are other ways, but this is what we've found out how to work.
Some basic understanding 1st: I load missions with .cmd files (right or wrong), so lets say I want to load a mission - I open up the dedi server and direct the server to load the .cmd file of the mission I want to load.
For instance, lets say mission1.cmd is the name. (on a side note the dedicated server / dos window's default loading directly is in the Documents\1C SoftClub\il-2 sturmovik cliffs of dover folder - the same spot the confs.ini is in for example)
So if I want to load mission1.cmd I'll type f mission1.cmd in the dos box. f is the command to load a file in the dos/server window. For a further list of commands you can type ? or help in the dedi server box. So here's an example of what will be inside mission1.cmd:
missLoad missions/multi/dogfight/mission1.mis
battle start
Basically typingf mission1.cmd in the dos box will load the mission in the .cmd file :) (duh right?) and it's obviously easier typing out that than all the words quoted to simply load a mission and start the battle.
So moving on. We now have a mission running, but lets say we want to move on to another mission after a certain amount of time. (again I'm sure this could be done with scripting, but this is my way :grin:)
So building on that code from before lets add a line.
missLoad missions/multi/dogfight/mission1.mis
battle start
timeout 60 f stop.cmd
timeout 60 will wait 60 seconds then load stop.cmd (before anyone asks I have to tell you that you can not use a timeout command followed by a missLoad (mission load) command. So timeout 60 missLoad xxxxx.mis will not work and cause an error)
Inside the stop.cmd we'll have this:
battle stop
file mission2.cmd
***This is the important part***
Battle stop is the command to stop the battle on the server. This readies the server for another mission. So now that we've stopped the current battle, it's time to load another mission. If you notice I'm not using f mission2.cmd but instead am using file mission2.cmd. (if you don't use file this will not work and your 1st mission will remain) The file command seems to break/interrupt the current mission and allows the new mission to be loaded (new map, time etc.) Did I say you have to use file? :)
So now the battle has stopped and we are loading mission2.cmd with file, here's an example of what could be inside mission2.cmd:
missLoad missions/multi/dogfight/mission2.mis
battle start
timeout 60 f stop2.cmd
This loads your mission named mission2 and starts the battle. What players will experience is a screen of only a few seconds stating the battle has ended/stopped, then almost immediately they will see the loading bar at the bottom of the screen and be in the new mission!
So now we've started one mission and within 60 seconds rotated to a another mission. Inside the stop2.cmd we could have something that looks like this:
battle stop
file mission1.cmd
So if you get what's happening now, you'll notice that I've created a never ending loop. Basically mission1 will load and within 60 seconds mission2 loads, and in another 60 seconds it will go back to mission1 and repeat indefinitely.
Obviously the timeout's (say 3 hours or so) could be used instead of 60 seconds, and you could daisy chain as many missions as you want in a row as I've done to have many more missions rotating than 2. But in order to do this you must be able to de-spawn/destroy all the static objects in your mission before you load another one as they will accumulate from mission to mission if you don't.
So if you had a timeout of an hour or 3600s, you should put your despawn/destroy script roughly 5-10 seconds before the mission change 3550s. And you should be all set.
Hope this helps.
And hopefully someone will post up a way of loading a completely new mission (mission rotation) via C#!
So here's how we've figured out how to do it. I'm sure there are other ways, but this is what we've found out how to work.
Some basic understanding 1st: I load missions with .cmd files (right or wrong), so lets say I want to load a mission - I open up the dedi server and direct the server to load the .cmd file of the mission I want to load.
For instance, lets say mission1.cmd is the name. (on a side note the dedicated server / dos window's default loading directly is in the Documents\1C SoftClub\il-2 sturmovik cliffs of dover folder - the same spot the confs.ini is in for example)
So if I want to load mission1.cmd I'll type f mission1.cmd in the dos box. f is the command to load a file in the dos/server window. For a further list of commands you can type ? or help in the dedi server box. So here's an example of what will be inside mission1.cmd:
missLoad missions/multi/dogfight/mission1.mis
battle start
Basically typingf mission1.cmd in the dos box will load the mission in the .cmd file :) (duh right?) and it's obviously easier typing out that than all the words quoted to simply load a mission and start the battle.
So moving on. We now have a mission running, but lets say we want to move on to another mission after a certain amount of time. (again I'm sure this could be done with scripting, but this is my way :grin:)
So building on that code from before lets add a line.
missLoad missions/multi/dogfight/mission1.mis
battle start
timeout 60 f stop.cmd
timeout 60 will wait 60 seconds then load stop.cmd (before anyone asks I have to tell you that you can not use a timeout command followed by a missLoad (mission load) command. So timeout 60 missLoad xxxxx.mis will not work and cause an error)
Inside the stop.cmd we'll have this:
battle stop
file mission2.cmd
***This is the important part***
Battle stop is the command to stop the battle on the server. This readies the server for another mission. So now that we've stopped the current battle, it's time to load another mission. If you notice I'm not using f mission2.cmd but instead am using file mission2.cmd. (if you don't use file this will not work and your 1st mission will remain) The file command seems to break/interrupt the current mission and allows the new mission to be loaded (new map, time etc.) Did I say you have to use file? :)
So now the battle has stopped and we are loading mission2.cmd with file, here's an example of what could be inside mission2.cmd:
missLoad missions/multi/dogfight/mission2.mis
battle start
timeout 60 f stop2.cmd
This loads your mission named mission2 and starts the battle. What players will experience is a screen of only a few seconds stating the battle has ended/stopped, then almost immediately they will see the loading bar at the bottom of the screen and be in the new mission!
So now we've started one mission and within 60 seconds rotated to a another mission. Inside the stop2.cmd we could have something that looks like this:
battle stop
file mission1.cmd
So if you get what's happening now, you'll notice that I've created a never ending loop. Basically mission1 will load and within 60 seconds mission2 loads, and in another 60 seconds it will go back to mission1 and repeat indefinitely.
Obviously the timeout's (say 3 hours or so) could be used instead of 60 seconds, and you could daisy chain as many missions as you want in a row as I've done to have many more missions rotating than 2. But in order to do this you must be able to de-spawn/destroy all the static objects in your mission before you load another one as they will accumulate from mission to mission if you don't.
So if you had a timeout of an hour or 3600s, you should put your despawn/destroy script roughly 5-10 seconds before the mission change 3550s. And you should be all set.
Hope this helps.
And hopefully someone will post up a way of loading a completely new mission (mission rotation) via C#!