Reading mod config from XML file

Users who are viewing this thread

Hey there,

I am looking for a way to read the configuration for a mod I am working on from an XML file.
Or maybe even for an explanation as to why the method I have used so far makes the game crash on start-up.

I am fairly new to modding, so this question might be a bit basic.
What I am trying to do is modify how much renown is gained from battles and tournaments and I want an XML file in which I can enable/disable either multiplier and set the corresponding multipliers.

I have managed to get my mod to work without reading the configuration from an external file but rather hardcoding the settings.

I have tried using XmlDocument, XmlReader and similar but whenever the mod tries to actually open the XML file the game crashes.
The methods seemingly causing this are the XmlDocument.LoadXml(XMLFile), XMLDocument.Load(XmlReader) after creating a reader with the corresponding stream.
What seemed to (kind of) work was XmlReader.Read() but with no ability to put it in a while loop, that would crash the game again.

What exactly causes the game to crash I cannot tell...

Any suggestions or maybe clarifications (if known) how the game handles custom XML files would be welcome!
 
I don't have the time to explain how this works, but you can see what we do with our serialisation here:

We read all our data from XML, including game settings and save data.
 
Upvote 0
Back
Top Bottom