#################
# /// Index /// #
#################
# / Definers
# 	Get_TNO_CountryClosing_picture
# 	Get_TNO_CountryClosing_epilogue
# / Tag-Specific Pictures
# / Tag-Specific Text
# / Main GUI Elements

# / Definers
defined_text = {
	name = Get_TNO_CountryClosing_picture
	text = {
		trigger = { original_tag = OMO }
		localization_key = "[Get_TNO_CountryClosing_picture_OMO]"
	}
	text = {
		trigger = { original_tag = USA }
		localization_key = "[Get_TNO_CountryClosing_picture_USA]"
	}
	text = {
		trigger = { original_tag = IRE }
		localization_key = "[Get_TNO_CountryClosing_picture_IRE]"
	}
	text = {
		trigger = { original_tag = GER }
		localization_key = "[Get_TNO_CountryClosing_picture_GER]"
	}
	text = {
		trigger = { original_tag = GNG }
		localization_key = "[Get_TNO_CountryClosing_picture_GNG]"
	}
	text = {
		trigger = { original_tag = YUN }
		localization_key = "[Get_TNO_CountryClosing_picture_YUN]"
	}
	text = {
		trigger = { original_tag = ENG }
		localization_key = "[Get_TNO_CountryClosing_picture_ENG]"
	}
	text = {
		trigger = { original_tag = MEX }
		localization_key = "[Get_TNO_CountryClosing_picture_MEX]"
	}
	text = {
		trigger = {
			OR = {
				original_tag = UKR
				original_tag = UKS
				original_tag = BOV
				original_tag = FUK
			}
		}
		localization_key = "[Get_TNO_CountryClosing_picture_UKR]"
	}
	text = {
		trigger = { original_tag = AAA }
		localization_key = "[Get_TNO_CountryClosing_picture_AAA]"
	}
	text = {
		trigger = { original_tag = AAO }
		localization_key = "[Get_TNO_CountryClosing_picture_AAO]"
	}
	text = {
		trigger = { original_tag = AAG }
		localization_key = "[Get_TNO_CountryClosing_picture_AAG]"
	}
	text = {
		trigger = { original_tag = AAC }
		localization_key = "[Get_TNO_CountryClosing_picture_AAC]"
	}
	text = {
		trigger = {
			OR = {
				original_tag = BRA
				original_tag = BRR
			}
		}
		localization_key = "[Get_TNO_CountryClosing_picture_BRA]"
	}
	text = {
		localization_key = "GFX_TNO_CountryClosing_picture_generic"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_epilogue
	
	text = {
		trigger = {
			original_tag = OMO
		}
		localization_key = "[Get_TNO_CountryClosing_epilogue_OMO]"
	}
	text = {
		trigger = {
			original_tag = USA
		}
		localization_key = "[Get_TNO_CountryClosing_epilogue_USA]"
	}
	text = {
		trigger = {
			original_tag = GNG
		}
		localization_key = "[Get_TNO_CountryClosing_epilogue_GNG]"
	}
	text = {
		trigger = {
			original_tag = ENG
		}
		localization_key = "[Get_TNO_CountryClosing_epilogue_ENG]"
	}
	text = {
		trigger = {
			original_tag = MEX
		}
		localization_key = "[Get_TNO_CountryClosing_epilogue_MEX]"
	}
	text = {
		trigger = {
			OR = {
				original_tag = UKR
				original_tag = UKS
				original_tag = BOV
				original_tag = FUK
			}
		}
		localization_key = "[Get_TNO_CountryClosing_epilogue_UKR]"
	}
	text = {
		trigger = { original_tag = UKR }
		localization_key = "[Get_TNO_CountryClosing_picture_UKS]"
	}
	text = {
		trigger = { original_tag = AAA }
		localization_key = "[Get_TNO_CountryClosing_epilogue_AAA]"
	}
	text = {
		trigger = { original_tag = AAO }
		localization_key = "[Get_TNO_CountryClosing_epilogue_AAO]"
	}
	text = {
		trigger = { original_tag = AAG }
		localization_key = "[Get_TNO_CountryClosing_epilogue_AAG]"
	}
	text = {
		trigger = { original_tag = AAC }
		localization_key = "[Get_TNO_CountryClosing_epilogue_AAC]"
	}
	text = {
		trigger = {
			OR = {
				original_tag = BRA
				original_tag = BRR
			}
		}
		localization_key = "[Get_TNO_CountryClosing_epilogue_BRA]"
	}
	text = {
		localization_key = TNO_CountryClosing_epilogue_generic
	}
}

# / Tag-Specific Pictures
defined_text = {
	name = Get_TNO_CountryClosing_picture_OMO
	text = {
		localization_key = "GFX_TNO_CountryClosing_picture_OMO"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_USA
	text = {
		trigger = {
			has_country_flag = USA_chep_success_ending
		}
		localization_key = "GFX_TNO_CountryClosing_picture_USA_Chep_Success_Ending"
	}
	text = {
		trigger = {
			has_country_flag = USA_chep_failure_ending
		}
		localization_key = "GFX_TNO_CountryClosing_picture_USA_Chep_Failure_Ending"
	}
	text = {
		localization_key = "GFX_TNO_CountryClosing_picture_generic"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_IRE
	text = {
		trigger = {
			has_country_flag = IRE_GFA_Ending
		}
		localization_key = "GFX_CountryClosing_picture_IRE_Good_Friday_Agreement_Ending"
	}
	text = {
		trigger = {
			has_country_flag = IRE_Haughey_Ending
		}
		localization_key = "GFX_CountryClosing_picture_IRE_IRA_Haughey_Ending"
	}
	text = {
		trigger = {
			has_country_flag = IRE_Negotiation_With_IRA_Ending
		}
		localization_key = "GFX_CountryClosing_picture_IRE_IRA_Negotiation_Ending"
	}
	text = {
		trigger = {
			has_country_flag = IRE_Twomey_Ending
		}
		localization_key = "GFX_CountryClosing_picture_IRE_IRA_Twomey_Ending"
	}
	text = {
		trigger = {
			has_country_flag = IRE_Junta_Ending
		}
		localization_key = "GFX_CountryClosing_picture_IRE_Junta_Ending"
	}
	text = {
		trigger = {
			has_country_flag = IRE_UVF_Beat_Ireland_Ending
		}
		localization_key = "GFX_CountryClosing_picture_IRE_UVF_Ireland_Loss_Ending"
	}
	text = {
		trigger = {
			has_country_flag = IRE_Victory_Over_UVF_Ending
		}
		localization_key = "GFX_CountryClosing_picture_IRE_UVF_Put_Down_Ending"
	}
	text = {
		localization_key = "GFX_TNO_CountryClosing_picture_generic"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_GER
	text = {
		trigger = {
			has_country_leader = {
				character = GER_albert_speer
				ruling_only = yes
			}
			has_country_leader_ideology = paternalism_transitioning_democracy_subtype
		}
		localization_key = "GFX_CountryClosing_picture_GER_Gang_of_Four_Ending"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = GER_albert_speer
				ruling_only = yes
			}
			has_country_leader_ideology = national_socialism_reformed_national_socialism_subtype
		}
		localization_key = "GFX_CountryClosing_picture_GER_Speer_Ending"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = GER_albert_speer
				ruling_only = yes
			}
			has_country_leader_ideology = national_socialism_idiosyncratic_nazism_subtype
		}
		localization_key = "GFX_CountryClosing_picture_GER_Oberlander_Ending"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = GER_albert_speer
				ruling_only = yes
			}
			has_country_leader_ideology = national_socialism_subtype
		}
		localization_key = "GFX_CountryClosing_picture_GER_Speer_Schorner_Ending"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = GER_martin_bormann
				ruling_only = yes
			}
		}
		localization_key = "GFX_CountryClosing_picture_GER_Bormann_Ending"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = GER_baldur_von_schirach
				ruling_only = yes
			}
		}
		localization_key = "GFX_CountryClosing_picture_GER_Schirach_Ending"
	}
	text = {
		localization_key = "GFX_TNO_CountryClosing_picture_generic"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_GNG
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 3 }
			OR = {
				has_country_flag = GNG_morita_personal_crisis_good_end
				has_country_flag = GNG_li_personal_crisis_good_end
			}
		}
		localization_key = "GFX_CountryClosing_picture_GNG_Sony_Success_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 3 }
			has_country_flag = GNG_morita_personal_crisis_bad_end
		}
		localization_key = "GFX_CountryClosing_picture_GNG_Sony_Morita_Failure_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 3 }
			has_country_flag = GNG_li_personal_crisis_bad_end
		}
		localization_key = "GFX_CountryClosing_picture_GNG_Sony_Li_Failure_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 4 }
			has_country_flag = Matsushita_Independent_ending
		}
		localization_key = "GFX_CountryClosing_picture_GNG_Matsushita_Success_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 4 }
			OR = {
				has_country_flag = Matsushita_Morita_Ending
				has_country_flag = Matsushita_Ibuka_ending
			}
		}
		localization_key = "GFX_CountryClosing_picture_GNG_Matsushita_Failure_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 5 }
			has_country_flag = Fujitsu_PersistenceEnding
		}
		localization_key = "GFX_CountryClosing_picture_GNG_Ibuka_Persistence_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 5 }
			has_country_flag = Fujitsu_CompromiseEnding
		}
		localization_key = "GFX_CountryClosing_picture_GNG_Ibuka_Reconciliation_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 7 }
			has_country_flag = GNG_hitachi_manchukuoending
		}
		localization_key = "GFX_CountryClosing_picture_GNG_Komai_Manchurian_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 7 }
			has_country_flag = GNG_hitachi_komaiending
		}
		localization_key = "GFX_CountryClosing_picture_GNG_Hitachi_Personalist_Ending"
	}
	text = {
		trigger = {
			has_country_flag = GNG_IJA_failstate_active
		}
		localization_key = "GFX_CountryClosing_picture_GNG_IJA_Failstate_Ending"
	}
	text = {
		localization_key = "GFX_TNO_CountryClosing_picture_generic"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_YUN
	text = {
		trigger = {
			has_global_flag = YUN_ROC_reborn
		}
		localization_key = "GFX_TNO_CountryClosing_picture_YUN_ROC_Ending"
	}
	text = {
		localization_key = "GFX_TNO_CountryClosing_picture_generic"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_ENG
	text = {
		trigger = {
			has_country_flag = ENG_Butler_Demo_Ending
		}
		localization_key = "GFX_CountryClosing_picture_ENG_Butler_Demo_Ending"
	}
	text = {
		trigger = {
			has_country_flag = ENG_Wallop_Soccred_Demo_Ending
		}
		localization_key = "GFX_CountryClosing_picture_ENG_Wallop_Soccred_Demo_Ending"
	}
	text = {
		trigger = {
			has_country_flag = ENG_Wallop_Britfash_Demo_Ending
		}
		localization_key = "GFX_CountryClosing_picture_ENG_Wallop_Britfash_Demo_Ending"
	}
	text = {
		trigger = {
			has_country_flag = ENG_Fountaine_Demo_Ending
		}
		localization_key = "GFX_CountryClosing_picture_ENG_Fountaine_Demo_Ending"
	}
	text = {
		trigger = {
			has_country_flag = BRI_Jordan_Victory_flag
		}
		localization_key = "GFX_CountryClosing_picture_ENG_Jordan_Demo_Ending"
	}
	text = {
		localization_key = "GFX_TNO_CountryClosing_picture_generic"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_UKR

	text = {
		trigger = { has_global_flag = UKR_UCW_COM_Victory }
		localization_key = "GFX_TNO_CountryClosing_picture_UKR_UKS_Ending"
	}
	text = {
		trigger = { has_country_flag = UKR_Brautigam_Ending }
		localization_key = "GFX_TNO_CountryClosing_picture_UKR_Brautigam_Ending"
	}
	text = {
		trigger = { has_country_flag = UKR_Ohlendorf_Ending }
		localization_key = "GFX_TNO_CountryClosing_picture_UKR_Ohlendorf_Ending"
	}
	text = {
		trigger = { has_country_flag = UKR_Leibbrandt_Ending }
		localization_key = "GFX_TNO_CountryClosing_picture_UKR_Leibbrandt_Ending"
	}
	text = {
		trigger = { has_country_flag = BOV_UKR_Stetsko_Ending }
		localization_key = "GFX_TNO_CountryClosing_picture_BOV_UKR_Stetsko_Ending"
	}
	text = {
		trigger = { has_country_flag = BOV_UKR_Shukhevych_Ending }
		localization_key = "GFX_TNO_CountryClosing_picture_BOV_UKR_Shukhevych_Ending"
	}
	text = {
		trigger = { has_country_flag = BOV_UKR_Klyachkivsky_Ending }
		localization_key = "GFX_TNO_CountryClosing_picture_BOV_UKR_Klyachkivsky_Ending"
	}
	text = {
		trigger = { has_country_flag = UKR_Dziuba_Ending }
		localization_key = "GFX_TNO_CountryClosing_picture_UKR_UNRA_Dziuba_Ending"
	}
	text = {
		trigger = { has_country_flag = UKR_Ohloblyn_Ending }
		localization_key = "GFX_TNO_CountryClosing_picture_UKR_UNRA_Ohloblyn_Ending"
	}
	text = {
		trigger = { has_country_flag = UKR_Stus_Ending }
		localization_key = "GFX_TNO_CountryClosing_picture_UKR_UNRA_Stus_Ending"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_MEX
	text = {
		trigger = {
			has_country_leader = {
				character = MEX_Gustavo_Ordaz
				ruling_only = yes
			}
		}
		localization_key = "GFX_CountryClosing_picture_MEX_Demo_Ordaz"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = MEX_Raul_Lozano
				ruling_only = yes
			}
		}
		localization_key = "GFX_CountryClosing_picture_MEX_Demo_Lozano"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = MEX_Carlos_Madrazo
				ruling_only = yes
			}
		}
		localization_key = "GFX_CountryClosing_picture_MEX_Demo_Madrazo"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_AAA
	text = {
		trigger = { has_country_flag = AAA_won }
		localization_key = "GFX_CountryClosing_picture_AAA_Success"
	}
	text = {
		localization_key = "GFX_CountryClosing_picture_AAA_Failure"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_AAO
	text = {
		trigger = {
			has_country_leader = {
				character = AAO_Edmund_Hillary
				ruling_only = yes
			}
		}
		localization_key = "GFX_CountryClosing_picture_AAO_Hillary"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = AAO_Howard_Beale
				ruling_only = yes
			}
		}
		localization_key = "GFX_CountryClosing_picture_AAO_Beale"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = AAO_Hyman_Rickover
				ruling_only = yes
			}
		}
		localization_key = "GFX_CountryClosing_picture_AAO_Rickover"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_AAG
	text = {
		trigger = { has_country_flag = AAG_won }
		localization_key = "GFX_CountryClosing_picture_AAG_Success"
	}
	text = {
		localization_key = "GFX_CountryClosing_picture_AAG_Failure"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_AAC
	text = {
		trigger = {
			has_country_leader = {
				character = AAC_Julio_Escudero_Guzman
				ruling_only = yes
			}
			has_country_flag = AAC_Marine_Mission_Success
		}
		localization_key = "GFX_CountryClosing_picture_AAC_guzman_success"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = AAC_Julio_Escudero_Guzman
				ruling_only = yes
			}
		}
		localization_key = "GFX_CountryClosing_picture_AAC_guzman_failure"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = AAC_Jose_Toribio_Merino
				ruling_only = yes
			}
			has_country_flag = AAC_Marine_Mission_Success
		}
		localization_key = "GFX_CountryClosing_picture_AAC_merino_success"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = AAC_Jose_Toribio_Merino
				ruling_only = yes
			}
		}
		localization_key = "GFX_CountryClosing_picture_AAC_merino_failure"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_picture_BRA
	text = {
		trigger = {
			has_country_leader = {
				character = BRA_Adhemar_de_Barros
				ruling_only = yes
			}
			has_global_flag = SATW_Brazil_Victory
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Adhemar_Wins_War"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = BRA_Adhemar_de_Barros
				ruling_only = yes
			}
			has_global_flag = SATW_Argentina_Victory
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Adhemar_Loses_War"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = BRA_Carlos_Lacerda
				ruling_only = yes
			}
			has_global_flag = SATW_Brazil_Victory
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Lacerda_Wins_War"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = BRA_Carlos_Lacerda
				ruling_only = yes
			}
			has_global_flag = SATW_Argentina_Victory
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Lacerda_Loses_War"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = BRA_Virgilio_Tavora
				ruling_only = yes
			}
			has_global_flag = SATW_Brazil_Victory
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Tavora_Wins_War"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = BRA_Virgilio_Tavora
				ruling_only = yes
			}
			has_global_flag = SATW_Argentina_Victory
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Tavora_Loses_War"
	}
	text = {
		trigger = { has_global_flag = SATW_Brazil_Victory }
		localization_key = "GFX_CountryClosing_picture_BRA_Someone_Wins_War"
	}
	text = {
		trigger = { has_global_flag = SATW_Argentina_Victory }
		localization_key = "GFX_CountryClosing_picture_BRA_Someone_Loses_War"
	}
	text = {
		trigger = { has_country_flag = BRA_Lacerda_Imp_Victory_flag }
		localization_key = "GFX_CountryClosing_picture_BRA_Lacerda_Imp_Victory"
	}
	text = {
		trigger = { has_country_flag = BRA_Lacerda_Imp_Failure_flag }
		localization_key = "GFX_CountryClosing_picture_BRA_Lacerda_Imp_Failure"
	}
	text = {
		trigger = {
			AND = {
				has_country_flag = BRA_ADHEMAR_SURVIVES
				has_country_flag = BRA_vargas_won_1970
				check_variable = { BRA_adhemar_wealth > 149.99 }
				check_variable = { BRA_adhemar_legacy > 4 }
			}
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Adhemar_Big_Win_Jackpot"
	}
	text = {
		trigger = {
			AND = {
				has_country_flag = BRA_ADHEMAR_SURVIVES
				has_country_flag = BRA_vargas_won_1970
			}
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Adhemar_Lives_Vargas_Wins"
	}
	text = {
		trigger = {
			AND = {
				has_country_flag = BRA_ADHEMAR_SURVIVES
				NOT = { has_country_flag = BRA_vargas_won_1970 }
			}
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Adhemar_Lives_Vargas_Loses"
	}
	text = {
		trigger = {
			AND = {
				has_country_flag = BRA_ADHEMAR_DIES
				has_country_flag = BRA_vargas_won_1970
			}
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Adhemar_Dies_Vargas_Wins"
	}
	text = {
		trigger = {
			AND = {
				has_country_flag = BRA_ADHEMAR_DIES
				has_country_flag = BRA_edna_won_1970
			}
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Adhemar_Dies_Edna_Wins"
	}
	text = {
		trigger = { has_country_flag = BRA_ADHEMAR_DIES }
		localization_key = "GFX_CountryClosing_picture_BRA_Adhemar_Dies_Someone_Wins"
	}
	# DEMOCRATIC LACERDA / TAVORA
	text = {
		trigger = {
			has_country_flag = BRA_tavora_coup_happened
			has_country_leader = {
				character = BRA_Ney_Braga
				ruling_only = yes
			}
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Tavora_Win"
	}
	text = {
		trigger = {
			has_country_flag = BRA_tavora_coup_happened
			NOT = {
				has_country_leader = {
					character = BRA_Ney_Braga
					ruling_only = yes
				}
			}
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Tavora_Fail"
	}
	text = {
		trigger = {
			NOT = {
				has_country_flag = BRA_tavora_coup_happened
			}
			has_country_leader = {
				character = BRA_Raphael_Magalhaes
				ruling_only = yes
			}
			is_in_faction_with = USA
			# triggers for passing all bills and winning all proxies to be added
			check_variable = {
				var = Lacerda_Success_Meter
				value = 9
				compare = greater_than_or_equals
			}
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Lacerda_Win_Max"
	}
	text = {
		trigger = {
			has_country_flag = BRA_lacerda_strikes_over
			NOT = {
				has_country_flag = BRA_tavora_coup_happened
			}
			has_country_leader = {
				character = BRA_Raphael_Magalhaes
				ruling_only = yes
			}
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Lacerda_Win_Mid"
	}
	text = {
		trigger = {
			has_country_flag = BRA_lacerda_strikes_over
			NOT = {
				has_country_flag = BRA_tavora_coup_happened
				has_country_leader = {
					character = BRA_Raphael_Magalhaes
					ruling_only = yes
				}
			}
		}
		localization_key = "GFX_CountryClosing_picture_BRA_Lacerda_Win_Min"
	}
	text = {
		localization_key = "GFX_TNO_CountryClosing_picture_generic"
	}
}

# / Tag-Specific Text
defined_text = {
	name = Get_TNO_CountryClosing_epilogue_OMO
	text = {
		localization_key = "TNO_CountryClosing_epilogue_OMO"
	}
}

defined_text = {
	name = Get_TNO_CountryClosing_epilogue_USA
	text = {
		trigger = {
			has_country_flag = USA_chep_success_ending
		}
		localization_key = "TNO_CountryClosing_epilogue_USA_Chep_Success"
	}
	text = {
		trigger = {
			has_country_flag = USA_chep_failure_ending
		}
		localization_key = "TNO_CountryClosing_epilogue_USA_Chep_Failure"
	}
	text = {
		trigger = {
			has_country_leader = {
				character = USA_Phyllis_Schlafly
				ruling_only = yes
			}
		}
		localization_key = "TNO_CountryClosing_epilogue_USA_Schlafly"
	}
	text = {
		trigger = {
			OR = {
				has_country_leader = {
					character = USA_Francis_Yockey
					ruling_only = yes
				}
				has_country_leader = {
					character = USA_Gus_Hall
					ruling_only = yes
				}
			}
		}
		localization_key = "TNO_CountryClosing_epilogue_USA_Yock_and_Hall_Torture"
	}
	text = {
		localization_key = "TNO_CountryClosing_epilogue_USA_Generic"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_epilogue_GNG
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 3 }
			OR = {
				has_country_flag = GNG_morita_personal_crisis_good_end
				has_country_flag = GNG_li_personal_crisis_good_end
			}
		}
		localization_key = "TNO_CountryClosing_epilogue_GNG_Morita_Success_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 3 }
			has_country_flag = GNG_morita_personal_crisis_bad_end
		}
		localization_key = "TNO_CountryClosing_epilogue_GNG_Sony_Morita_Failure_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 3 }
			has_country_flag = GNG_li_personal_crisis_bad_end
		}
		localization_key = "TNO_CountryClosing_epilogue_GNG_Sony_Li_Failure_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 4 }
			has_country_flag = Matsushita_Independent_ending
		}
		localization_key = "TNO_CountryClosing_epilogue_GNG_Matsushita_Success_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 4 }
			has_country_flag = Matsushita_Morita_Ending
		}
		localization_key = "TNO_CountryClosing_epilogue_GNG_Matsushita_Failure_Morita_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 4 }
			has_country_flag = Matsushita_Ibuka_ending
		}
		localization_key = "TNO_CountryClosing_epilogue_GNG_Matsushita_Failure_Ibuka_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 5 }
			has_country_flag = Fujitsu_PersistenceEnding
		}
		localization_key = "TNO_CountryClosing_epilogue_GNG_Ibuka_Persistence_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 5 }
			has_country_flag = Fujitsu_CompromiseEnding
		}
		localization_key = "TNO_CountryClosing_epilogue_GNG_Ibuka_Reconciliation_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 7 }
			has_country_flag = GNG_hitachi_manchukuoending
		}
		localization_key = "TNO_CountryClosing_epilogue_GNG_Komai_Manchurian_Ending"
	}
	text = {
		trigger = {
			check_variable = { GNG_legco_faction_in_power = 7 }
			has_country_flag = GNG_hitachi_komaiending
		}
		localization_key = "TNO_CountryClosing_epilogue_GNG_Hitachi_Personalist_Ending"
	}
	text = {
		trigger = {
			has_country_flag = GNG_IJA_failstate_active
			OR = {
				check_variable = { GNG_legco_faction_in_power_holding = 3 }
				check_variable = { GNG_legco_faction_in_power_holding = 4 }
				check_variable = { GNG_legco_faction_in_power_holding = 5 }
			}
		}
		localization_key = "TNO_CountryClosing_epilogue_GNG_IJA_Failstate_Normal_Ending"
	}
	text = {
		trigger = {
			has_country_flag = GNG_IJA_failstate_active
			check_variable = { GNG_legco_faction_in_power_holding = 7 }
		}
		localization_key = "TNO_CountryClosing_epilogue_GNG_IJA_Failstate_Hitachi_Ending"
	}
	text = {
		localization_key = "TNO_CountryClosing_epilogue_USA_Generic"
	}
}
defined_text = { #### BRITAIN END SLIDES
	name = Get_TNO_CountryClosing_epilogue_ENG
	text = {
		trigger = {
			has_country_flag = ENG_Butler_Demo_Ending
		}
		localization_key = "TNO_CountryClosing_epilogue_ENG_Butler_Demo_Ending"
	}
	text = {
		trigger = {
			has_country_flag = ENG_Wallop_Soccred_Demo_Ending
		}
		localization_key = "TNO_CountryClosing_epilogue_ENG_Wallop_Soccred_Demo_Ending"
	}
	text = {
		trigger = {
			has_country_flag = ENG_Wallop_Britfash_Demo_Ending
		}
		localization_key = "TNO_CountryClosing_epilogue_ENG_Wallop_Britfash_Demo_Ending"
	}
	text = {
		trigger = {
			has_country_flag = ENG_Fountaine_Demo_Ending
		}
		localization_key = "TNO_CountryClosing_epilogue_ENG_Fountaine_Demo_Ending"
	}
	text = {
		trigger = {
			has_country_flag = BRI_Jordan_Victory_flag
		}
		localization_key = "TNO_CountryClosing_epilogue_ENG_Jordan_Demo_Ending"
	}
	text = {
		localization_key = "TNO_CountryClosing_epilogue_generic"
	}
}
defined_text = { #### UKRAINE END SLIDES
	name = Get_TNO_CountryClosing_epilogue_UKR
	text = {
		trigger = { has_global_flag = UKR_UCW_COM_Victory }
		localization_key = "TNO_CountryClosing_epilogue_Ukraine_communist_victory_UCW"
	}
	text = {
		trigger = { has_country_flag = UKR_Brautigam_Ending }
		localization_key = "TNO_CountryClosing_epilogue_Ukraine_Brautigam_victory_UCW"
	}
	text = {
		trigger = { has_country_flag = UKR_Ohlendorf_Ending }
		localization_key = "TNO_CountryClosing_epilogue_Ukraine_Ohlendorf_victory_UCW"
	}
	text = {
		trigger = { has_country_flag = UKR_Leibbrandt_Ending }
		localization_key = "TNO_CountryClosing_epilogue_Ukraine_Leibbrandt_victory_UCW"
	}
	text = {
		trigger = { has_country_flag = BOV_UKR_Klyachkivsky_Ending }
		localization_key = "TNO_CountryClosing_epilogue_UPA_Klyachkivsky_victory_UCW"
	}
	text = {
		trigger = { has_country_flag = BOV_UKR_Shukhevych_Ending }
		localization_key = "TNO_CountryClosing_epilogue_UPA_Shukhevych_victory_UCW"
	}
	text = {
		trigger = { has_country_flag = BOV_UKR_Stetsko_Ending }
		localization_key = "TNO_CountryClosing_epilogue_UPA_Stetsko_victory_UCW"
	}
	text = {
		trigger = { has_country_flag = UKR_Dziuba_Ending }
		localization_key = "TNO_CountryClosing_epilogue_UNRA_Dziuba_victory_UCW"
	}
	text = {
		trigger = { has_country_flag = UKR_Ohloblyn_Ending }
		localization_key = "TNO_CountryClosing_epilogue_UNRA_Ohloblyn_victory_UCW"
	}
	text = {
		trigger = { has_country_flag = UKR_Stus_Ending }
		localization_key = "TNO_CountryClosing_epilogue_UNRA_Stus_victory_UCW"
	}
}
defined_text = { #### Mexico Demo END SLIDES
	name = Get_TNO_CountryClosing_epilogue_MEX
	text = {
		trigger = {
			has_country_flag = TNO_MEX_ORD_SUC
		}
		localization_key = "TNO_CountryClosing_epilogue_MEX_Demo_Ordaz"
	}
	text = {
		trigger = {
			has_country_flag = TNO_MEX_LOZ_SUC
		}
		localization_key = "TNO_CountryClosing_epilogue_MEX_Demo_Lozano"
	}
	text = {
		trigger = {
			has_country_flag = TNO_MEX_MAD_SUC
		}
		localization_key = "TNO_CountryClosing_epilogue_MEX_Demo_Madrazo"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_epilogue_AAA
	text = {
		trigger = { has_country_flag = AAA_won }
		localization_key = TNO_CountryClosing_epilogue_AAA_Success
	}
	text = {
		localization_key = TNO_CountryClosing_epilogue_AAA_Failure
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_epilogue_AAO
	text = {
		trigger = {
			has_country_leader = {
				character = AAO_Edmund_Hillary
				ruling_only = yes
			}
		}
		localization_key = TNO_CountryClosing_epilogue_AAO_Hillary
	}
	text = {
		trigger = {
			has_country_leader = {
				character = AAO_Howard_Beale
				ruling_only = yes
			}
		}
		localization_key = TNO_CountryClosing_epilogue_AAO_Beale
	}
	text = {
		trigger = {
			has_country_leader = {
				character = AAO_Hyman_Rickover
				ruling_only = yes
			}
		}
		localization_key = TNO_CountryClosing_epilogue_AAO_Rickover
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_epilogue_AAG
	text = {
		trigger = { has_country_flag = AAG_won }
		localization_key = TNO_CountryClosing_epilogue_AAG_Success
	}
	text = {
		localization_key = TNO_CountryClosing_epilogue_AAG_Failure
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_epilogue_AAC
	text = {
		trigger = {
			has_country_leader = {
				character = AAC_Julio_Escudero_Guzman
				ruling_only = yes
			}
			has_country_flag = AAC_Marine_Mission_Success
		}
		localization_key = TNO_CountryClosing_epilogue_AAC_Guzman_Success
	}
	text = {
		trigger = {
			has_country_leader = {
				character = AAC_Julio_Escudero_Guzman
				ruling_only = yes
			}
		}
		localization_key = TNO_CountryClosing_epilogue_AAC_Guzman_Failure
	}
	text = {
		trigger = {
			has_country_leader = {
				character = AAC_Jose_Toribio_Merino
				ruling_only = yes
			}
			has_country_flag = AAC_Marine_Mission_Success
		}
		localization_key = TNO_CountryClosing_epilogue_AAC_Merino_Success
	}
	text = {
		trigger = {
			has_country_leader = {
				character = AAC_Jose_Toribio_Merino
				ruling_only = yes
			}
		}
		localization_key = TNO_CountryClosing_epilogue_AAC_Merino_Failure
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_epilogue_BRA

	# SOUTH ATLANTIC WAR
	text = {
		trigger = {
			has_country_leader = {
				character = BRA_Adhemar_de_Barros
				ruling_only = yes
			}
			has_global_flag = SATW_Brazil_Victory
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Adhemar_Wins_War
	}
	text = {
		trigger = {
			has_country_leader = {
				character = BRA_Adhemar_de_Barros
				ruling_only = yes
			}
			has_global_flag = SATW_Argentina_Victory
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Adhemar_Loses_War
	}
	text = {
		trigger = {
			has_country_leader = {
				character = BRA_Carlos_Lacerda
				ruling_only = yes
			}
			has_global_flag = SATW_Brazil_Victory
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Lacerda_Wins_War
	}
	text = {
		trigger = {
			has_country_leader = {
				character = BRA_Carlos_Lacerda
				ruling_only = yes
			}
			has_global_flag = SATW_Argentina_Victory
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Lacerda_Loses_War
	}
	text = {
		trigger = {
			has_country_leader = {
				character = BRA_Virgilio_Tavora
				ruling_only = yes
			}
			has_global_flag = SATW_Brazil_Victory
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Tavora_Wins_War
	}
	text = {
		trigger = {
			has_country_leader = {
				character = BRA_Virgilio_Tavora
				ruling_only = yes
			}
			has_global_flag = SATW_Argentina_Victory
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Tavora_Loses_War
	}
	text = {
		trigger = { has_global_flag = SATW_Brazil_Victory }
		localization_key = TNO_CountryClosing_epilogue_BRA_Someone_Wins_War
	}
	text = {
		trigger = { has_global_flag = SATW_Argentina_Victory }
		localization_key = TNO_CountryClosing_epilogue_BRA_Someone_Loses_War
	}

	# IMPERIAL LACERDA
	text = {
		trigger = { has_country_flag = BRA_Lacerda_Imp_Victory_flag }
		localization_key = TNO_CountryClosing_epilogue_BRA_Lacerda_Imp_Victory
	}
	text = {
		trigger = { has_country_flag = BRA_Lacerda_Imp_Failure_flag }
		localization_key = TNO_CountryClosing_epilogue_BRA_Lacerda_Imp_Failure
	}

	# ADHEMAR
	text = {
		trigger = {
			AND = {
				has_country_flag = BRA_ADHEMAR_SURVIVES
				has_country_flag = BRA_vargas_won_1970
				check_variable = { BRA_adhemar_wealth > 149.99 }
				check_variable = { BRA_adhemar_legacy > 4 }
			}
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Adhemar_Big_Win_Jackpot
	}
	text = {
		trigger = {
			AND = {
				has_country_flag = BRA_ADHEMAR_SURVIVES
				has_country_flag = BRA_vargas_won_1970
			}
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Adhemar_Lives_Vargas_Wins
	}
	text = {
		trigger = {
			AND = {
				has_country_flag = BRA_ADHEMAR_SURVIVES
				NOT = { has_country_flag = BRA_vargas_won_1970 }
			}
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Adhemar_Lives_Vargas_Loses
	}
	text = {
		trigger = {
			AND = {
				has_country_flag = BRA_ADHEMAR_DIES
				has_country_flag = BRA_vargas_won_1970
			}
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Adhemar_Dies_Vargas_Wins
	}
	text = {
		trigger = {
			AND = {
				has_country_flag = BRA_ADHEMAR_DIES
				has_country_flag = BRA_edna_won_1970
			}
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Adhemar_Dies_Edna_Wins
	}
	text = {
		trigger = { has_country_flag = BRA_ADHEMAR_DIES }
		localization_key = TNO_CountryClosing_epilogue_BRA_Adhemar_Dies_Someone_Wins
	}

	# DEMOCRATIC LACERDA / TAVORA
	text = {
		trigger = {
			has_country_flag = BRA_tavora_coup_happened
			has_country_leader = {
				character = BRA_Ney_Braga
				ruling_only = yes
			}
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Tavora_Win
	}
	text = {
		trigger = {
			has_country_flag = BRA_tavora_coup_happened
			NOT = {
				has_country_leader = {
					character = BRA_Ney_Braga
					ruling_only = yes
				}
			}
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Tavora_Fail
	}
	text = {
		trigger = {
			NOT = {
				has_country_flag = BRA_tavora_coup_happened
			}
			has_country_leader = {
				character = BRA_Raphael_Magalhaes
				ruling_only = yes
			}
			is_in_faction_with = USA
			# triggers for passing all bills and winning all proxies to be added
			check_variable = {
				var = Lacerda_Success_Meter
				value = 9
				compare = greater_than_or_equals
			}
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Lacerda_Win_Max
	}
	text = {
		trigger = {
			has_country_flag = BRA_lacerda_strikes_over
			NOT = {
				has_country_flag = BRA_tavora_coup_happened
			}
			has_country_leader = {
				character = BRA_Raphael_Magalhaes
				ruling_only = yes
			}
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Lacerda_Win_Mid
	}
	text = {
		trigger = {
			has_country_flag = BRA_lacerda_strikes_over
			NOT = {
				has_country_flag = BRA_tavora_coup_happened
				has_country_leader = {
					character = BRA_Raphael_Magalhaes
					ruling_only = yes
				}
			}
		}
		localization_key = TNO_CountryClosing_epilogue_BRA_Lacerda_Win_Min
	}

	# GENERIC
	text = {
		localization_key = TNO_CountryClosing_epilogue_generic
	}
}

# / Main GUI Elements
defined_text = {
	name = Get_TNO_CountryClosing_credits
	text = {
		trigger = { check_variable = { CountryClosing_array_credits_pages^0 = 2 } }
		localization_key = "TNO_CountryClosing_credits_0"
	}
	text = {
		trigger = { check_variable = { CountryClosing_array_credits_pages^1 = 2 } }
		localization_key = "TNO_CountryClosing_credits_1"
	}
	text = {
		trigger = { check_variable = { CountryClosing_array_credits_pages^2 = 2 } }
		localization_key = "TNO_CountryClosing_credits_2"
	}
}
defined_text = {
	name = Get_TNO_CountryClosing_page_btn_text
	text = {
		trigger = {
			set_temp_variable = { displayNumber = i }
			add_to_temp_variable = { displayNumber = 1 }
		}
		localization_key = "[?displayNumber]"
	}
}