Mount & Blade II: Bannerlord

In this article I will summarize how this mod works step by step. You can view the source code here.

When the save is loaded (or a new game is started), the item XMLs are loaded and all merged in memory into one, large XML. The following files are loaded, in order:

  • DefaultItems.xml, must be present at all times. Contains only rare vanilla items.
  • CustomItems.xml, user-defined items, could contain anything an user wishes. Features default XML override.
  • Mods directory and all XML files within it. No matter what, all XMLs present here will be present in final, in-memory XML.


If any XML contains invalid data it will be simply ignored. The game will not crash, items simply won't be added.
This approach allows each user to have an unique list of items that will always be available for sale. Depending on how you see it, it's also a drawback - the armoury will always have these items for sale and the armoury will never run out of stock. However, considering most item costs are borked, I think it's fair.
In the future I may add an option to simulate "stock", ie. the item pool will change for each town. It's probably far fetched unless someone wants to contribute.

Afterwards the menu is added to each town's keep. When you press the "Access the Royal Armoury" button, the town's culture is checked and an item list is populated.

If town's owner clan's kingdom is Vlandia, the XML is searched for the following element:

<Vlandia>
<Item .../>
</Vlandia>

If you have a mod that adds new cultures, eg. Cucumberland, XML is searched for this:

<Cucumberland>
<Item .../>
</Cucumberland>

Afterwards the Any tag is read, that will always add items regardless of culture:

<Any>
<Item .../>
</Any>


Finally, the user is presented with items for sale.

Article information

Added on

Edited on

Written by

noafk9

0 comments