Overwriting XMLs to change Lords' equipment works, only sometimes?

Users who are viewing this thread

I am starting my BL modding journey by editing the faction leaders' battle and civilian outfits to make them look more unique and kingly. I did this by adding in custom EquipmentRoster entries to sandboxcore_equipment_sets.xml from the SanboxCore folder and then edited the Lords.xml in the Sandbox folder and replaced the equipment templates for the various lords to point to the new EquipmentRoster entries.



When I drag and drop to overwrite the two XMLs inside the vanilla Sandbox and SandboxCore, it works every time like a charm.



The problem arises when I try and make a custom module for publishing. For whatever reason, the changes seem to only apply to some lords some time. When re-rolling a new sandbox game with the mod activated, 1 - 3 of the 7 lords have the new equipment while the rest is vanilla. It is never the same lords each new Sandbox re-roll, either.



If I had to hazard a guess, it has something to do with the fact vanilla lords equipment roster has multiple options they choose from at random, and for some reason, my custom entries are competing with their other vanilla outfits so they only get chosen some of the time.



I don't understand why this is happening as for the lords to use even one of my custom equipment roster entries, then it should indicate that both lords.xml and sandboxcore_equipment_sets.xml are being touched successfully.



Any ideas?
 
The answer? XSLTs. Did more research, and the "Similar threads" feature below this post helped me.
You should link it to help others.

XSLT is required because if you make your own Lord/troop/npccharacter with the same id as Bannerlord your equipment rosters don't overwrite the vanilla one's they are just added to the pool of equipment from which the character is randomly equipped. An xslt file that removes the vanilla Lord/troop/npccharacter replaced in your mod ensures they only spawn with equipment from your rosters.

The following example removes an imperial recruit:

XML:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

 
    <xsl:template match="NPCCharacter[@id='imperial_recruit']"/>
 
</xsl:stylesheet>

To remove other NPCCharacters just add similar lines to this (below it and before the </xsl:stylesheet> closing tag):
XML:
<xsl:template match="NPCCharacter[@id='imperial_recruit']"/>

replacing imperial_recruit with the id of the NPCCharacter required.
 
Last edited:
Upvote 1
Back
Top Bottom