When introducing subconfigs as attributes to a mission header and force the creation of an instance through the server config JSON, their attributes get initialized with null values instead of the specified defaults.
Description
Description
Details
Details
- Severity
- None
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 11 x64
- Category
- General
Steps To Reproduce
- Create a mod that adds a subconfig to the mission header and prints its values
//------------------------------------------------------------------------------------------------ modded class SCR_MissionHeader : MissionHeader { [Attribute()] ref MySubConfig m_MySubConfig; } //------------------------------------------------------------------------------------------------ class MySubConfig : ScriptAndConfig { [Attribute(defvalue: "42")] int m_iMyInt; [Attribute(defvalue: "3.1415")] float m_fMyFloat; } //------------------------------------------------------------------------------------------------ modded class ArmaReforgerScripted : ChimeraGame { //------------------------------------------------------------------------------------------------ override bool OnGameStart() { SCR_MissionHeader header = SCR_MissionHeader.Cast(GetGame().GetMissionHeader()); if (header && header.m_MySubConfig) { PrintFormat("m_MySubConfig.m_iMyInt = %1", header.m_MySubConfig.m_iMyInt); PrintFormat("m_MySubConfig.m_fMyFloat = %1", header.m_MySubConfig.m_fMyFloat); } return super.OnGameStart(); } }
- Start a dedicated server with said mod and specify the following in the mission header section of the server config JSON:
"missionHeader": { "m_MySubConfig": { "m_fMyFloat" = 2.718 } }
- Notice that m_fMyFloat is 2.718 as expected, but m_iMyInt is 0 instead of 42.
Additional Information
A workaround could be to create an instance of the of the subconfig in the config file. The problem, however, is that there's not a common config file all mission headers inherit from, where this could be done.