[Solved] Add MissionBehavior in custom battle

Users who are viewing this thread

temlar

Recruit
WB
This is a question related to bannerlord modding api

Current implementation of my mod uses campaignGameStarter.AddBehavior to add a campaign behavior and that behavior later on adds mission behavior via Mission.Current.AddMissionBehavior

This is working for campaign, but I would like the same functionality for Custom Battle. What would be appropriate api to implement this? I can always go for Harmony, but I would like to keep it simple.
 

temlar

Recruit
WB
I figured it out:
The implementation I was using was kind of an anti pattern. What you actually want is to use MBSubModuleBase.OnMissionBehaviorInitialize to add any mission behaviors that are present on all missions.
I was trying to do it through MBSubModuleBase.OnGameStart which was my mistake.
 
Top Bottom