scripted_gui = {
	ending_text = {
		window_name = "ending_text"
		context_type = player_context
		visible = {
			has_country_flag = ending_text_active
		}
	}


	endings_gui = {
		window_name = "ending_window"
		context_type = player_context
		visible = {
			OR = {
				has_country_flag = ending_all
				has_country_flag = ending_bob
				has_country_flag = ending_kra
				has_country_flag = ending_krabob
				has_country_flag = ending_squ
				has_country_flag = ending_squbob
				has_country_flag = ending_squkra
				has_country_flag = ending_pat
				has_country_flag = ending_victory
				has_country_flag = ending_unrest
			}
		}

		
		triggers = {
			bg_blacked_visible = {
				has_country_flag = ending_text_active
			}
			blacked_bg_visible = {
				has_country_flag = ending_text_active
			}
			all_bg_visible = {
				has_country_flag = ending_all
			}
			bob_bg_visible = {
				has_country_flag = ending_bob
			}
			kra_bg_visible = {
				has_country_flag = ending_kra
			}
			krabob_bg_visible = {
				has_country_flag = ending_krabob
			}
			squ_bg_visible = {
				has_country_flag = ending_squ
			}
			squbob_bg_visible = {
				has_country_flag = ending_squbob
			}
			squkra_bg_visible = {
				has_country_flag = ending_squkra
			}
			pat_bg_visible = {
				has_country_flag = ending_pat
			}
			victory_bg_visible = {
				has_country_flag = ending_victory
			}
			unrest_bg_visible = {
				has_country_flag = ending_unrest
			}
 
		}
	}
	
		speech_text = {
		window_name = "speech_window"
		context_type = player_context
		visible = {
			OR = {
				has_country_flag = ending_all
				has_country_flag = ending_bob
				has_country_flag = ending_kra
				has_country_flag = ending_krabob
				has_country_flag = ending_squ
				has_country_flag = ending_squbob
				has_country_flag = ending_squkra
				has_country_flag = ending_pat 
				has_country_flag = ending_victory
				has_country_flag = ending_unrest

			}
			NOT = {
				has_country_flag = ending_text_active
			}
		}
				effects = {
 			move_dialogue_click = {
				if = {
					limit = {
					AND = {
						check_variable = { dialogue_progress < 13 }
				has_country_flag = ending_pat 
						
					}					}

					add_to_variable = { var = dialogue_progress value = 1 }
				}

				else_if = {
					limit = {
						check_variable = { dialogue_progress < 6 }
					}
					add_to_variable = { var = dialogue_progress value = 1 }
				}
 
				else = {
					set_country_flag = ending_text_active
				}
			}
		}
	}

}