CK3 DatabaseCrusader Kings III · 1.20.1.2 “Crozier” · unofficial
Silk & Silverout Tue, Nov 17What's free, what needs the DLC, price →

Scripted effect · Khans of the Steppe files

migration_find_fitting_title_effect

migration_find_fitting_title_effect = yes

game/common/scripted_effects/09_dlc_mpo_scripted_effects.txt, line 56 (169 lines). No parameters.

migration_find_fitting_title_effect is a scripted effect in Crusader Kings III, in the Khans of the Steppe files, written at line 56 of its file. It takes no parameters: migration_find_fitting_title_effect = yes. The game's script calls it in 1 place, among them migration_title_and_vassal_change_effect (scripted effect). Patch 1.20.1.2, from game/common/scripted_effects/09_dlc_mpo_scripted_effects.txt.

What it does

  • If

    • scope:old_holder:
      • None of these

        • Any held county:
          • exists = duchy
          • NOT = { target_is_de_jure_liege_or_above = scope:target_title }
      • Any vassal › Any held county:
        • NOT = { target_is_de_jure_liege_or_above = scope:target_title }
    • NOT = { scope:target_title = scope:old_holder.primary_title }

    Then

    • scope:old_holder › One vassal, picked in order:
      • Where › Any held county:
        • NOT = { target_is_de_jure_liege_or_above = scope:target_title }
      • One held county, picked in order:
        • Where:
          • NOT = { target_is_de_jure_liege_or_above = scope:target_title }
        • Gains the … Title (old holder)
  • If

    • scope:target_title = scope:old_holder.primary_title

    Then

    • If

      • scope:target_title.tier > tier_duchy
      • scope:old_holder › Any realm county:
        • holder = scope:old_holder
        • NOT = { target_is_de_jure_liege_or_above = scope:target_title }

      Then

      • scope:old_holder › One random realm county:

      Else if

      • scope:target_title.holder = scope:old_holder
      • scope:target_title.tier = tier_duchy
      • scope:old_holder.capital_province.duchy: Not: Title already created

      Then

      • scope:old_holder.capital_province.duchy: Gains the … Title (old holder)

      Else if

      • scope:target_title:
        • Title tier exactly Duchy
        • Any direct de facto vassal title › Their duchy: Not: Title already created

      Then

      • Every in list: Gains the … Title (old holder)

• the game's own tooltip text · ◦ our reading of the script line · code the script where neither exists

“They” is whatever it runs on (the scope it is called in). The scripted triggers and effects it calls link to their own pages; $PARAMETERS$ stay as written: each call fills them in.

The script as written (120 lines of game script)
migration_find_fitting_title_effect = {
	save_scope_as = old_holder
	if = { # If they are losing all their core lands, but it's not their main title, we'll just move them into one of their vassal lands
		limit = {
			scope:old_holder = {
				NOT = {
					any_held_county = {
						exists = duchy
						NOT = { target_is_de_jure_liege_or_above = scope:target_title }
					}
				}
				any_vassal = {
					any_held_county = {
						exists = duchy
						NOT = { target_is_de_jure_liege_or_above = scope:target_title }
					}
				}
			}
			NOT = { scope:target_title = scope:old_holder.primary_title }
		}
		create_title_and_vassal_change = {
			type = revoked
			save_scope_as = change
		}
		scope:old_holder = {
			ordered_vassal = {
				limit = {
					any_held_county = {
						exists = duchy
						NOT = { target_is_de_jure_liege_or_above = scope:target_title }
					}
				}
				order_by = {
					value = 1
					if = {
						limit = {
							government_has_flag = government_is_herder
						}
						add = 500
					}
					subtract = domicile.herd
				}
				ordered_held_county = {
					limit = {
						exists = duchy
						NOT = { target_is_de_jure_liege_or_above = scope:target_title }
					}
					order_by = {
						value = 1
						add = county_fertility
					}
					change_title_holder = {
						holder = scope:old_holder
						change = scope:change
					}
				}
			}
		}
		resolve_title_and_vassal_change = scope:change
	}
	if = { # If it is their primary title, we try to find a fitting replacement for them
		limit = {
			scope:target_title = scope:old_holder.primary_title
		}
		if = { # For kingdoms and empires, we simply make a dynamic title for one of their leftover titles
			limit = {
				scope:target_title.tier > tier_duchy
				scope:old_holder = {
					any_realm_county = {
						holder = scope:old_holder
						NOT = { target_is_de_jure_liege_or_above = scope:target_title }
					}
				}
			}
			scope:old_holder = {
				random_realm_county = {
					limit = {
						holder = scope:old_holder
						NOT = { target_is_de_jure_liege_or_above = scope:target_title }
					}
					creating_kingdom_empire_title_effect = yes
				}
			}
		}
		else_if = { # For duchies, we try to find a fitting title, first by checking if they have an uncreated title to one of their lands
			limit = {
				scope:target_title.holder = scope:old_holder
				scope:target_title.tier = tier_duchy
				scope:old_holder.capital_province.duchy = {
					is_title_created = no
				}
			}
			create_title_and_vassal_change = {
				type = granted
				save_scope_as = change2
			}
			scope:old_holder.capital_province.duchy ?= {
				change_title_holder = {
					holder = scope:old_holder
					change = scope:change2
				}
			}
			resolve_title_and_vassal_change = scope:change2
		}
		else_if = { # Or if one of their vassals do
			limit = {
				scope:target_title = {
					tier = tier_duchy
					any_direct_de_facto_vassal_title = {
						duchy ?= { is_title_created = no }
					}
				}
			}
			create_title_and_vassal_change = {
				type = granted
				save_scope_as = change2
			}
			scope:target_title = {
				random_direct_de_facto_vassal_title = {
					limit = {

As written in game/common/scripted_effects/09_dlc_mpo_scripted_effects.txt.

The first 120 of its 169 lines; the rest is in game/common/scripted_effects/09_dlc_mpo_scripted_effects.txt from line 56.

Where it is used

Every place in common/, events/ and history/ that calls migration_find_fitting_title_effect.

Source: game/common/scripted_effects/09_dlc_mpo_scripted_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.20.1.2.

Spotted a mistake on this page?