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

Scripted effect · Silk and Silver files

try_set_up_new_gg_leader_effect

try_set_up_new_gg_leader_effect = yes

game/common/scripted_effects/00_gdp_guelph_ghibelline_scripted_effects.txt, line 64 (177 lines). No parameters.

try_set_up_new_gg_leader_effect is a scripted effect in Crusader Kings III, in the Silk and Silver files, written at line 64 of its file. It takes no parameters: try_set_up_new_gg_leader_effect = yes. The game's script calls it in 4 places, among them …: Success (event scheme_critical_moments.1262), on_death (on action) and on_title_lost (on action). Its body carries 1 text of the game's own for the player. Patch 1.21.0, from game/common/scripted_effects/00_gdp_guelph_ghibelline_scripted_effects.txt.

What it does

  • If

    Then

    • If

      a check the game hides

      Then

      • title:k_papal_state.holder:
        • recalculate_participant_group = situation:guelph_ghibelline
      • recalculate_participant_group = situation:guelph_ghibelline

    Else if

    Then

    • If

      a check the game hides

      Then

      • title:e_hre.holder:
        • recalculate_participant_group = situation:guelph_ghibelline
      • recalculate_participant_group = situation:guelph_ghibelline

    Otherwise

    • If has “guelph leader” (a variable the game's script sets):
      • Else, if all of these hold:
        • Conditions › …:
          • situation_participant_group:guelph_member = { … }
        • Then › …:
          • situation_participant_group:guelph_member = { … }
      • Otherwise:
    • If has “ghibelline leader” (a variable the game's script sets):
      • Else, if all of these hold:
        • Conditions › …:
          • situation_participant_group:ghibelline_member = { … }
        • Then › …:
          • situation_participant_group:ghibelline_member = { … }
      • Otherwise:
    • If

      a check the game hides

      Then

      • … becomes the new …

• 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)
try_set_up_new_gg_leader_effect = {
	save_temporary_scope_as = gg_departing_leader
	#Special handling to make sure Pope stays Guelph leader, and HRE inheritor stays Ghibelline leader
	if = {
		limit = { 
			gg_phase_is_pre_gg_trigger = yes
			exists = var:guelph_leader
		}
		if = {
			limit = {
				exists = title:k_papal_state
				this != title:k_papal_state.holder
				title:k_papal_state.holder = {
					NOT = { exists = var:guelph_leader }
				}
			}
			title:k_papal_state.holder = {
				set_variable = guelph_leader
				recalculate_participant_group = situation:guelph_ghibelline
				if = {
					limit = { NOT = { exists = var:gg_involvement } }
					set_variable = {
						name = gg_involvement
						value = gg_involvement_base_value
					}
				}
			}
			remove_variable = guelph_leader
			recalculate_participant_group = situation:guelph_ghibelline
		}		
	}
	else_if = {
		limit = { 
			gg_phase_is_pre_gg_trigger = yes
			exists = var:ghibelline_leader
		}
		if = {
			limit = { 
				exists = title:e_hre
				this != title:e_hre.holder
				title:e_hre.holder = {
					NOT = { exists = var:ghibelline_leader }
				} 
			}
			title:e_hre.holder = {
				set_variable = ghibelline_leader
				recalculate_participant_group = situation:guelph_ghibelline
				if = {
					limit = { NOT = { exists = var:gg_involvement } }
					set_variable = {
						name = gg_involvement
						value = gg_involvement_base_value
					}
				}
			}
			remove_variable = ghibelline_leader
			recalculate_participant_group = situation:guelph_ghibelline
		}
	}
	else = {
		if = {
			limit = { has_variable = guelph_leader }
			if = {
				limit = {
					primary_heir ?= {
						this != scope:gg_departing_leader # Republics can re-elect, so the primary heir may be this dead ruler
						save_temporary_scope_as = heir_check
						situation:guelph_ghibelline ?= { 
							any_situation_participant = { this = scope:heir_check }
						}
						NOR = { 
							has_variable = ghibelline_leader
							any_held_title = { this = title:k_papal_state }
						}
						top_liege = scope:gg_departing_leader
					}
				}
				primary_heir = {
					set_variable = guelph_leader
					save_scope_as = new_gg_leader
				}
			}
			else_if = {
				limit = {
					situation:guelph_ghibelline = {
						situation_participant_group:guelph_member = {
							any_situation_group_participant = { 
								count >= 1
								NOT = { 
									any_held_title = { this = title:k_papal_state }
								}
							}
						}
					}
				}
				situation:guelph_ghibelline = {
					situation_participant_group:guelph_member = {
						ordered_situation_group_participant = {
							limit = { 
								NOT = { 
									any_held_title = { this = title:k_papal_state }
								}
							}
							order_by = primary_title.tier
							set_variable = guelph_leader
							save_scope_as = new_gg_leader
						}
					}
				}
			}
			else = {
				save_scope_value_as = {
					name = missing_leader
					value = flag:guelph
				}
				gg_invalidation_missing_leader_message_effect = { MISSING_LEADER = scope:missing_leader }
				situation:guelph_ghibelline = { end_situation = yes }
			}
			remove_variable = guelph_leader
		}

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

The first 120 of its 177 lines; the rest is in game/common/scripted_effects/00_gdp_guelph_ghibelline_scripted_effects.txt from line 64.

Where it is used

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

Events (1)

On actions (the game's own hooks) (2)

  • on_death
  • on_title_lost

Scripted effects (1)

Source: game/common/scripted_effects/00_gdp_guelph_ghibelline_scripted_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.21.0.

Spotted a mistake on this page, or have an idea for the site?