Community Modding Documentation

Currently viewing this thread:

Kaasovic

Sergeant at Arms
Best answers
1
Made a pull request for the Items XML documentation. It took wayyy too long to find a structure that I liked :S
 

Fire_and_Blood

Knight at Arms
Best answers
0
Ah, just figured the ui.toggle_debug_mode out.
Enable it, then go back to Visual Studio change something, build and watch it update ingame.

A quick question to modding the UI following the above linked tutorial:
How to use:
ui.toggle_debug_mode

It doesn't seem to do anything. I tried that command on different screens, mainscreen, quest screen (where the modified title text does show), party screen, but it doesn't actually do anything.
 
Last edited:

MrWaffleman

Recruit
Best answers
0
This is wonderful, just made a pull request myself, I hope to contribute to these docs and learn even more from it.
 

Ethaninja

Recruit
Best answers
0
Hey mate it's really good and I'd love to contribute. However it seems to be missing a lot of key information. I'm left with more questions than answered. I've followed what I could in terms of creating a basic readable module for the launcher. Named my Module Folder exactly the same as the XML. And the ID's are exactly the same. Case Sensitive. However when I load up the launcher it does not see my new module at all. Am I missing something? Do I need to copy any folders out of the Native? I've basically got a Singleplayer module. No DLL yet. So I left out the SubModules as per instructions. Any tips? Thanks :smile:

Also, do you need all the depended modules for a basic Singleplayer mod? I'd imagine I don't need CustomBattle, Sandbox + SandBoxCore? What about Story Mode though? What's the difference between that and Native? Is Native the Base game and Story Mode is the campaign? It's very confusing haha.
 

Fabbels

Regular
Best answers
0
Hey mate it's really good and I'd love to contribute. However it seems to be missing a lot of key information. I'm left with more questions than answered. I've followed what I could in terms of creating a basic readable module for the launcher. Named my Module Folder exactly the same as the XML. And the ID's are exactly the same. Case Sensitive. However when I load up the launcher it does not see my new module at all. Am I missing something? Do I need to copy any folders out of the Native? I've basically got a Singleplayer module. No DLL yet. So I left out the SubModules as per instructions. Any tips? Thanks :smile:

Also, do you need all the depended modules for a basic Singleplayer mod? I'd imagine I don't need CustomBattle, Sandbox + SandBoxCore? What about Story Mode though? What's the difference between that and Native? Is Native the Base game and Story Mode is the campaign? It's very confusing haha.
I had the same issue fixed like this: make sure to name your xml in the submodule folder 'submodule.xml'
 

Ster

Veteran
Best answers
1
Hey mate it's really good and I'd love to contribute. However it seems to be missing a lot of key information. I'm left with more questions than answered. I've followed what I could in terms of creating a basic readable module for the launcher. Named my Module Folder exactly the same as the XML. And the ID's are exactly the same. Case Sensitive. However when I load up the launcher it does not see my new module at all. Am I missing something? Do I need to copy any folders out of the Native? I've basically got a Singleplayer module. No DLL yet. So I left out the SubModules as per instructions. Any tips? Thanks :smile:

Also, do you need all the depended modules for a basic Singleplayer mod? I'd imagine I don't need CustomBattle, Sandbox + SandBoxCore? What about Story Mode though? What's the difference between that and Native? Is Native the Base game and Story Mode is the campaign? It's very confusing haha.
The documentation is still in the early stages, so missing information is to be expected and there are still thousands of things to be covered. The goal for right now is to help modders create their own working mod. Once you have something that works, it's easier to learn by experimentation.

If you follow the step-by-step instructions for the tutorial, you should have a working mod. Going off of what you have said, it seems that you probably don't have your mod in the right location. Go to your game files and open the Modules folder. Inside this folder is where you should create a folder for your mod and then inside that folder, you will put your SubModule.xml. Once you do this, your mod should be visible from the launcher's Singleplayer > Mods tab.

The depended modules are a bit buggy right now and seem to be causing issues all around for some people, so experiment with them at your own discretion. In theory, you should add any modules that your mod depends on to your Depended Modules. Most mods will depend on Native as it contains many assets required to play the game, the SandBox/SandBoxCore modules are for campaign, you may not need CustomBattles though.
 

Ethaninja

Recruit
Best answers
0
The documentation is still in the early stages, so missing information is to be expected and there are still thousands of things to be covered. The goal for right now is to help modders create their own working mod. Once you have something that works, it's easier to learn by experimentation.

If you follow the step-by-step instructions for the tutorial, you should have a working mod. Going off of what you have said, it seems that you probably don't have your mod in the right location. Go to your game files and open the Modules folder. Inside this folder is where you should create a folder for your mod and then inside that folder, you will put your SubModule.xml. Once you do this, your mod should be visible from the launcher's Singleplayer > Mods tab.

The depended modules are a bit buggy right now and seem to be causing issues all around for some people, so experiment with them at your own discretion. In theory, you should add any modules that your mod depends on to your Depended Modules. Most mods will depend on Native as it contains many assets required to play the game, the SandBox/SandBoxCore modules are for campaign, you may not need CustomBattles though.
Thanks for your hastey reply. I have my mod xml located as followed: Bannerlord\Modules\MyMod\MyMod.xml
And I've even tried copying the Native modules subfolders into that mod folder.

XML File reads as follows:


<Module>
<Name value="MyMod"/>
<Id value="MyMod"/>
<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>
<Xmls>
<XmlNode>
<XmlName type="1" id="Items" path="customitems"/>
</XmlNode>
<XmlNode>
<XmlName type="1" id="SPCultures" path="customcultures"/>
</XmlNode>
<XmlNode>
<XmlName type="1" id="NPCCharacters" path="customcharacters"/>
</XmlNode>
</Xmls>
</Module>
 

Ethaninja

Recruit
Best answers
0
Aaah of course! Thank you sir, I for some reason was under the assumption that SubModule.xml was just a placeholder name haha. Do you think we could add that specificy to the docos incase somebody else falls into that trap or am I just special? xD

I take it you don't need ALL of the contents of Native inside the mod folder either? As in, to modify later?
 

Fabbels

Regular
Best answers
0
Aaah of course! Thank you sir, I for some reason was under the assumption that SubModule.xml was just a placeholder name haha. Do you think we could add that specificy to the docos incase somebody else falls into that trap or am I just special? xD
That is exactly what I explained to you 2 posts above.

I had the same issue fixed like this: make sure to name your xml in the submodule folder 'submodule.xml'
 

Kelthin

Sergeant
WBNW
Best answers
0
I've got the basis of whats going on down, but am unable to figure out how to look at the taleworlds code itself and not sure if its possible (im sure it is). For example, if i wanted to edit say, the skills system, I would need to know what classes, methods, and variables they use for me to then override and edit, however when I go through the references and object browser in visual studio it wont show me the actual code. I come from UE4 and they have their own documentation so I never had to worry about that.
 

Ethaninja

Recruit
Best answers
0
That's a good question actually. I'm assuming you have linked all the DLL files, I'd imagine they would be buried in some kind of xml file somewhere which I "believe" is read by these DLLs? Is that fair to assume that?

Also, in the documentation, Step 4: Setup an override for the OnSubModuleLoad() inherited method.
Now, I'm not too cluey with code, and I'm doing my darndest to learn on the fly (Inheriting the MBSubModuleBase was I'm assuming the base class for the MySubModule class, so I.E class MySubModule : MBSubModuleBase), but I'm stuck on the next step, 4. Is the Override function being written straight into the MySubModule class as a public override method? What is it's return type and what method are we actually overriding?

Or is OnSubModuleLoad() the method the actual method in our class we are overriding? And from what? Man I feel like a complete dunce sometimes with coding.

This is what I've got so far but I'm getting an error saying: The modifier 'override' is not valid for this item and that the method must have a return type. This is my code:

using TaleWorlds.Core;
using TaleWorlds.Localization;
using TaleWorlds.MountAndBlade;

namespace MyMod
{
class MySubModule : MBSubModuleBase
{
public override OnSubModuleLoad()
{
Module.CurrentModule.AddInitialStateOption(new InitialStateOption("Message",
new TextObject("Message", null),
9990,
() => { InformationManager.DisplayMessage(new InformationMessage("Hello World")); },
false));
}
}
}
 
Last edited:

Fabbels

Regular
Best answers
0
I've got the basis of whats going on down, but am unable to figure out how to look at the taleworlds code itself and not sure if its possible (im sure it is). For example, if i wanted to edit say, the skills system, I would need to know what classes, methods, and variables they use for me to then override and edit, however when I go through the references and object browser in visual studio it wont show me the actual code. I come from UE4 and they have their own documentation so I never had to worry about that.

You want to watch this video from GlorifiedPig where he explains this :
 

Kelthin

Sergeant
WBNW
Best answers
0
That's a good question actually. I'm assuming you have linked all the DLL files, I'd imagine they would be buried in some kind of xml file somewhere which I "believe" is read by these DLLs? Is that fair to assume that?

Also, in the documentation, Step 4: Setup an override for the OnSubModuleLoad() inherited method.
Now, I'm not too cluey with code, and I'm doing my darndest to learn on the fly (Inheriting the MBSubModuleBase was I'm assuming the base class for the MySubModule class, so I.E class MySubModule : MBSubModuleBase), but I'm stuck on the next step, 4. Is the Override function being written straight into the MySubModule class as a public override method? What is it's return type and what method are we actually overriding?

Or is OnSubModuleLoad() the method the actual method in our class we are overriding? And from what? Man I feel like a complete dunce sometimes with coding.

This is what I've got so far but I'm getting an error saying: The modifier 'override' is not valid for this item and that the method must have a return type. This is my code:

using TaleWorlds.Core;
using TaleWorlds.Localization;
using TaleWorlds.MountAndBlade;

namespace MyMod
{
class MySubModule : MBSubModuleBase
{
public override OnSubModuleLoad()
{
Module.CurrentModule.AddInitialStateOption(new InitialStateOption("Message",
new TextObject("Message", null),
9990,
() => { InformationManager.DisplayMessage(new InformationMessage("Hello World")); },
false));
}
}
}
OnSubModuleLoad is not a public method, its a protected method, thus it would be "protected override void OnSubModuleLoad()"


You want to watch this video from GlorifiedPig where he explains this :
Appreciate it!
 

Ethaninja

Recruit
Best answers
0
You want to watch this video from GlorifiedPig where he explains this :
Awesome thanks a bunch :smile: After my copious amounts of drunk research last night I'm surprised Google didn't pull up this series. But I greatly appriciate it
 

Jolc3r

Recruit
Best answers
0
Hello, I'm trying to make a mod that will edit and add more policies to Kingdoms. So far, I haven't found any XML docs under ModuleData for any modules that would have that stuff so I'm guessing this will have to be a .dll mod. What method would I have to override in order to do this? Which .dll could I open up to see how the game currently does policies? The documentation is very basic right now so I have no idea what anything does when I open up a .dll aside from how to create a basic mod.
 

Jolc3r

Recruit
Best answers
0
Alright so I found out there is some stuff for policies and decisions under TaleWorlds.CampaignSystem and found the PolicyObject initializer but I haven't been able to find where the PolicyObjects are actually created. Nor have I found out where to see what their effects are, there is just some UI TextObject and weights. Any clues as to where I can find the array the policies are stored in?