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

Scripted effect

find_title_for_almohad_spawn_effect

find_title_for_almohad_spawn_effect = yes

game/common/scripted_effects/00_almohad_invasion_effects.txt, line 1 (96 lines). No parameters.

find_title_for_almohad_spawn_effect is a scripted effect in Crusader Kings III, written at line 1 of its file. It takes no parameters: find_title_for_almohad_spawn_effect = yes. The game's script calls it in 1 place, among them almohad.0001 (event). Patch 1.20.1.2, from game/common/scripted_effects/00_almohad_invasion_effects.txt.

What it does

  • Otherwise › Maghreb:
    • One random in de jure hierarchy:
      • Only some of them (the filter is in the script below)
      • continue = { tier > tier_county }
  • Otherwise:
    • scope:almohad_county:
      • set_county_faith = faith:masmudi
    • scope:almohad_county.holder:
      • If played by a person: Event almohad.1001
      • Every liege or above:
    • Event almohad.0002 (after 400–1000 days)

• 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 (96 lines of game script)
find_title_for_almohad_spawn_effect = {
	if = { # The important thing is to not mess too much with players who can't resist
		limit = {
			title:c_tinmallal = {
				holder = { is_ai = yes }
				OR = {
					NOT = { exists = duchy.holder }
					duchy.holder = { is_ai = yes }
				}
			}
		}
		title:c_tinmallal = {
			save_scope_as = almohad_county
		}
	}
	else = {
		title:k_maghreb = {
			random_in_de_jure_hierarchy = {
				continue = { tier > tier_county }
				limit = {
					tier = tier_county
					holder = { is_ai = yes } # Let's not murder players
					NOT = { this = title:c_marrakesh }
					save_temporary_scope_as = potential_almohad_county
					# If someone holds k_maghreb, put the Almohads in their realm
					trigger_if = {
						limit = { exists = title:k_maghreb.holder }
						title:k_maghreb.holder = {
							OR = {
								this = scope:potential_almohad_county.holder
								any_sub_realm_county = {
									this = scope:potential_almohad_county
								}
							}
						}
					}
					# Either this should be the holder's only title, or it should NOT be their capital
					trigger_if = {
						limit = {
							holder = {
								any_sub_realm_county = { count > 1 }
							}
						}
						this != holder.capital_county
					}
				}
				weight = {
					base = 1
					# Prefer already Muslim counties
					modifier = {
						add = 5
						religion = religion:islam_religion
					}
					# Massively prefer to avoid a player-held Duchies if possible
					modifier = {
						factor = 0.01
						exists = duchy.holder
						duchy.holder = { is_ai = no }
					}
				}
				save_scope_as = almohad_county
			}
		}
	}

	if = { # Discard stuff from here on out
		limit = { NOT = { exists = scope:almohad_county } }
		debug_log = "No Almohad title found, Almohad's won't spawn"
	}
	# Convert the County and warn relevant people
	else = {
		set_global_variable = {
			name = spawned_almohads
			value = yes
		}
		scope:almohad_county = {
			set_county_faith = faith:masmudi
		}
		scope:almohad_county.holder = {
			if = {
				limit = {
					is_ai = no
				}
				trigger_event = almohad.1001
			}
			every_liege_or_above = {
				limit = { is_ai = no }
				trigger_event = almohad.1001
			}
		}
		trigger_event = { # Random amount of time to convert the province or otherwise prepare
			id = almohad.0002
			days = { 400 1000 }
		}
	}
}

As written in game/common/scripted_effects/00_almohad_invasion_effects.txt.

Where it is used

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

Events (1)

Source: game/common/scripted_effects/00_almohad_invasion_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?