• Please note that we've updated the Mount & Blade II: Bannerlord save file system which requires you to take certain steps in order for your save files to be compatible with e1.7.1 and any later updates. You can find the instructions here.

In Progress [1.3 / Beta 1.4] Crash on Assigning NPC Lords Focus Points

Users who are viewing this thread


There is a bug in the code which assigns focus points for lords. This is in the CharacterDevelopmentCampaignBehaivor.DistributeUnspentFocusPoints method (in the TaleWorlds.CampaignSystem.SandBox.CampaignBehaviors.Towns namespace). This causes a crash in situations where a lord doesn't have any valid skills that can have a focus point applied to them.

The issue is that a null reference (for a SkillObject) is being passed as a key to a dictionary.

The weightFunction delegate can return a value that is less than 0 in some situations. This causes MBRandom.ChooseWeighted to return a null reference, which in turn causes an ArgumentNullException in the HeroDeveloper.AddFocus method.
Make sure that the weightFunction delegate does not return a value below 0.

This will allow MBRandom.ChooseWeighted to be able to correctly return a SkillObject.
Bug Reproduction In-Game:
It is probably unlikely this would occur in an un-modded game as it would require a large amount of time for the lord to gain enough focus points to cause the error. To reproduce the bug in a time-efficient manner, change the number of Focus points gained per level to 100. The game will crash immediately when trying to start a new campaign and will crash once a lord levels-up in an existing game. Both crashes will be because of the error detailed above.


This kept happening to me until I set focus points per level to 2 for bannerlord tweaks. haven't crashed for hours since. also make sure you go back far enough into your saves so it takes effect. anything above 2 focus points per level seems to crash for me atleast.


Yeah, I just spent a little while this morning debugging the issue (I'm the author for Bannerlord Tweaks). I've created a patch in Bannerlord Tweaks which fixes the issue but it would be better to have it implemented in native. You'll still get the crash eventually if you play the campaign for long enough (2 focus points per level means the crash will occur in half the time it would in native).
Top Bottom