Making a very simple mod to teach me

Currently viewing this thread:

LawH

Recruit
I'm not proficient with c#, but I am learning little by little.

I want to change a couple of variables in the game. The base speed, and the minimum speed. I found the variables in the files, and I'd like to make a mod to change just those two for starters.

Looking at tutorials, they tell you how to do an exact thing without an explanation. And going over the entire c# language seems like a bit much for this simple thing, and I learn best by seeing how something is done and understanding why everything is the way it is, or hearing a couple of different ways to do something.

I have googled a lot of keywords for c#, and am familiar with the basics of coding. I understand the very basics of the structure of code etc. But please, still do treat me like I am not adept at all, since we all know different things.

So, I have visual studio, I know how to build solutions to the right folder, and I know how to create the SubModule.xml to look for the .dll file that one creates with Visual Studio, what would be the actual code to changing something like this?

What also comes to mind is that I know that the numbers are constants, which means they won't change during gameplay. I know that void means that the created function or whatchammacallit in c# won't return a value, but will just make a change. These are the sort of things I can google and understand fairly quickly, especially with examples. But to actually use a dll file to change variables in another especially in mount and blade seems to elude me.

Thanks!
 
Last edited:
You don't necessarily need a Bannerlord mod to modify these two values. This can be done by creating an external application that does the modifying once the game starts. It would look up the folder location of M&B Bannerlord, open the file, modify the values and save it.

I'd suggest:
1. If you plan to do any further development on your mod in the future, find a video that explains how you can create and start a Bannerlord mod. This includes how you can use your built C# code to run when Bannerlord starts;
2. Write a piece of code for getting the location of M&B Bannerlord folder. This could be by using some fancy library, a built-in library provided by the modding tools by TW / looking this up when the game has started by looking up the running process / etc. (there are so many ways to do this)
3. Write a piece of code for selecting the file to access;
4. Write a piece of code for looking up the row you need to modify;
5. Write a piece of code to replace the values with the values you want on the selected row;
4. Write a piece of code for saving the file.

Once you build the project you can go to the "bin" folder and find the .DLL there.

Most developers suck at remembering how things work and one thing they're good at is doing research online. There are so many videos that will explain everything you need to know, just give yourself time and don't expect to do this in a day. Usually you will run into roadblocks but that's when you learn the most. Good luck!
 
Top Bottom