BL Coding change stats sword bannerlord

Users who are viewing this thread

I would like to change the statistics of a sword. Or create a new one. I basically want the sword of the Viking kings.

Some help? something like the Warband item edit

Espada-de-los-Reyes-Serie-Vikingos.jpg
 

hsngrms

Regular
M&BWBWF&SNWVC
You can change from here;
"...\Steam\steamapps\common\Mount & Blade II Bannerlord\Modules\Native\ModuleData\crafting_pieces.xml"
If you add new piece, instead of change existing one, your game will crash after updates until you add same thing again. So, be careful.
 
Upvote 0
You can change from here;

If you add new piece, instead of change existing one, your game will crash after updates until you add same thing again. So, be careful.

Okie dokie, so I'mma do a quick tutorial on how to make a crafting piece mod so it's compatible with other mods as well as updates.

First, make a folder inside the Modules folder and name it whatever you want your mod to be called, for this example, we're calling it WeaponPieces.
Inside this folder we're going to place a copy of SubModule.xml. Also, make a new folder, this time it must be called ModuleData.

Modify SubModule.xml to read like:
XML:
<Module>
  <Name value="WeaponPieces"/>
  <Id value="WeaponPieces"/>
  <Version value="v1.0.0"/>
  <SingleplayerModule value="true"/>
  <MultiplayerModule value="false"/>
  <DependedModules>
    <DependedModule Id="Native"/>
    <DependedModule Id="SandBoxCore"/>
    <DependedModule Id="Sandbox"/>
    <DependedModule Id="StoryMode" />
  </DependedModules>
  <SubModules />
  <Xmls>
        <XmlNode>
            <XmlName id="CraftingPieces" path="crafting_pieces"/>
            <IncludedGameTypes>
                <GameType value = "Campaign"/>
                <GameType value = "CampaignStoryMode"/>
                <GameType value = "CustomGame"/>
            </IncludedGameTypes>
        </XmlNode>
        <XmlNode>
            <XmlName id="CraftingTemplates" path="amended_templates"/>
            <IncludedGameTypes>
                <GameType value = "Campaign"/>
                <GameType value = "CampaignStoryMode"/>
                <GameType value = "CustomGame"/>
            </IncludedGameTypes>
        </XmlNode>
    </Xmls>
</Module>

Now, inside ModuleData we're going to make a xml file that matches whatever you put into the XmlName path, so in this case, crafting_pieces and amended_templates. amended_templates will be EXACTLY the template from Native's crafting_templates.xml but we are going to add all of our pieces' piece_id to the relevant templates, in this case the exact One Handed template, but with an additional friend.
XML:
<?xml version="1.0" encoding="utf-8"?>
<CraftingPieces>
  <CraftingPiece i="bcustom_blade_5" name="{=swb45HVS}Enhanced Mountain Blade" tier="5" piece_type="Blade" mesh="battania_blade_5" culture="Culture.battania" length="80.8" weight="0.21">
    <PieceUsages unavailable_usages="" />
    <BladeData sharpness="15" physics_material="metal_weapon" body_name="bo_sword_one_handed" holster_mesh="battania_blade_5_scabbard_5">
      <Thrust damage_type="Pierce" damage_factor="13.1" />
      <Swing damage_type="Cut" damage_factor="14.1" />
    </BladeData>
    <Flags>
      <Flag name="Civilian" type="ItemFlags" />
    </Flags>
    <Materials>
      <Material id="Iron3" count="1" />
    </Materials>
  </CraftingPiece>
</CraftingPieces>
XML:
<?xml version="1.0" encoding="utf-8" ?>

<CraftingTemplates>

  <CraftingTemplate id="OneHandedSword" item_modifier_group="sword" item_holsters="sword_left_hip_3:sword_left_hip:sword_left_hip_2:sword_back" piece_type_to_scale_holster_with="Blade" hidden_piece_types_on_holster="Blade" default_item_holster_position_offset="0,0,-0.1">
    <PieceDatas>
      <PieceData piece_type="Handle" build_order="0"/>
      <PieceData piece_type="Guard" build_order="1"/>
      <PieceData piece_type="Blade" build_order="2"/>
      <PieceData piece_type="Pommel" build_order="-1"/>
    </PieceDatas>
    <WeaponUsageDatas>
      <WeaponUsageData id="OneHandedSword"/>
    </WeaponUsageDatas>
    <StatsData>
      <StatData stat_type="Weight" max_value="7.0"/>
      <StatData stat_type="WeaponReach" max_value="300"/>
      <StatData stat_type="ThrustSpeed" max_value="200"/>
      <StatData stat_type="SwingSpeed" max_value="200"/>
      <StatData stat_type="ThrustDamage" max_value="500"/>
      <StatData stat_type="SwingDamage" max_value="500"/>
      <StatData stat_type="Handling" max_value="200"/>
      <!--<StatData stat_type="FollowUp" max_value="200"/>-->
    </StatsData>
    <UsablePieces>
    <UsablePiece piece_id="bcustom_blade_5"/>
     <UsablePiece piece_id="empire_blade_1"/>
      <UsablePiece piece_id="empire_noble_blade_1"/>
      <UsablePiece piece_id="empire_noble_blade_2"/>
      <UsablePiece piece_id="empire_noble_blade_3"/>
/snip
        . . . so on and so forth

Now, if you want to make the sword pictured above, you'll need to make a crafted sword, which isn't much more difficult that adding pieces. You'll add an XMLNode with the id="Items", path="filenameofyouritemxml" and do something like this
XML:
<?xml version="1.0" encoding="utf-8"?>
<Items>
<CraftedItem id="sturgia_noble_sword_1_t5"
               name="Sword of Lord BadFox"
               crafting_template="OneHandedSword"
               is_merchandise="true"
               culture="Culture.sturgia">
    <Pieces>
      <Piece id="sturgian_noble_blade_2"
             Type="Blade"
             scale_factor="100" />
      <Piece id="sturgian_noble_guard_2"
             Type="Guard"
             scale_factor="100" />
      <Piece id="sturgian_noble_grip_1"
             Type="Handle"
             scale_factor="100" />
      <Piece id="sturgian_noble_pommel_3"
             Type="Pommel"
             scale_factor="100" />
    </Pieces>
  </CraftedItem>
</Items>
and cheat it to yourself. Of course the above code is literally the Thamaskene Steel Warsword, so it doesn't match your image, but there are pieces that look similar to what you want. Just find those and swap the relevant Piece id with their ids.

If you want it to be OP, find the pieces, duplicate them into your crafting_pieces.xml, modify them, and then reference those in your filenameofyouritemxml.xml.

Note: This is a quick write up, so its probably only barely comprehensible, I do apologize, but I'm not going to spend another half hour edtting and expanding it. Sorry.
 
Last edited:
Upvote 0

hsngrms

Regular
M&BWBWF&SNWVC
Okie dokie, so I'mma do a quick tutorial on how to make a crafting piece mod so it's compatible with other mods as well as updates.

First, make a folder inside the Modules folder and name it whatever you want your mod to be called, for this example, we're calling it WeaponPieces.
Inside this folder we're going to place a copy of SubModule.xml. Also, make a new folder, this time it must be called ModuleData.

Modify SubModule.xml to read like:
XML:
<Module>
  <Name value="WeaponPieces"/>
  <Id value="WeaponPieces"/>
  <Version value="v1.0.0"/>
  <SingleplayerModule value="true"/>
  <MultiplayerModule value="false"/>
  <DependedModules>
    <DependedModule Id="Native"/>
    <DependedModule Id="SandBoxCore"/>
    <DependedModule Id="Sandbox"/>
    <DependedModule Id="StoryMode" />
  </DependedModules>
  <SubModules />
  <Xmls>
        <XmlNode>
            <XmlName id="CraftingPieces" path="crafting_pieces"/>
            <IncludedGameTypes>
                <GameType value = "Campaign"/>
                <GameType value = "CampaignStoryMode"/>
                <GameType value = "CustomGame"/>
            </IncludedGameTypes>
        </XmlNode>
    </Xmls>
</Module>

Now, inside ModuleData we're going to make a xml file that matches whatever you put into the XmlName path, so in this case, crafting_pieces. This is a copied version of the Native one with a little modification to make it OP.
XML:
<?xml version="1.0" encoding="utf-8"?>
<CraftingPieces>
  <CraftingPiece i="bcustom_blade_5" name="{=swb45HVS}Enhanced Mountain Blade" tier="5" piece_type="Blade" mesh="battania_blade_5" culture="Culture.battania" length="80.8" weight="0.21">
    <PieceUsages unavailable_usages="" />
    <BladeData sharpness="15" physics_material="metal_weapon" body_name="bo_sword_one_handed" holster_mesh="battania_blade_5_scabbard_5">
      <Thrust damage_type="Pierce" damage_factor="13.1" />
      <Swing damage_type="Cut" damage_factor="14.1" />
    </BladeData>
    <Flags>
      <Flag name="Civilian" type="ItemFlags" />
    </Flags>
    <Materials>
      <Material id="Iron3" count="1" />
    </Materials>
  </CraftingPiece>
</CraftingPieces>

Now, if you want to make the sword pictured above, you'll need to make a crafted sword, which isn't much more difficult that adding pieces. You'll add an XMLNode with the id="Items", path="filenameofyouritemxml" and do something like this
XML:
<?xml version="1.0" encoding="utf-8"?>
<Items>
<CraftedItem id="sturgia_noble_sword_1_t5"
               name="Sword of Lord BadFox"
               crafting_template="OneHandedSword"
               is_merchandise="true"
               culture="Culture.sturgia">
    <Pieces>
      <Piece id="sturgian_noble_blade_2"
             Type="Blade"
             scale_factor="100" />
      <Piece id="sturgian_noble_guard_2"
             Type="Guard"
             scale_factor="100" />
      <Piece id="sturgian_noble_grip_1"
             Type="Handle"
             scale_factor="100" />
      <Piece id="sturgian_noble_pommel_3"
             Type="Pommel"
             scale_factor="100" />
    </Pieces>
  </CraftedItem>
</Items>
and cheat it to yourself. Of course the above code is literally the Thamaskene Steel Warsword, so it doesn't match your image, but there are pieces that look similar to what you want. Just find those and swap the relevant Piece id with their ids.

If you want it to be OP, find the pieces, duplicate them into your crafting_pieces.xml, modify them, and then reference those in your filenameofyouritemxml.xml.

Note: This is a quick write up, so its probably only barely comprehensible, I do apologize, but I'm not going to spend another half hour edtting and expanding it. Sorry.
This can be a quick write up but, still very good source for noob self modders who don't wanna change original game files after every update.

I wish you could write that 1 hours earlier, so I can play the game instead of 30 mins trial & error. However I felt good when I figured it out myself.

Anyway, I thought XML names must match with originals. So, for my custom items I'm using spitems.xml name in my ModuleData folder.
Can you confirm I can use any name if I state this name in SubModule.xml?
Code:
        <XmlNode>
            <XmlName id="Items" path="mycustomfilename.xml"/>
        </XmlNode>
 
Upvote 0
I always recommend trying it yourself before seeking help so you get a more thorough grasp of what you're doing, so you should feel good about figuring it out on your own.

The id's are fixed, but the path can be custom, absolutely.

Also, come to find out, I also wrote that up without testing (a bad idea) and it turns out the custom items are not appearing in the smithy without matching the IDs of one that already exists. They do overwrite the piece, so that's useful in some cases, but not the intention. Turns out you need to amend the crafting templates as well. I'm going to do some testing and modify the above post.

So, do the same as above, but then put them together inside of a crafted item and that way you can access them as part of that item as opposed to unlocking them in the Smithy, which itself can be the intention.

Edit: I updated my above post. It was pretty easy, if a little clunky. This will not be compatible with any other mods that also modify the OneHandedSword template. I would recommend making a duplicate of the OHS template and call it something descriptive like MyModsOHS, that way it will not have to overwrite the native OHS template and it'll be easier to find your pieces. Of course, you'll need additional new templates per category, so it may clutter the crafting screen, but that's neither here nor there.
 
Last edited:
Upvote 0

hsngrms

Regular
M&BWBWF&SNWVC
Looks like crafted items way more complex to add without touching originals.

I created correct structure for all files, now I only need to fill/configure templates. If I do that right I believe I can craft my own sword in Smithy, but ofc first I need to learn my new parts. To do that, I will add my sword via console command then smelt it. (Thanks to Bannerlord Tweaks I can learn parts with smelting.)
 
Upvote 0

hsngrms

Regular
M&BWBWF&SNWVC
I have a morking mod for myself now. (I had already for non-crafted items, I mean I have also for crafted items too) I used below parts to make it look like what I like. (Obviously not same as OP, because I like curved swords, however Guard & Handle part is very close to it)
Decorated Long Scimitar Blade
Golden Sabre Guard
Decorated Fine Steel One Handed Grip
Kheshigs Pommel

The only thing that bothers me about that my mod should include all crafting pieces for one handed sword templates. This means I need to update my mod with every update of game 😒 (if they change templates to add new crafting pieces etc. like happened in 1.2.0 update).

---

Side note: I tried different things to achieve getting working mod without including all parts but I had no luck, maybe it could be possible via coding and creating a DLL but I've no experience about that.
 
Upvote 0
Top Bottom