- Code: Select all
Theoretically, this should set the next script used to the script chosen, load the match settings (map list) for the new script, cycle to the next map in that map settings file, and then set new script settings for the new mode.
The last part of that is where it has an issue. Unfortunately, it appears that when the script mode is changed, the mode script setting keys - i.e., "RoundsToWin" in BattleWaves or "S_OffZoneTimeLimit" in Royal - are not updated, and the old script's settings are not replaced with the new script's default settings. So, for example, if I changed from Royal to BattleWaves, the settings will still be "S_MapPointsLimit," "S_OffZoneActiviationTime," etc. - all of the Royal settings - and will not include any of the BattleWaves settings, such as "RoundsToWin" or "RoundsLimit."
This, of course, breaks the new script, since it can't find any of the settings. It ends up getting the server stuck in a loop of the script crashing and the map restarting.
At first, I thought a workaround would be to just set all of the settings with SetModeScriptSettings(), including the defaults. But this, of course, fails with an "Unknown setting" fault from the API, since you can't add new keys with SetModeScriptSettings.
Here is the Python script that contains my change mode function that is having the issue. I'm not sure if I'm missing something here that would make it work. I wanted to eventually have a server that could swap between modes on-the-fly, instead of needing a restart like it does now, but I don't see a way to do so if there's no way to work around this bug. Btw, I'm using API 2012-06-19, don't know if this is an issue in other versions.