• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

redtide

Magister Ludi
63 Badges
Jun 19, 2010
479
72
  • Crusader Kings II: Charlemagne
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Heir to the Throne
  • Crusader Kings II
  • Europa Universalis III Complete
  • Europa Universalis III
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Victoria 3 Sign Up
  • Cities: Skylines - Natural Disasters
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Leviathans Story Pack
  • Stellaris: Synthetic Dawn
  • Cities: Skylines - Green Cities
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Cities: Skylines Industries
  • Cities: Skylines
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Semper Fi
  • Teleglitch: Die More Edition
  • Victoria 2
  • 500k Club
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Crusader Kings II: Conclave
  • Cities: Skylines - Snowfall
  • Stellaris
  • Hearts of Iron IV: Cadet
In vanilla, you're encouraged to (and the AI does) destroy kingdoms upon becoming emperor. This is especially true if the empire title has a form of elective succession. If you're winning the election, your counties and duchies follow your primary title (effectively assuming its succession law). If you're losing the election, your counties and duchies default to primogeniture succession. But your kingdoms retain their own succession laws, which can complicate the dynamic succession of your counties and duchies.

I don't like the way that vanilla handles this, so I'm working on a mod that preempts or reverses some succession effects (since succession itself is not directly moddable). I would appreciate any input as to what this preempting or reversing behavior should be (and eventually as to some of the finer points of the scripting).

I'm motivated by frustration I experienced while playing a multiplayer game in an HRE with restored king-tier stem duchies (Saxony, Franconia, Swabia, a modded Landgravate of Thuringia, and a modded Saxon Ostmark) and titular Kingdom of Germany. I modded the Prince-Electors to coincide with the king-tier titles of Saxony, Franconia, Swabia, Lotharingia, Bavaria, Saxon Ostmark, and Frisia/Bohemia and envisioned a scenario whereby a Prince-Elector would vie for the empire and retain his/her stem duchy upon election, so that they could "fall back" to it (instead of becoming just a piddly duke) if/when the empire passed out of their dynasty. I wrote an on_action effect for the AI to re-create its kingdom as it lost the empire, but the counties and duchies defaulting to primogeniture complicates things.

Consider the following scenario: you're the Holy Roman Emperor and Grand Duke of Swabia. You're losing the election for the HRE and have the Grand Duchy of Swabia set to Seniority succession. Your counties and duchies flip to Primogeniture, and when your current character dies you'll play as the king-tier Grand Duke of Swabia but have only one county (that you've usurped from someone), and your last character's firstborn will have the rest of the demesne.

But now imagine that as the old emperor is dying an event kicks in that preempts the succession by granting all of the counties and duchies to the new Grand Duke of Swabia instead of to the firstborn. That would allow you to choose your successor via the succession law of the fallback kingdom instead of just accepting the firstborn. That is one of the things that this mod will do.

Here's a partial outline of the script that I've written for this event:

If a dying emperor is losing an elective empire title to a non-dynastic successor or is losing a kingdom to either a non-dynastic successor or a lesser dynasty member (i.e. not their "player heir"), then

If the emperor is AI and doesn't already hold a kingdom that is staying in the dynasty, then (under specific conditions) a "fallback" or "consolation" kingdom will be created.​

Vanilla succession is preempted by granting some of a kingdom's de jure vassal titles to the kingdom's successor (instead of the firstborn or the new emperor):​

If of a different dynasty, the kingdom successor gets any of the kingdom's de jure counties not de facto under a duchy held by the dying ruler but only if the successor doesn't already personally hold a county in the kingdom. (This is something of a compromise between the vanilla behavior, which grants no demesne to the new king except for a single county if unlanded, and a harsher effect that would grant the entire demesne to the new king, which is what happens in vanilla when losing titles via non-elective succession laws. I'm considering a game rule to toggle between these.)​
If of the same dynasty, the kingdom successor gets most or all of the demesne but only if the new emperor is already landed (I haven't hammered out the details of this yet).​

The kingdom successor gets any of the dying emperor's demesne counties that are de jure under a duchy the new king already holds.​

I'll have to write a separate event for usurpation etc. But I would appreciate anyone's suggestions for how they'd like to see this work.
 
  • 3Like
  • 1
Reactions:
using on_death event with gain_title, set_player_character and meticulous condition check, right?
Creating a non titular consolation kingdom is a new idea for me, I never thought it before. Wondering how it actually works likes.
Can't wait the mod releasing!
 
using on_death event with gain_title, set_player_character and meticulous condition check, right?
Creating a non titular consolation kingdom is a new idea for me, I never thought it before. Wondering how it actually works likes.
Can't wait the mod releasing!
Yeah, I'm currently testing the on_death event under different scenarios and trying to streamline its logic. I've been using grant_title_no_opinion in its clause form because I can use "type = inheritance" or "type = election" to make the title history look normal, but I'll confess to not having experimented with gain_title. Are there cases where it should be preferred? I'm planning to incorporate add_claim and add_weak_claim for the relevant titles to make it as though they were inherited and not granted. I haven't had to use set_player_character yet because, as a losing emperor, your player_heir is the heir to a kingdom you hold (if you haven't destroyed it) and not necessarily your Primogeniture heir. (I forget how it works when you hold multiple kingdoms, but I think your player_heir is the heir to the kingdom that appears immediately after the empire in your list of titles.) So as your current character is dying, I scope to the kingdom heir and grant him the relevant counties and duchies (bypassing the Primogeniture heir) and let him inherit the kingdom as he normally would. To prevent your Primogeniture heir from usurping a random county, I appease him with a temporary barony that is destroyed as soon as he inherits it. But I have thought of using set_player_character in an event similar to the Holy Fury event to play as your Crusade beneficiary when your empire and kingdom titles go to different dynasty members. The conditions under which the AI consolation kingdom gets created are currently quite strict. I have tried to limit the effect to cases in which the AI has destroyed a kingdom when it is emperor (which would be easier if there were an "on_title_destroyed" on_action). It does work quite well in the on_death event because I re-create the kingdom for the dying emperor, and his heir inherits it as though it were never destroyed. Something interesting that I've noticed about this is that the kingdom retains whatever succession law it had when it was destroyed. I need to do some testing to understand exactly what happens when it has an elective succession law. I don't envision re-creating a consolation kingdom for a human player, instead leaving him/her to refrain from destroying any kingdoms they may hold while emperor. The whole project would be easier if there were an on_succession effect that mirrored the on_death effect insofar as on_death events occur while the dying character still has his/her titles. The on_new_holder actions work after the titles have passed to the new holder.
 
because I can use "type = inheritance" or "type = election" to make the title history look normal,
abdict_to fires on_death works pretty good in my previous mod experience, so I guess the same on gain_title. It shows "elected" in the title history.
As for chaotic primo heir usurping thing, I'm still clueless.
If I were modding this, I'll scope my losing chosen successor via has_opinion_modifier (elder son defaulted) and abdict all title not using elective succ, usually duchies and countries if an emperor and countries if a king.
That's why I need set_player_character to escape from a gameover, due to the game would recognize the now landless son as the dynasty heir, who I don't really want to play as.
But the problem in this solution is, the succession window may not properly displayed at all. That's a big lose for the game experience.(for me)
 
  • 1
Reactions:
I'll scope my losing chosen successor via has_opinion_modifier
Thanks, that is a good technique. I had been imagining requiring the player to at least have their consolation kingdom succession sewn up, but that technique opens things up a bit.

But the problem in this solution is, the succession window may not properly displayed at all. That's a big lose for the game experience.(for me)
There is a lot about this mod project that feels sloppier to me than I would prefer, and the succession window is one of those things. Using the kingdom-inheriting vanilla player_heir at least results in the correct successor being displayed, but any of the demesne titles that I have distributed via grant_title_no_opinion do not show up under lost titles. Another limitation is that the line of succession tooltips and interfaces don't reflect the modifications. There is also the following weird scenario: if the empire heir is of a different dynasty than yours and you hold a kingdom title with elective succession the heir of which is of a third dynasty, then the new emperor will usurp all of that kingdom heir's demesne that is de jure part of the empire (including anything he/she held previously). To preempt that, I have had to insulate the kingdom heir's demesne by temporarily setting it outside of the empire's de jure hierarchy. But I can't reverse this effect immediately, so it lasts for a day. On the other hand, creating a temporary barony for the "chaotic primo heir usurping thing" (as you put it) works quite cleanly, and you can use it to make your Primogeniture heir end up landless.
 
Not completely familiar with CK2 modding, so not sure if possible, but i feel destroying the empire and creating it again might be easier:

check empire successor
destroy empire
let succession do its thing
create empire again
give empire to checked successor.
(optional: give empire claims to successor and kids of the dead guy, not sure where this happens)

Dos not even needs to check if successor is dynastic or not (althou maybe it might be better for some reason).

Alternatively instead of destroying it might be better to give it to a dummy tag, the empire reverts to god, who grands it to the successor.
 
Not completely familiar with CK2 modding, so not sure if possible, but i feel destroying the empire and creating it again might be easier

Alternatively instead of destroying it might be better to give it to a dummy tag, the empire reverts to god, who grands it to the successor.

That is possible and would be easier, but I'm trying to keep title history and past character interfaces looking somewhat normal. Destroying or granting the empire removes the title from the dead emperor's list of titles and he'll instead be called King or Duke so-and-so.

I have experimented more with temporarily disturbing the de jure hierarchy. It is somewhat promising, though it creates its own problems. I found that if I am an emperor with two kingdoms with different succession laws (e.g. elective empire, seniority kingdom, ultimogeniture kingdom), setting the two kingdoms outside of the empire's de jure hierarchy as the old emperor is dying results in each kingdom heir inheriting any counties and duchies that are de jure vassals of the kingdom (instead of having to usurp the kingdom's capital county as in vanilla). These inheritances show up in the succession window like they normally would (unlike when granting the titles to preempt the succession). But this can invalidate empire electors and/or candidates (due to no longer being de jure vassals, becoming a foreign ruler, or not having capitals in the same realm), such that the wrong character inherits the empire. I think that I have been able to correct this by modding the succession voting script, but I need to take a closer look at it to be sure.

I have found that in the above case I can use an on_new_holder event to immediately restore the original de jure hierarchy, and the inheritances will still occur. But that doesn't work in all cases. In vanilla, the new emperor will sometimes usurp an existing character's demesne (and vice versa). This seems to happen when a character's empire and kingdom titles are inherited by different landed characters. I can insulate the usurpation victim by disturbing the de jure hierarchy. But if I restore it immediately, then the usurpation still occurs. So I have to allow the disturbed hierarchy to exist for a day, which feels sloppy.
 
By the way is there a complete ck2 succession algorithm/flowchart somewhere on the internet? Wiki states the general rules, but I couldn't predict that was the succession behavior from what’s there
I've attached a couple of flowcharts. The first represents my impression of vanilla inheritance of a county when your primary title has elective succession, and the second represents the logic that I currently have in the mod (additions in green). The dotted line to the green terminal represents Aerotinge's suggestion (which I have yet to implement). I'm open to other suggestions about who should inherit a county under particular circumstances.
 

Attachments

  • elective_succession_vanilla.png
    elective_succession_vanilla.png
    89,9 KB · Views: 0
  • elective_succession_modded.png
    elective_succession_modded.png
    248,4 KB · Views: 0
  • 2
Reactions:
I am worried that there is a problem with using "has_opinion_modifier" to check for instances of the modifiers listed as "FIXED STATE" and "HARD - DO NOT REMOVE OR RENAME ANY OF THESE" in 00_opinion_modifiers.txt (which includes "opinion_nominee"). My effect doesn't fire for either "modifier = opinion_nominee" or "modifier = same_dynasty" but does for "modifier = sent_gift", which is listed under "TIMED".

This doesn't work:
Code:
any_dynasty_member = {
    limit = {
        has_opinion_modifier = {
            who = ROOT
            modifier = opinion_nominee
        }
    }
    #commands to execute
}


But this does work:
Code:
any_dynasty_member = {
    limit = {
        has_opinion_modifier = {
            who = ROOT
            modifier = sent_gift
        }
    }
    #commands to execute
}
 
If you figure this out... I would be very happy.

In CotC we have massive issues for same reasons, Galle made a elections system that is event driven that is interesting in one hand, but it is so buggy, there is no succession screen, weird stuff happens all the time, etc...
 
If you figure this out... I would be very happy.

In CotC we have massive issues for same reasons, Galle made a elections system that is event driven that is interesting in one hand, but it is so buggy, there is no succession screen, weird stuff happens all the time, etc...
Even if/when I get the lower levels titles to go where I want them to, it will still be sloppy: the granted titles will not show up in the succession screen's list of lost titles, and the title tooltips will still display the vanilla lines of succession. You would have to consult the mod's flowchart to predict who would get which county.