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

Scripted effect

setup_populist_leader_effect

setup_populist_leader_effect = yes

game/common/scripted_effects/00_faction_effects.txt, line 1788 (154 lines). No parameters.

setup_populist_leader_effect is a scripted effect in Crusader Kings III, written at line 1788 of its file. It takes no parameters: setup_populist_leader_effect = yes. The game's script calls it in 2 places, among them Escalated Peasant Faction (factions) and Populist Faction (factions). Patch 1.20.1.2, from game/common/scripted_effects/00_faction_effects.txt.

What it does

  • get_popular_revolt_target_effect = { FACTION = this }
  • scope:target_title › One random claimant:
  • Else, if (a hidden condition):
    • set_special_character = scope:peasant_leader
  • Otherwise:
    • create_character = { … }
    • scope:peasant_leader:
      • set_character_rite = scope:peasant_county.rite
  • If

    a check the game hides

    Then

    • create_dynamic_title = { tier = duchy name = FACTION_POPULIST_REVOLT_TITLE_NAME }
    • scope:new_title:
      • set_capital_county = scope:peasant_county
      • set_landless_title = yes
      • set_destroy_on_succession = yes
      • set_delete_on_destroy = yes
      • set_no_automatic_claims = yes
      • set_definitive_form = yes
      • set_can_be_named_after_dynasty = no
      • set_can_use_nomadic_naming = no
      • Gains the … Title (peasant leader)
    • scope:new_title:
      • generate_coa = factions
    • scope:peasant_leader:
      • join_faction_skip_check = scope:faction
    • set_special_character = scope:peasant_leader

• 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)
setup_populist_leader_effect = {
	save_scope_as = faction

	random_faction_county_member = {
		save_scope_as = peasant_county
	}

	# Runs the scripted effect to find the best title to target for the rebellion.
	get_popular_revolt_target_effect = { FACTION = this }

	# Find or create a leader for the populist faction.
	scope:target_title = {
		# Look to see if there are any displaced characters who are legitimate claimants to the target title that the populists might support.
		random_claimant = {
			limit = {
				# Checks the 'is_character_valid' and 'can_character_join' triggers above, plus the faction hard/soft blocks in 00_rules.txt
				can_join_faction = scope:faction
				can_join_or_create_faction_against = scope:faction.faction_target

				# Must share a faith & culture with the revolting county.
				faith = scope:peasant_county.faith
				culture = scope:peasant_county.culture

				# Must be allowed to rule in their faith.
				trigger_if = {
					limit = {
						rite = { rite_has_doctrine = doctrine_gender_male_dominated }
					}
					is_male = yes
				}
				trigger_else_if = {
					limit = {
						rite = { rite_has_doctrine = doctrine_gender_female_dominated }
					}
					is_female = yes
				}
				trigger_else = {
					always = yes
				}

				# Must not already be a landed ruler, or set to inheirit a landed title.
				AND = {
					is_ruler = no
					is_playable_character = no
					NOT = {
						any_heir_title = {
							exists = this
						}
					}
				}
			}

			save_scope_as = peasant_leader
			add_character_flag = peasant_faction_claimant_without_title
			add_trait = populist_leader
		}
	}
	if = {
		limit = {
			NOT = { exists = scope:peasant_leader }
			exists = special_character
		}
		special_character = {
			save_scope_as = peasant_leader
		}
	}
	else_if = {
		limit = {
			exists = scope:peasant_leader
			NOT = { exists = special_character }
		}
		set_special_character = scope:peasant_leader
	}
	# If we can't find any, then generate a new character to be the populist leader of the revolt.
	else = {
		create_character = {
			location = scope:peasant_county.title_province
			template = populist_faction_leader_template
			faith = scope:peasant_county.faith
			rite = scope:peasant_county.rite
			culture = scope:peasant_county.culture
			gender_female_chance = {
				if = {
					limit = { scope:peasant_county.rite = { rite_has_doctrine = doctrine_gender_male_dominated } }
					add = 0
				}
				else_if = {
					limit = { scope:peasant_county.rite = { rite_has_doctrine = doctrine_gender_female_dominated } }
					add = 100
				}
				else = {
					add = 50
				}
			}
			trait = populist_leader
			save_scope_as = peasant_leader
		}
		scope:peasant_leader = {
			set_character_rite = scope:peasant_county.rite
			add_character_flag = peasant_faction_random_peasant
		}
	}
	if = {
		limit = {
			NOT = { exists = scope:peasant_leader.primary_title }
		}
		# Create a new title for the peasant.
		create_dynamic_title = {
			tier = duchy
			name = FACTION_POPULIST_REVOLT_TITLE_NAME
		}
		create_title_and_vassal_change = {
			type = created
			save_scope_as = change
			add_claim_on_loss = no
		}
		scope:new_title = {
			set_capital_county = scope:peasant_county
			set_landless_title = yes
			set_destroy_on_succession = yes

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

The first 120 of its 154 lines; the rest is in game/common/scripted_effects/00_faction_effects.txt from line 1788.

Where it is used

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

Factions (2)

  • Escalated Peasant Faction
  • Populist Faction

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