Jump to content

How to make a PROPER Xml Mod


SomeDudeOnTheW3B

Recommended Posts

I, My name is SomeDude.

And I am currently in a holy war against overriding XML Files in the Sandbox and the SandboxCore module.

I noticed that pretty much every single mod on the nexus that edits xml does it the wrong way!

If you know exactly what I am talking about and are developing a mod, please go to my tutorial here:

https://www.nexusmods.com/mountandblade2bannerlord/mods/61

If you don't know what I am talking about let me explains!

Pretty much every single piece of data in MountAndBlade2 is put inside a xml file.
Xmls are basically list of items (inventory items, troops, characters, factions, dialog lines ...)

What mod authors do when they want to modify one item, say a hero npc called Svana is to edit the file inside Sandbox/ModuleData/lords.xml and modify the NPC "lord_2_12".

What they do then is to upload the file to the nexus.

The result is that EVERY SINGLE NPC in that file will be overriten instead of just Svana !

To deal with that in a mod compatibily fashion is not to override ANY xml files inside Sandbox or SandboxCore BUT to make a new XML Module that will only override the Svana Character!

I made a tutorial that go quite in depth about how to make such mod, any mod authors that override a NativeMod XML should use my method to deal with 90% of mod compatibility issues!


https://www.nexusmods.com/mountandblade2bannerlord/mods/61

Have a nice day!

PS: I hope my post is appropriate and in a good section, first time ever in the nexus forum

Link to comment
Share on other sites

Thank you for this! Like LatchoDrom42 said, I'm no modder, but I also noticed while trying to fix some mods that their xml structure is always correct. That or they are missing things that require the mod to work.
Link to comment
Share on other sites

  • 7 months later...

There are a ton of issues with overriding code in this game. I wish there was some documentation or some tutorials covering all xml issues and exceptions.

 

For instance, your example doesn't work. id="NPCCharacters" exists in a lot of files, dunno why and dunno how the game knows what to access. But if I simply make a copy of spnpccharacters, call it spnpccharacters_mod, and copy your code...

 

<Xmls>
<XmlNode>
<XmlName id="NPCCharacters" path="spnpccharacters_mod"/>
<IncludedGameTypes>
<GameType value = "Campaign"/>
<GameType value = "CampaignStoryMode"/>
<GameType value = "CustomGame"/>
<GameType value = "EditorGame"/>
</IncludedGameTypes>
</XmlNode>

 

...this will not work, the mod is ignored by the launcher, or will crash the launcher. If I exclude the game types, same.

 

Also, there are xmls that don't have the same structure, meaning they start with a

<base xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" type="combat_parameters">

and then have a first element. I didn't manage to understand how these work, so it's a different case scenario for overriding. Everything I tried, like overriding banner colors, is simply ignored in game. No crash, the game launches.. but nothing will happen.

 

I also tried the no-id xml example, that uses project.mbproj, and... shockingly, also contains an ID... as in:

<file id="soln_combat_system" name="ModuleData/native_parameters_mod.xml" type="native_parameters"/>

I have no idea where that soln_combat_system came from, for example.. It's an even more obscure way to override code.

 

And dunno, there could be more exceptions..?

Edited by Arkimedex
Link to comment
Share on other sites

Edit.. because I can't edit my previous post for some reason. I was wrong about the first example, that was my fault, I dind't close the </Xmls>

The second and third case scenario tho.. no idea how that works. If anybody is willing to write a tutorial, that would be superb.. ^ ^

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...