When restarting a mission (e.g. #restart command or a game mode with auto reload enabled), the mission header settings in the server config JSON get ignored.
Description
Details
- Severity
- None
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 11 x64
- Category
- General
- Start a mission on a dedicated server with some "missionHeader" parameters changed in the server config JSON.
- Join the server, log in as admin and execute the "#restart" command.
There seems to be also other settings that get ignored on restart, for instance, "disableThirdPerson".
Event Timeline
Since this hasn't been tested yet, I'll take the liberty to provide a more detailed repro. I created and published a test mod with the ID 5EAC510A8E6EC623, which contains the following code and in essence defines a new variable for the mission header and its value is written in the chat for all clients:
//------------------------------------------------------------------------------------------------ modded class SCR_MissionHeader : MissionHeader { [Attribute(defvalue: "11", desc: "My mission header variable")] int m_iMHT_myVariable; }; //------------------------------------------------------------------------------------------------ modded class SCR_BaseGameMode : BaseGameMode { //------------------------------------------------------------------------------------------------ //! Schedule printing of my header variable override protected void OnGameStart() { super.OnGameStart(); if (!Replication.IsServer()) return; GetGame().GetCallqueue().CallLater(MHT_PrintMyVariable, 1000, true); } //------------------------------------------------------------------------------------------------ //! Broadcast and print my variable to all clients protected void MHT_PrintMyVariable() { SCR_MissionHeader header = SCR_MissionHeader.Cast(GetGame().GetMissionHeader()); if (!header) return; Rpc(MHT_PrintInChatBroadcast, header.m_iMHT_myVariable.ToString()); } //------------------------------------------------------------------------------------------------ //! Print chat message for all clients [RplRpc(RplChannel.Unreliable, RplRcver.Broadcast)] protected void MHT_PrintInChatBroadcast(string message) { PlayerController ctrl = GetGame().GetPlayerController(); if (!ctrl) return; SCR_ChatComponent.Cast(ctrl.FindComponent(SCR_ChatComponent)).ShowMessage(message); } }
And I have the following configuration for my dedicated server:
{ "bindAddress": "", "bindPort": 2001, "publicAddress": "", "publicPort": 2001, "game": { "name": "Kex's Mission Header Test", "passwordAdmin": "pw", "scenarioId": "{83D06A42096F671C}Missions/MpTest/10_MpTest.conf", "maxPlayers": 10, "gameProperties": { "missionHeader": { "m_iMHT_myVariable": 7 } }, "mods": [ { "modId": "5EAC510A8E6EC623", "name": "Mission Header Test" } ] } }
The expected behavior is that if you connect to the server, you should see 7 printed in the chat. This is initially indeed the case, however if you execute #login pw followed by #login restart, you will see that 11 will be printed after the restart. I hope this helps resolving the issue.
Source code: