SP Native Allegiance Overhaul

Users who are viewing this thread

Intro
Initial goal of this mod was to make the logic which NPC clans use for leaving or defecting their kingdoms more sensible and controllable, while not preventing such actions completely. Over time though it grew in scale, and now I aim to improve over native functionality in several aspects, related to allegiance, vassalage and overall kingdom management as a ruler. You can find it on Nexus.

Explanation
Right now this mod have one big system named "Ensured loyalty" and several subsystems, which may be turned on or off independently. I have plans to add more systems and subsystems in the future, while maintaining modular approach. Each existing or future system could be applied either to player kingdom only, or to all realms of Calradia. I highly suggest using the same rules for everyone - that's what I had in mind while designing the mod.

Here is the detailed overview.

Ensured loyalty
Every AI clan of every kingdom periodically checks if it should leave its kingdom in search of better opportunities. There are two options they consider - just leaving and become independent for a time or defecting to another kingdom. These terms came from the game code and will be used a lot both on this page and in the mod itself, so, please, note them. Natively, leaving always means that clan will abandon any fiefs it has, while defecting means that clan may take their lands with them, if the kingdom they are defecting to (aka target kingdom) is at war with their current kingdom. Now this is how things work in vanilla. The problem with this logic, as I see it, is that evaluation process somewhat simplistic, which leads to a situation when clans leave their kingdoms seemingly out of the blue and maintaining a kingdom becomes frustrating for player.

Ensured loyalty system adds several adjustable conditions to skip above consideration logic partially or completely, depending on your tastes and desire for "fair and balanced" or just comfortable gameplay.

First of all, it adds oath of fealty limitation periods, so clans can't change factions the way one changes clothes. Same goes to mercenary contracts, but to a lesser extent. This skips considerations for clans completely, if they joined a kingdom not long ago. My intention with that is to add some stability to the game while not changing much.

Then comes "Achieve via relation" option. Roughly speaking, it forces clans to stay with their kingdoms, if relationship between clan leader and kingdom leader is high enough. There are lots of options that can be used to adjust required relation to your liking (taking into account faction type, leaders honor level, being landless etc.), but mostly they are self-explanatory, so I won't overexplain them here.

The one that requires some explanation, though, is "Withhold price". My thoughts behind this option is that for some situations, when clan really would like to leave, making them stay just because of strong friendship do seem like an overkill. To compensate for this, kingdom leader should pay some influence (and optionally even gold) to withhold clan in the kingdom.
In terms of game mechanics, when clan considers leaving or defecting, game calculates scores for these actions, which represent clan's willingness to leave (and in case of defecting - also the willingness of target kingdom to accept clan). Sum of these scores should be below some fixed threshold for clan to stay. If it is higher, clan would natively leave, but ensured loyalty system comes in play and forcing the clan to stay. With this option enabled, the amount, by which "stay" threshold exceeded, is taken into account, and the higher it is, the higher would be the price to withhold clan in the kingdom. Players will always have a choice if they are willing to pay this price or let the clan go, while AI faction leaders have all new logic to help them make such decision. Note that relation between clan and kingdom leaders still should be high enough, otherwise clan would just leave, as they do in vanilla.

Current features
  • Ensured loyalty system
    • Oath of fealty limitation period - minimum time clans have to serve as vassals to be able to leave the kingdom
    • Same for the minor factions with separate setting for the ones under mercenary contracts
    • Achieve clan loyalty via high relation with it's leader
    • Option to spend influence to make clans, that really would like to leave, stay for a while longer
    • Optionally affects player dialogs (blocks the ability to persuade loyal lords)
    • Info about lord's relation to kingdom leader and loyalty in hero tooltips in game Encyclopedia.
  • Info about exact relations with friends and enemies in hero tooltips in game Encyclopedia
  • Everything this mod adds or changes may affect only player's kingdom or all of Calradia, the choice is yours!
  • Localization support
  • In-game configuration menu with detailed hints for every setting
  • Informative and readable log messages

Planned features
  • More options for ensured loyalty
  • Try to implement a fix for the newly added in e1.4.1 lords did not spawned in ongoing campaigns.
  • Politics and relationships
    • Cooldown for voting on the same topic
    • More ruler control over kingdom's voting for peace and war, more sensible vote support calculation for such issues (no more people voting for new war whilst you already have 4 ongoing ones)
    • Make the growth of relations with the support of vassal clans by sovereign less linear
    • Overtime relation change between ruler clan and vassal clans depending on them being satisfied or dissatisfied with kingdom's domestic policy
    • Overtime relation change between vassal clans depending on their agreement or disagreement on kingdom's domestic policy
    • I am considering the same for foreign policy, but not quite sure about that, neither have I the clear idea of implementation yet
    • Slow overtime relation decay towards neutral state for everyone
  • Blood relatives
    • Modifier for ensured loyalty system when vassal clan have blood bounds with the ruling clan
    • Use it as an additional factor in faction evaluation rebalance (when implemented)
    • Proactive AI marriage proposals to player and other AI clans
  • Kingdom and clan evaluation rebalance
    • Add a little more weight to relations
    • Consider relation with all clans in the kingdom, not only the ruling one
    • Consider time spent in the current kingdom, with some clans loving stability and some despising it
    • Defecting during war may be more or less attractive for leaders depending on their traits. Some may even abandon their fiefs when leaving that way.
    • Use policies for evaluation
    • Adjustments of evaluation logic for minor factions
  • Better kingdom's army management

I am open to suggestions.

Compatibility
This mod is compatible with existing save games and can be removed from saves safely. Tested both on stable game version e1.4.1 and beta e1.4.2. I generally stick to stable game versions so updates for beta might have slight delay in the future.

Mod compatibility
My mod has basic check up routines, which should alert you if there are possible conflicts with other Harmony patches you use. This happens on game start and results logged in mod .log file. Plus there will be short information message in the game if potential issues were found.

Compatible and suggested for better overall experience:
Compatible with:
  • Modlib
  • MCM - if you are running MCM standalone, make sure to upgrade to MCM 3.1.6 or higher and load it to the top of your load order. In fact, this is highly suggested, as otherwise you may encounter several "Mod options" menus if you use Modlib or mods with integrated MBOptionScreen.v2.
Not compatible with:
  • Defection overhaul - this mod originally inspired me to look into allegiance, so if you don't need the additional complexity and just want to stop clans from leaving your kingdom, give it a try instead!

Code details
Harmony prefix on:
  • DiplomaticBartersBehavior.ConsiderDefection
  • DiplomaticBartersBehavior.ConsiderClanLeaveKingdom
  • DiplomaticBartersBehavior.ConsiderClanLeaveAsMercenary
  • UpdateTooltip.HeroAction
Harmony postfix on:
  • JoinKingdomAsClanBarterable.GetUnitValueForFaction
  • LeaveKingdomAsClanBarterable.GetUnitValueForFaction
  • LordDefectionCampaignBehavior.conversation_lord_from_ruling_clan_on_condition
  • EncyclopediaHeroPageVM.Refresh
  • TooltipVMExtensions.UpdateTooltip

Installation
Use Vortex mod manager or simply copy the 'AllegianceOverhaul' folder into your '..\Mount & Blade II Bannerlord\Modules\' folder! As for mod activation, I suggest that you use custom Mod Launcher and place my mod somewhere below the official TaleWorlds Modules and MCM standalone, if you use one.

Troubleshooting
If you are experiencing any problems:
  1. Try different mod order, I suggest following this guide
  2. Check mod .dll files, they might be automatically blocked by Windows
  3. Using launcher with enhanced mod support, like Fixed Launcher or Bannerlord Mod Launcher, may help with both these tasks

If nothing above helps, please, create bug report on Nexus, providing me information about:
  1. Mod version and game version
  2. What you did or what happened before the crash
  3. Information from game's exception window, if there were any (you can press <ctrl> + <C> in it to copy results to your clipboard)
  4. Mod log file, if any. It can be found under '..\Mount & Blade II Bannerlord\Modules\AllegianceOverhaul\'. It only created if there were errors in mod functionality.
  5. Your mod list and order
 
Last edited:
Back
Top Bottom