SP Native C# Scripting

Users who are viewing this thread

Compatible version



C# Scripting for Mount and Blade Ⅱ: Bannerlord​




Nexus: https://www.nexusmods.com/mountandblade2bannerlord/mods/1651?tab=files
GitHub: https://github.com/int19h/Bannerlord.CSharp.Scripting


The mod wraps the .NET Compiler Platform SDK (aka Roslyn) to allow you to compile and run C# code dynamically from within the game. You can run individual snippets of code directly in the developer console, or load and execute script files from disk. Your code gets full access to the Bannerlord .NET API, including CampaignBehavior, CampaignEvents, and SubModule.OnGameStart. Syntactic sugar is provided for accessing private and internal members without Reflection. Visual Studio Code can be used to edit script files with full Intellisense support, and Visual Studio can be used to debug scripts in-game with breakpoints etc.

This mod requires some knowledge of C# and the Bannerlord .NET API to be useful. As such, its audience are advanced power users and other mod developers. For power users, some scenarios include:
  • Advanced cheating.
  • Automation of tedious in-game tasks.
  • Fixing game-breaking bugs (e.g. stuck parties or NPCs).
  • Generating detailed reports.
And for mod developers:
  • Interactive exploration of Bannerlord API.
  • Debugging your mods.
  • Rapid prototyping of new functionality.
Last edited:
Top Bottom