Mount & Blade II: Bannerlord

File information

Last updated

Original upload

Created by

billw

Uploaded by

billw2011

Virus scan

Safe to use

About this mod

This mod provides configurable Twitch integration for Bannerlord, including channel point rewards, a chat bot interface, and an overlay. The included default config will add rewards to allow viewers to "adopt" in game heroes, renaming them, and allowing the viewer to summon them to the players side, but many more things are possible.

Requirements
Permissions and credits
Mirrors
Changelogs
Trailer | Discord | Github

Bannerlord Twitch (BLT)
This is a modification for Mount & Blade II: Bannerlord that adds Twitch integration to the game. This allows events in a Twitch stream to trigger actions in game, for instance redemption of Channel Point Rewards, or specific chat messages.

To get the mod, please join the discord using the link above. This is the only place you can get it!

See it in Action


Features
  • Define Channel Point Rewards, along with their in game effects (using the provided custom built configuration UI), they will be automatically added to your channel for you, and removed again when the game exits
  • Define Bot Commands for non Channel Points interactions, with optional limits such as subscriber only commands
  • Provides an extensibility framework allowing for other mods to register action effects and command handlers
  • Comes with the Adopt a Hero module, allowing viewers to "adopt" an in-game hero, improve them, and perform actions with them in game
  • Comes with the BLT Buffet module, allowing viewers to perform various actions to spawned agents in game (the player, friendlies, enemies) such as temporary stat changes, attached particle effects, triggering sounds, scaling the character up or down.

Adopt a Hero
This is the first example action suite that comes with BLT.
Viewers can "adopt" an in-game hero of types that can be specified in the config -- this will give the in-game hero the viewers name, and allow further interactions with them:
  • Upgrade battle equipment, civilian equipment, and horse
  • Select a class, that will determine what equipment they receive, what skills XP gets applied to, and what passive and active buffs they can use in battles
  • Buy XP, attribute points, focus points
  • Summon to the player when they are in missions (including battle, siege, arena, village and town), on the player or enemies side
  • Win / lose gold and XP at the end of battles or fights, depending on the outcome
  • Join and bet on tournaments
  • Call commands to show their health, gold, last known location, skills, attributes, equipment

BLT Buffet
This is the second example action suite that comes with BLT.
So far it contains an action/handler called CharacterEffect that is aimed at performing temporary changes to agents that are spawned in missions (i.e. in battle, siege, village, town walkabouts etc., NOT on the map view).
The changes can only last until the end of the mission at most, and can be limited by time also.
Possible changes:
  • Many agent stats, including things like swing speed, run speed, mount speed, armor, shield skill, courage, etc.
  • Agent scaling: make giants or dwarves!
  • Apply damage or healing over time
  • Force the agent to drop their weapons and be unable to pick any up
  • Remove an agents armor
  • Apply a damage multiplier to all the agents hits
  • Play particles and sounds at the start and end of the effect
  • Attach particles to the agent, their weapon, head, hands, or everywhere on their body

Installation Instructions

Manual installation steps:
  • Install Bannerlord Harmony and ButterLib.
  • Unzip to the Bannerlords Modules directory (by default at C:\Program Files (x86)\Steam\steamapps\common\Mount & Blade II Bannerlord\Modules). It should create the BannerlordTwitch directory, and the BannerlordTwitch.dll should be at Modules\BannerlordTwitch\bin\Win64_Shipping_Client\BannerlordTwitch.dll
    It should also create the BLTAdoptAHero, BLTBuffet, and BLTConfigure directories.
  • Run the launcher, make sure Harmony loads first, then ButterLib, and Bannerlord Twitch loads after the game modules and before any BLT extensions (ButterLib is missing in the image, it would appear after Harmony and before Native):
  • Run the game.
  • The BLT Configure window should also be created when the game starts up.
  • Switch to the BLT Configure window to Authorize the mod to access your channel point rewards:
    a. Click the Authorize button on the Auth tab
    b. It should open a new browser window or tab, showing a Twitch authorization page (you may need to sign in to twitch first)
    c. Click the authorize button at the bottom of the page
    d. You should get a confirmation message, after which you can close the browser and go back to the BLT Configure window, which should now display Authorized in green if it was successful
  • Close and then restart the game.
  • Once you get to the main menu in game the mod should be initialized, indicated by messages in the overlay window
  • The channel point rewards and bot are not initialized until you actual enter the campaign (either load a save or start a new campaign / sandbox)


Trouble Shooting
Ask in discord!

Writing an Extension
You can implement new reward actions and command handlers quite easily:
  • Make another mod that depends on BannerlordTwitch (in the Submodule.xml, AND reference the dll itself)
  • Implement a new class derived from IActionHandler (for channel point rewards), ICommandHandler (for bot commands) or ActionAndCommandBase (to make both in one class)
  • Register instances of your derived classes with the RewardManager, this can be done easily with a call to:RewardManager.RegisterAll(typeof(your module class).Assembly);

Example:
// Command handler to allow playing a sound effect in game, passed as the argument to the command itself
public class PlaySfx : ICommandHandler
{
public void Execute(ReplyContext context, object config)
{
// Play the specified sound on the main agent
if (!string.IsNullOrEmpty(context.Args) && Agent.Main != null)
{
Mission.Current.MakeSound(
SoundEvent.GetEventIdFromString(context.Args),
Agent.Main.AgentVisuals.GetGlobalFrame().origin,
false, true, Agent.Main.Index, -1);
}
}

// We don't need any config for this
public Type HandlerConfigType => null;
}

Rewards that have a Handler that matches the class name of your IActionHandler will be passed to your registered instance, along with the HandlerConfig.
Commands work the same, with Handler matching the class name of your ICommandHandler.

Once compiled into a module and installed in the game, your handlers should show up in the BLT Configure tool (make sure the tool is loaded after your modules).

See the BLTBuffet and BLTAdoptAHero projects for some more examples.

Special Thanks To
https://www.twitch.tv/kydeezy - for doing my initial functionality testing
https://www.twitch.tv/lyonexodus - for doing the first live pre-release test
https://www.twitch.tv/domtasticgaming - for doing the first live post-release test, and making a sweet video showing off the mod