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

Scripted effect · All Under Heaven files

tgp_dynastic_cycle_record_history_phase_change_effect

tgp_dynastic_cycle_record_history_phase_change_effect = { PHASE = … PHASE_NUMBER = … }

game/common/scripted_effects/10_dlc_tgp_dynastic_cycle_scripted_effects.txt, line 2344 (90 lines). Parameters: $PHASE$, $PHASE_NUMBER$.

tgp_dynastic_cycle_record_history_phase_change_effect is a scripted effect in Crusader Kings III, in the All Under Heaven files, written at line 2344 of its file. A call passes 2 parameters: PHASE and PHASE_NUMBER. The game's script calls it in 1 place, among them The Dynastic Cycle (situation). Patch 1.20.1.2, from game/common/scripted_effects/10_dlc_tgp_dynastic_cycle_scripted_effects.txt.

The comment above it in the file

Custom situation history entry setup on phase change

What it does

  • If

    • Dynastic Cycle:
      • One of these

        • NOT = { exists = var:last_recorded_phase_change }
        • or

          All of these

          • exists = var:last_recorded_phase_change
          • One of these

            • Last recorded phase change is not $PHASE NUMBER$
            • or

              Last recorded phase change is 4

    Then

    • If

      • Dynastic Cycle:
        • situation_current_phase = situation_dynastic_cycle_phase_chaos

      Then

      Else if

      Then

      Else if

      • title:h_china.holder.dynasty != title:h_china.previous_holder.dynasty

      Then

      Otherwise

      • Dynastic Cycle:
        • record_situation_special_event = { key = situation_dynastic_cycle_era_change_history_entry phase = $PHASE$ }

• 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 (90 lines of game script)
tgp_dynastic_cycle_record_history_phase_change_effect = {

	# protect from double history entries
	if = {
		limit = {
			situation:dynastic_cycle = {
				OR = {
					NOT = { exists = var:last_recorded_phase_change }
					AND = {
						exists = var:last_recorded_phase_change
						OR = {
							var:last_recorded_phase_change != $PHASE_NUMBER$
							var:last_recorded_phase_change = 4
						}
					}
				}
			}
		}
		# When we enter Division, we only want to show the old hegemon
		if = {
			limit = {
				situation:dynastic_cycle = {
					situation_current_phase = situation_dynastic_cycle_phase_chaos
				}
			}
			situation:dynastic_cycle = {
				record_situation_special_event = {
					key = situation_dynastic_cycle_era_change_history_entry
					phase = $PHASE$
					variables = {
						old_hegemon = title:h_china.previous_holder
					}
				}
			}
		}
		# When we restore China after division, we only show the new hegemon
		else_if = {
			limit = {
				#exists = title:h_china.holder
				#title:h_china.holder = { is_valid_celestial_dynasty = yes }
				situation:dynastic_cycle = {
					exists = var:last_recorded_phase_change
					var:last_recorded_phase_change = 6
				}
			}
			situation:dynastic_cycle = {
				record_situation_special_event = {
					key = situation_dynastic_cycle_era_change_history_entry
					phase = $PHASE$
					variables = {
						new_hegemon = title:h_china.holder
					}
				}
			}
		}
		# If we replace the ruling dynasty, show new and old hegemon
		else_if = {
			limit = {
				exists = title:h_china.holder
				exists = title:h_china.previous_holder
				title:h_china.holder.dynasty != title:h_china.previous_holder.dynasty
			}
			situation:dynastic_cycle = {
				record_situation_special_event = {
					key = situation_dynastic_cycle_era_change_history_entry
					phase = $PHASE$
					variables = {
						new_hegemon = title:h_china.holder
						old_hegemon = title:h_china.previous_holder
					}
				}
			}
		}
		# Else, show none
		else = {
			situation:dynastic_cycle = {
				record_situation_special_event = {
					key = situation_dynastic_cycle_era_change_history_entry
					phase = $PHASE$
				}
			}
		}
		situation:dynastic_cycle = {
			set_variable = {
				name = last_recorded_phase_change
				value = $PHASE_NUMBER$
			}
		}
	}
}

As written in game/common/scripted_effects/10_dlc_tgp_dynastic_cycle_scripted_effects.txt.

Where it is used

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

Situations (1)

Source: game/common/scripted_effects/10_dlc_tgp_dynastic_cycle_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?