Mount & Blade II: Bannerlord
Help us shape the future of the Vortex mod manager by taking our survey
0 of 0

File information

Last updated

Original upload

Created by

echoreccon

Uploaded by

echoreccon

Virus scan

Safe to use

Tags for this mod

About this mod

Add a horn every time a movement order is given.

Permissions and credits
Changelogs
Please read the description!




While fighting for some lords faction, i would often hear some horns playing when orders were given to the troops, i'm not sure if its only in my game, but i never heard these horns when i was leading a army. With that in mind i built this simple mod that add a horn sound on every movement order that you give to your troops.

Manual Installation:
 Simply copy the HornOnOrders folder to "Mount & Blade II Bannerlord/Modules".
- Your folder structure should look like this "Mount & Blade II Bannerlord/Modules/HornOnOrders/SubModules.xml"

Loading External Files:

Unfortunately, i haven't managed to play the external files from the way i wanted, using SoundEvent.CreateEventsFromExternalFiles(), so to get the mod to play 2D sounds, while i still try to figure out why this isn't working, i did a workaround. What i did was use a external library to play the .ogg files, the libraries i used are the NVorbis and NAudio (Details Below).

To load external files, you just need to follow a few steps, sticking to the planned file structure. The sounds folder can be found at Mount & Blade II Bannerlord\Modules\HornOnOrders\Sounds. There you will have already one folder called "Default", inside this folder there are a few default horn sounds for the mod.

How to add more sounds:
All you need to do is add the .ogg files to the desired folder, but for them to work properly they have a few requirements.
- The file needs to be .ogg, otherwise the game will crash when it tries to play it.
- The file name must be the name of the order, followed by a "_" and the sequence number. (For example: charge_01, charge_02, etc). You can add how many sounds you want for the same order, the code will run through them, and play one randomly when the order is given.
- For now the only possible orders are: advance, charge, fallback, follow, hold, retreat, stop.

To change a sound simply overwrite them, and to remove, simple delete the file from the folder.


How to add sounds for a specific Faction:
To do that you'll need to add a new folder at Mount & Blade II Bannerlord\Modules\HornOnOrders\Sounds, with the name of the faction that you want to add the custom sounds. For Example Mount & Blade II Bannerlord\Modules\HornOnOrders\Southern Empire. Inside the folder you'll add the files following the requirements that were stated above.

Have in mind that, if the faction folder does not exist, the "Default" will be used, if the faction folder exists but there is no file for a specific order, then no sound will play when this same order is given.

Vanilla Factions Names: Northern Empire, Southern Empire, Western Empire, Battania, Vlandia, Sturgia, Aserai, Khuzait

What are those extra .dll's inside the mod?

They are what makes my workaround works, at least until i manage to play the 2D sounds from external files, using the functions from the game. You can find the documentation for each at:
NVorbis - Github Link
NAudio - Github Link
NAudio.Vorbis - Github Link
System.Buffers - Microsoft Docs Link
System.Memory - NuGet Link
System.Runtime.CompilerServices.Unsafe - Microsoft Docs Link

Requirements for the mod to work:
- Just have more than 40 units, without counting the player, and it should work.

About ModLib

Since ModLib caused a few issues with the use of the mod, i decided to remove it from the code. Because of that, for now the mod doesn't have custom configs.

Known Issues:
Horns Overlay - If multiple orders are given in a short timespan, you will end up hearing multiple horns playing at the same time.

Obs: My knowledge in C # is not great, so i uploaded my code to Github and would love to receive tips on how to improve and optimize it, thanks in advance. Also feel free to use the code for other purposes.