Simple mods and overwriting native XMLs

Users who are viewing this thread

Hey all, I've been taking attempts at modifying the cloth_materials.xml file and shipping it into a module all day and haven't been getting any luck.

While modifying it in the native module does make an effect in-game, whenever I mimic the file structure into a test module I can't seem to get the modified .xml to load.

What is the syntax required to declare it in the SubModule.xml?

Here is my SubModule.xml
Code:
 <Module>
     <Name value=Cloth Test"/>
     <Id value="ClothTest"/>
     <Version value="v1.0.0"/>
     <SingleplayerModule value="true"/>
     <MultiplayerModule value="false"/>
     <DependedModules/>
     <SubModules>
         <SubModule>
             <Name value="ClothTest"/>
             <DLLName value="ClothTest.dll"/>
             <SubModuleClassType value="ClothTest.Main"/>
             <Tags>
                 <Tag key="DedicatedServerType" value="none" />
                 <Tag key="IsNoRenderModeElement" value="false" />
             </Tags>
         </SubModule>
     </SubModules>
    <Xmls>
        <XmlNode>
            <XmlName type="1" id="NewCloth" path="cloth_materials"/>
        </XmlNode> 
    </Xmls>
 </Module>

Above I went through the C# tutorial listed here to see if the mod loads, which it does.

But now we're at where my issue lies, and that's with the XmlName ID portion. Is the ID given required to be specific in order to overwrite? I like the format of the xml file since it's easy to modify but most methods I've seen modifying the game are through the .dll.
 
Have you tried specifying the included gametypes?

In SandBoxCore/SubModule.xml a XMLNode has an IncludedGameTypes child node
XML:
        <XmlNode>                
            <XmlName id="Items" path="spitems"/>
            <IncludedGameTypes>
                <GameType value = "Campaign"/>
                <GameType value = "CampaignStoryMode"/>
                <GameType value = "CustomGame"/>
            </IncludedGameTypes>
        </XmlNode>
 
Last edited:
hello there, I managed to create an XML mod (created a weak short bow to equip some looters, gave it to some of them, and reduced the number of bow equipped forest brigands.)
in your
<XmlNode>
<XmlName type="1" id="NewCloth" path="cloth_materials"/>
</XmlNode>
id must be the id of the basic XML file, where you locate your new whatever. and path must reference the name of the modified XML file.
ie:
this is my submodule:
XML:
<?xml version="1.0" encoding="utf-8"?>
<Module>
    <Name value = "Rigale2RoC"/>
    <Id value = "Rigale2RoC"/>
    <Version value = "v1.0.0"/>
    <SingleplayerModule value="true"/>
    <MultiplayerModule value="false"/>
    <DependedModules/>
   
    <SubModules/>
            <!--    <SubModule>
            <Name value = "Rigale2RoC"/>
            <DLLName value = "Rigale2RoC.dll"/>
            <SubModuleClassType value = "Rigale2RoC.Main"/>
            <Tags>
                <Tag key="DedicatedServerType" value ="none" />
                <Tag key="IsNoRenderModeElement" value ="false" />
            </Tags>
        </SubModule>
    </SubModules>
    -->
    <Xmls>
        <XmlNode>              
            <XmlName type="1" id="NPCCharacters" path="Rigalebandits"/>
        </XmlNode>
        <XmlNode>              
            <XmlName type="1" id="Items" path="Rigalespitems"/>
        </XmlNode>  
<!--        <IncludedGameTypes>
            <GameType value = "Campaign"/>
            <GameType value = "CampaignStoryMode"/>
            <GameType value = "CustomGame"/>
        </IncludedGameTypes>    -->  
    </Xmls>

</Module>
<XmlName type="1" id="NPCCharacters" path="Rigalebandits"/>
you can find the id here, E:\SteamLibrary\steamapps\common\Mount & Blade II Bannerlord\Modules\SandBox\ModuleData\bandits.xml (my install oc)
in this file the very beginning looks like this:
<NPCCharacters>
<NPCCharacter id="looter" default_group="Infantry" name="{=urUwa4bf}Looter" level="6" occupation="Bandit" culture="Culture.looters">

so in this case, the id is "NPCCharacters", and my path is
E:\SteamLibrary\steamapps\common\Mount & Blade II Bannerlord\Modules\Rigale2RoC\ModuleData\Rigalebandits.xml

I hope this helps.
you can download the mod from here:
 
Last edited:
<XmlName type="1" id="NPCCharacters" path="Rigalebandits"/>
you can find the id here, E:\SteamLibrary\steamapps\common\Mount & Blade II Bannerlord\Modules\SandBox\ModuleData\bandits.xml (my install oc)
in this file the very beginning looks like this:
<NPCCharacters>
<NPCCharacter id="looter" default_group="Infantry" name="{=urUwa4bf}Looter" level="6" occupation="Bandit" culture="Culture.looters">

so in this case, the id is "NPCCharacters", and my path is
E:\SteamLibrary\steamapps\common\Mount & Blade II Bannerlord\Modules\Rigale2RoC\ModuleData\Rigalebandits.xml

I hope this helps.
you can download the mod from here:

That was an important piece I was missing, thank you for clarifying. I did however manage to find where my issue lies after reading over the XML documentation.

Important

XMLs with the same id from two separate mods (or the same mod) will have their assets combined and NOT overwritten. However, if two objects within an XML have the same id (e.g. two items), they will Overwrite each other in ModLoading Order as seen in the Launcher. Knowing this can be useful for overwritting native assets.

MPClassDivisions Is currently broken.

It seems I am merging the changed assets as new assets, instead of overwriting them. I suppose I will have to look to the C# method in order to overwrite xml attributes or hope the ModLoading objects method is clarified.

After pondering over what objects meant, my assumption is <materials> should've been overwritten in the first place.
 
Last edited:
Important:
I couldn't figure out how to change mods load order. So I renamed my mod "ZRigale" (and gave the same name to the XML identifiers in the submodule, and it is now positionned last in the mod folder, so it loads last, and it indeed loads my modifications now.
 
Important:
I couldn't figure out how to change mods load order. So I renamed my mod "ZRigale" (and gave the same name to the XML identifiers in the submodule, and it is now positionned last in the mod folder, so it loads last, and it indeed loads my modifications now.
Thanks for the answer, I was also having this issue! If you don't mind, I am gonna dig around in your mod to see what I could do on my own!
 
Maybe cloth_materials bypasses the entire XML system? I think it's called by a .dll so I have no chance at overwriting it even though the documentation says everything is correct.
 
Back
Top Bottom