Skip to content

Template of a module for Mount & Blade II Bannerlord.

License

Notifications You must be signed in to change notification settings

haggen/bannerlord-module-template

Repository files navigation

ExampleModule

Example of a module for Mount & Blade II Bannerlord.

---✂️--- Below is the instruction for the module template, remove before release. ---✂️---

Getting Started

This repository is a starting point for developing your own module (mod) for Mount & Blade II Bannerlord with MSBuild, .NET Core SDK and VSCode but without Visual Studio. If you're new to software development in general I suggest you follow a more straightforward guide, this one's a bit more involved.

From a clean Windows installation you'll need:

  1. Git
  2. VSCode
  3. Build Tools for Visual Studio

Follow the links to download the software, and install everything.

On the Visual Studio Installer window you should select Individual Components and then pick these:

  • .NET Core SDK
  • .NET Framework 4.7.2 targeting pack

Once everything is installed, launch VSCode, install the most popular C# extension and follow any instructions.

Finally clone this repository somewhere, open the folder in VSCode, replace every instance of the following, and you're good to go. Remember to rename the files as well.

  • ExampleModule with the actual module name.
  • YourName with, you guessed it, your name.

Here's a rundown of the repository:

  • The ExampleModule.csproj is the entrypoint of the building process and holds all the details of your project.
  • The env.xml file holds any build configuration particular to your environment, like where the game's installed. It doesn't exist by default though, you have to create it from env.example.xml.
  • The module's files go into the Module directory. Everything there will be copied as-is to the final distributable folder, with just one exception...
  • The SubModule.xml will have macros, like $(Name) and $(Version) replaced with their actual value by the PostBuild.ps1 script.
  • The ExampleModuleSubModule.cs is the entrypoint of your source code. The resulting DLL will also be copied into the final distributable folder by PostBuild.ps1 script.
  • You build the project using the MSBuild CLI. See the Development section below.

---✂️--- Above is the instruction for the module template, remove before release. ---✂️---

Installation

Download the latest release from Releases and extract into the Modules directory inside your game installation folder. e.g. C:\Steam\steamapps\common\Mount & Blade II Bannerlord.

Open the game launcher, enable the module and click Play.

Usage

Write instructions for the player...

Development

Copy env.example.xml to env.xml and edit the settings according to your environment. Watch out for the ampersand in XML files.

The PostBuild.ps1 script will auto execute on successful builds, and assemble the final distributable folder of the module inside the .\dist directory.

Debug

PS C:\> dotnet build -c Debug

When you build in Debug configuration the PostBuild.ps1 script will also copy the module folder in place and launch the game loading a bare minimum set of modules for a quick test run.

Release

PS C:\> dotnet build -c Release

When you build in Release configuration the PostBuild.ps1 script will also produce an archive in the .\dist directory, specific to the version being built. That's what you upload to the internet.

Remember to bump the version inside the csproj file, tag the commit--like this v1.0.0--and rebuild.

Legal

MIT © 2020 YourName

This modification is not created by, affiliated with or sponsored by TaleWorlds Entertainment or its affiliates. The Mount & Blade II Bannerlord API and related logos are intelectual property of TaleWorlds Entertainment. All rights reserved.

About

Template of a module for Mount & Blade II Bannerlord.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published