##########################
#
# TIMELINE EVENTS
#
##########################

namespace = timeline

# Startup Test
# When adding new timeline events ensure there are zoom level scripts in eventpictures.gfx for the art used in the event
event = {
	id = timeline.0
	hide_window = yes
	is_triggered_only = yes

	# trigger = {
	# 	is_country_type = default
	# }

	immediate = {
		## Add Origins to Timeline ##
		every_playable_country = {
			limit = {
				is_country_type = default
			}
			country_event = { id = timeline.1 }
		}
	}
}

country_event = {
	id = timeline.1
	hide_window = yes
	is_triggered_only = yes

	immediate = {

		switch = {
			trigger = has_origin
			origin_red_giant = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_red_giant_desc"
					override_text = { "text:origin_red_giant" }
					override_texture = { "background:GFX_origin_red_giant" }
					override_id = timeline_origin_red_giant
				}
			}
			origin_cosmic_dawn = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_cosmic_dawn_desc"
					override_text = { "text:origin_cosmic_dawn" }
					override_texture = { "background:GFX_origin_cosmic_dawn" }
					override_id = timeline_origin_cosmic_dawn
				}
			}
			origin_forever_cruise = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_forever_cruise_desc"
					override_text = { "text:origin_forever_cruise" }
					override_texture = { "background:GFX_origin_forever_cruise" }
					override_id = timeline_origin_forever_cruise
				}
			}
			origin_heirs_of_the_khan = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_heirs_of_the_khan_desc"
					override_text = { "text:origin_heirs_of_the_khan" }
					override_texture = { "background:GFX_origin_heirs_of_the_khan" }
					override_id = timeline_origin_heirs_of_the_khan
				}
			}
			origin_default_nomads = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_default_nomads_desc"
					override_text = { "text:origin_default_nomads" }
					override_texture = { "background:GFX_origin_nomad_default" }
					override_id = timeline_origin_default_nomads
				}
			}
			origin_sacred_path = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_sacred_path_desc"
					override_text = { "text:origin_sacred_path" }
					override_texture = { "background:GFX_origin_sacred_path" }
					override_id = timeline_origin_sacred_path
				}
			}
			origin_evolutionary_predators = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_evolutionary_predators_desc"
					override_text = { "text:origin_evolutionary_predators" }
					override_texture = { "background:GFX_origin_evolutionary_predators" }
					override_id = timeline_origin_evolutionary_predators
				}
			}
			origin_unplugged = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_unplugged_desc"
					override_text = { "text:origin_unplugged" }
					override_texture = { "background:GFX_origin_unplugged" }
					override_id = timeline_origin_unplugged
				}
			}
			origin_starlit_citadel = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_starlit_citadel_desc"
					override_text = { "text:origin_starlit_citadel" }
					override_texture = { "background:GFX_origin_starlit_citadel" }
					override_id = timeline_origin_starlit_citadel
				}
			}
			origin_wilderness = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_wilderness_desc"
					override_text = { "text:origin_wilderness" }
					override_texture = { "background:GFX_origin_wilderness" }
					override_id = timeline_origin_wilderness
				}
			}
			origin_storm_chasers = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_storm_chasers_desc"
					override_text = { "text:origin_storm_chasers" }
					override_texture = { "background:GFX_origin_storm_chasers" "origin_icon:GFX_origin_storm_chasers_icon" }
					override_id = timeline_origin_storm_chasers
				}
			}
			origin_life_seeded = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_life_seeded_desc"
					override_text = { "text:origin_life_seeded" }
					override_texture = { "background:GFX_origin_life_seeded"}
					override_id = timeline_origin_life_seeded
				}
			}
			origin_syncretic_evolution = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_syncretic_evolution_desc"
					override_text = { "text:origin_syncretic_evolution" }
					override_texture = { "background:GFX_origin_syncretic_evolution" }
					override_id = timeline_origin_syncretic_evolution
				}
			}
			origin_common_ground = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_common_ground_desc"
					override_text = { "text:origin_common_ground" }
					override_texture = { "background:GFX_origin_common_ground" }
					override_id = timeline_origin_common_ground
				}
			}
			origin_post_apocalyptic = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_post_apocalyptic_desc"
					override_text = { "text:origin_post_apocalyptic" }
					override_texture = { "background:GFX_origin_post_apocalyptic" }
					override_id = timeline_origin_post_apocalyptic
				}
			}
			origin_shoulders_of_giants = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_shoulders_of_giants_desc"
					override_text = { "text:origin_shoulders_of_giants" }
					override_texture = { "background:GFX_origin_shoulders" }
					override_id = timeline_origin_shoulders_of_giants
				}
			}
			origin_scion = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_scion_desc"
					override_text = { "text:origin_scion" }
					override_texture = { "background:GFX_origin_scion" }
					override_id = timeline_origin_scion
				}
			}
			origin_doomsday = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_doomsday_desc"
					override_text = { "text:origin_doomsday" }
					override_texture = { "background:GFX_origin_doomsday" }
					override_id = timeline_origin_doomsday
				}
			}
			origin_remnants = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_remnants_desc"
					override_text = { "text:origin_remnants" }
					override_texture = { "background:GFX_origin_remnants" }
					override_id = timeline_origin_remnants
				}
			}
			origin_galactic_doorstep = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_galactic_doorstep_desc"
					override_text = { "text:origin_galactic_doorstep" }
					override_texture = { "background:GFX_origin_galactic_doorstep" }
					override_id = timeline_origin_galactic_doorstep
				}
			}
			origin_lost_colony = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_lost_colony_desc"
					override_text = { "text:origin_lost_colony" }
					override_texture = { "background:GFX_origin_lost_colony" }
					override_id = timeline_origin_lost_colony
				}
			}
			origin_mechanists = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_mechanists_desc"
					override_text = { "text:origin_mechanists" }
					override_texture = { "background:GFX_origin_mechanist" }
					override_id = timeline_origin_mechanists
				}
			}
			origin_clone_army = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_clone_army_desc"
					override_text = { "text:origin_clone_army" }
					override_texture = { "background:GFX_origin_clone_army" }
					override_id = timeline_origin_clone_army
				}
			}
			origin_hegemon = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_hegemon_desc"
					override_text = { "text:origin_hegemon" }
					override_texture = { "background:GFX_origin_hegemon" }
					override_id = timeline_origin_hegemon
				}
			}
			origin_shattered_ring = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_shattered_ring_desc"
					override_text = { "text:origin_shattered_ring" }
					override_texture = { "background:GFX_origin_shattered_ring" }
					override_id = timeline_origin_shattered_ring
				}
			}
			origin_void_dwellers = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_void_dwellers_desc"
					override_text = { "text:origin_void_dwellers" }
					override_texture = { "background:GFX_origin_void_dwellers" }
					override_id = timeline_origin_void_dwellers
				}
			}
			origin_necrophage = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_necrophage_desc"
					override_text = { "text:origin_necrophage" }
					override_texture = { "background:GFX_origin_necrophage" }
					override_id = timeline_origin_necrophage
				}
			}
			origin_here_be_dragons = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_here_be_dragons_desc"
					override_text = { "text:origin_here_be_dragons" }
					override_texture = { "background:GFX_origin_here_be_dragons" }
					override_id = timeline_origin_here_be_dragons
				}
			}
			origin_ocean_paradise = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_ocean_paradise_desc"
					override_text = { "text:origin_ocean_paradise" }
					override_texture = { "background:GFX_origin_ocean_paradise" }
					override_id = timeline_origin_ocean_paradise
				}
			}
			origin_toxic_knights = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_toxic_knights_desc"
					override_text = { "text:origin_toxic_knights" }
					override_texture = { "background:GFX_origin_toxic_knights" }
					override_id = timeline_origin_toxic_knights
				}
			}
			origin_overtuned = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_overtuned_desc"
					override_text = { "text:origin_overtuned" }
					override_texture = { "background:GFX_origin_overtuned" }
					override_id = timeline_origin_overtuned
				}
			}
			origin_imperial_vassal = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_imperial_vassal_desc"
					override_text = { "text:origin_imperial_vassal" }
					override_texture = { "background:GFX_origin_imperial_vassal" }
					override_id = timeline_origin_imperial_vassal
				}
			}
			origin_star_slingshot = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_star_slingshot_desc"
					override_text = { "text:origin_star_slingshot" }
					override_texture = { "background:GFX_origin_star_slingshot" }
					override_id = timeline_origin_star_slingshot
				}
			}
			origin_subterranean = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_subterranean_desc"
					override_text = { "text:origin_subterranean" }
					override_texture = { "background:GFX_origin_subterranean" }
					override_id = timeline_origin_subterranean
				}
			}
			origin_shroudwalker_apprentice = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_shroudwalker_apprentice_desc"
					override_text = { "text:origin_shroudwalker_apprentice" }
					override_texture = { "background:GFX_origin_shroudwalker_apprentice" }
					override_id = timeline_origin_shroudwalker_apprentice
				}
			}
			origin_broken_shackles = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_broken_shackles_desc"
					override_text = { "text:origin_broken_shackles" }
					override_texture = { "background:GFX_origin_broken_shackles" }
					override_id = timeline_origin_broken_shackles
				}
			}
			origin_payback = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_payback_desc"
					override_text = { "text:origin_payback" }
					override_texture = { "background:GFX_origin_payback" }
					override_id = timeline_origin_payback
				}
			}
			origin_fear_of_the_dark = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_fear_of_the_dark_desc"
					override_text = { "text:origin_fear_of_the_dark" }
					override_texture = { "background:GFX_origin_fear_of_the_dark" }
					override_id = timeline_origin_fear_of_the_dark
				}
			}
			origin_legendary_leader = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_legendary_leader_desc"
					override_text = { "text:origin_legendary_leader" }
					override_texture = { "background:GFX_origin_legendary_leader" }
					override_id = timeline_origin_legendary_leader
				}
			}
			origin_riftworld = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_riftworld_desc"
					override_text = { "text:origin_riftworld" }
					override_texture = { "background:GFX_origin_riftworld" }
					override_id = timeline_origin_riftworld
				}
			}
			origin_cybernetic_creed = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_cybernetic_creed_desc"
					override_text = { "text:origin_cybernetic_creed" }
					override_texture = { "background:GFX_origin_cybernetic_creed" }
					override_id = timeline_origin_cybernetic_creed
				}
			}
			origin_synthetic_fertility = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_synthetic_fertility_desc"
					override_text = { "text:origin_synthetic_fertility" }
					override_texture = { "background:GFX_origin_synthetic_fertility" }
					override_id = timeline_origin_synthetic_fertility
				}
			}
			origin_primal_calling = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_primal_calling_desc"
					override_text = { "text:origin_primal_calling" }
					override_texture = { "background:GFX_origin_primal_calling" }
					override_id = timeline_origin_primal_calling
				}
			}
			origin_treasure_hunters = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_treasure_hunters_desc"
					override_text = { "text:origin_treasure_hunters" }
					override_texture = { "background:GFX_origin_treasure_hunters" }
					override_id = timeline_origin_treasure_hunters
				}
			}
			origin_fruitful = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_fruitful_desc"
					override_text = { "text:origin_fruitful" }
					override_texture = { "background:GFX_origin_fruitful" }
					override_id = timeline_origin_fruitful
				}
			}
			origin_lithoid = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_lithoid_desc"
					override_text = { "text:origin_lithoid" }
					override_texture = { "background:GFX_origin_calamitous" }
					override_id = timeline_origin_lithoid
				}
			}
			origin_arc_welders = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_arc_welders_desc"
					override_text = { "text:origin_arc_welders" }
					override_texture = { "background:GFX_origin_arc_welders" }
					override_id = timeline_origin_arc_welders
				}
			}
			origin_tree_of_life = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_tree_of_life_desc"
					override_text = { "text:origin_tree_of_life" }
					override_texture = { "background:GFX_origin_tree" }
					override_id = timeline_origin_tree_of_life
				}
			}
			origin_progenitor_hive = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_progenitor_hive_desc"
					override_text = { "text:origin_progenitor_hive" }
					override_texture = { "background:GFX_origin_progenitor_hive" }
					override_id = timeline_origin_progenitor_hive
				}
			}
			origin_machine = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_machine_desc"
					override_text = { "text:origin_machine" }
					override_texture = { "background:GFX_origin_resource_consolidation" }
					override_id = timeline_origin_machine
				}
			}
			origin_separatists = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_separatists_desc"
					override_text = { "text:origin_separatists" }
					override_texture = { "background:GFX_evt_organic_oppression" }
					override_id = timeline_origin_separatists
				}
			}
			origin_demonic_incursion = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_demonic_incursion_desc"
					override_text = { "text:origin_demonic_incursion" }
					override_texture = { "background:GFX_evt_space_dragon" }
					override_id = timeline_origin_demonic_incursion
				}
			}
			origin_shroud_forged = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_shroud_forged_desc"
					override_text = { "text:origin_shroud_forged" }
					override_texture = { "background:GFX_origin_shroud_forged_zoom_1" }
					override_id = timeline_origin_shroud_forged
				}
			}
			origin_mindwardens = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_mindwardens_desc"
					override_text = { "text:origin_mindwardens" }
					override_texture = { "background:GFX_origin_mindwardens_zoom_1" }
					override_id = timeline_origin_mindwardens
				}
			}
			origin_endbringers = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_endbringers_desc"
					override_text = { "text:origin_endbringers" }
					override_texture = { "background:GFX_origin_endbringers_zoom_1" }
					override_id = timeline_origin_endbringers
				}
			}
			origin_default = {
				add_timeline_event = {
					type = timeline_origin
					override_tooltip = "origin_default_desc"
					override_text = { "text:origin_default" }
					override_texture = { "background:GFX_origin_default" }
					override_id = timeline_origin_default
				}
			}
		}
		## Add Dotted Line for First Year ##
		add_timeline_event = {
			type = timeline_event_year
		}
	}
}

#########################
## Yearly GUI Elements ##
#########################

country_event = {
	id = timeline.2
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		add_timeline_event = {
			type = timeline_event_year
		}
	}

	after = {
		export_trigger_value_to_variable = { # Used for Milestone to calculate whether victory year is reached
			trigger = years_passed
			variable = years_passed
		}
	}
}

##################################
## Milestones and Empire Events ##
##################################

# New Colony
carrier_event = {
	id = timeline.3
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		owner = {
			is_country_type = default
			is_nomadic = no
		}
	}

	immediate = {
		save_event_target_as = this_planet

		owner = {
			save_event_target_as = this_country
			if = {
				limit = {
					NOT = { has_country_flag = first_colony_established }
				}
				set_country_flag = first_colony_established
				add_timeline_event = {
					type = timeline_milestone
					override_id = timeline_first_colony
					override_tooltip = "TIMELINE_EVENT_FIRST_COLONY_TOOLTIP"
					override_types = { country planet }
					override_text = { "text:TIMELINE_FIRST_COLONY" }
					override_texture = { "background:GFX_evt_big_landing_ship" }
					targets = { event_target:this_country event_target:this_planet }
				}
			}
			else = {
				add_timeline_event = {
					type = timeline_empire
					override_id = timeline_new_colony
					override_tooltip = "TIMELINE_EVENT_NEW_COLONY_TOOLTIP"
					override_types = { country planet }
					override_text = { "text:TIMELINE_NEW_COLONY" }
					override_texture = { "background:GFX_evt_colony_settlement" }
					targets = { event_target:this_country event_target:this_planet }
				}
			}
		}
	}

}

# War Declared
country_event = {
	id = timeline.4
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		fromfrom = {
			any_attacker = {
			is_same_value = root
			is_war_leader = yes
			}
		}
	}

	immediate = {
		fromfrom = {
			random_defender = {
				save_event_target_as = this_country_defender
			}
			random_attacker = {
				limit = {
					is_same_value = root
					is_war_leader = yes
				}
				save_event_target_as = this_country_attacker
				if = {
					limit = {
						NOT = { has_country_flag = first_war_declared }
					}
					set_country_flag = first_war_declared
					add_timeline_event = {
						type = timeline_milestone
						override_id = timeline_first_war_declared
						override_tooltip = "TIMELINE_EVENT_FIRST_WAR_DECLARED_TOOLTIP"
						override_types = { country country }
						override_text = { "text:TIMELINE_FIRST_WAR_DECLARED" }
						override_texture = { "background:GFX_evt_burning_city" }
						targets = { event_target:this_country_attacker event_target:this_country_defender }
					}
				}
				else = {
					add_timeline_event = {
						type = timeline_empire
						override_id = timeline_war_declared_attacker
						override_tooltip = "TIMELINE_EVENT_WAR_DECLARED_TOOLTIP"
						override_types = { country country }
						override_text = { "text:TIMELINE_WAR_DECLARED" }
						override_texture = { "background:GFX_evt_small_space_battle" }
						targets = { event_target:this_country_attacker event_target:this_country_defender }
					}
				}
			}
			event_target:this_country_defender = {
				add_timeline_event = {
					type = timeline_empire
					override_id = timeline_war_declared_defender
					override_tooltip = "TIMELINE_EVENT_WAR_DECLARED_TOOLTIP"
					override_types = { country country }
					override_text = { "text:TIMELINE_WAR_DECLARED" }
					override_texture = { "background:GFX_evt_small_space_battle" }
					targets = { event_target:this_country_attacker event_target:this_country_defender }
				}
			}
		}
	}
}

# First Subject
country_event = {
	id = timeline.5
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		from = {
			is_country_type = default
		}
	}

	immediate = {
		this = {
			save_event_target_as = this_country_vassal
		}

		from = {
			save_event_target_as = this_country
			if = {
				limit = {
					NOT = { has_country_flag = first_vassal }
				}
				set_country_flag = first_vassal
				add_timeline_event = {
					type = timeline_milestone
					override_id = timeline_first_vassal
					override_tooltip = "TIMELINE_EVENT_FIRST_VASSAL_TOOLTIP"
					override_types = { country country }
					override_text = { "text:TIMELINE_FIRST_VASSAL" }
					override_texture = { "background:GFX_evt_imperial_vassal" }
					targets = { event_target:this_country event_target:this_country_vassal }
				}
			}
			else = {
				add_timeline_event = {
					type = timeline_empire
					override_id = timeline_new_vassal
					override_tooltip = "TIMELINE_EVENT_NEW_VASSAL_TOOLTIP"
					override_types = { country country }
					override_text = { "text:TIMELINE_NEW_VASSAL" }
					override_texture = { "background:GFX_evt_partition" }
					targets = { event_target:this_country event_target:this_country_vassal }
				}
			}
		}

		this = {
			add_timeline_event = {
				type = timeline_empire
				override_id = timeline_vassalized
				override_tooltip = "TIMELINE_EVENT_VASSALIZED_TOOLTIP"
				override_types = { country country }
				override_text = { "text:TIMELINE_VASSALIZED" }
				override_texture = { "background:GFX_evt_one_sided_deal" }
				targets = { event_target:this_country event_target:this_country_vassal }
			}
		}
	}
}

# First Intelligent Life
first_contact_event = {
	id = timeline.6
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		owner = {
			is_country_type = default
			NOT = { has_country_flag = first_intelligent_life }
		}
	}

	immediate = {
		owner = {
			set_country_flag = first_intelligent_life
			save_event_target_as = this_country
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_intelligent_life
				override_tooltip = "TIMELINE_EVENT_FIRST_INTELLIGENT_LIFE_TOOLTIP"
				override_types = { country }
				override_text = { "text:TIMELINE_FIRST_INTELLIGENT_LIFE" }
				override_texture = { "background:GFX_evt_alien_hieroglyphics" }
				targets = { event_target:this_country }
			}
		}
	}
}

# Rebellion
country_event = {
	id = timeline.7
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		from = { # Planet
			save_event_target_as = this_planet
		}

		if = {
			limit = {
				NOT = { has_country_flag = first_rebellion }
			}
			set_country_flag = first_rebellion
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_rebellion
				override_tooltip = "TIMELINE_EVENT_FIRST_REBELLION_TOOLTIP"
				override_types = { country planet }
				override_text = { "text:TIMELINE_FIRST_REBELLION" }
				override_texture = { "background:GFX_evt_alien_propaganda" }
				targets = { event_target:this_country event_target:this_planet }
			}
		}
		else = {
			add_timeline_event = {
				type = timeline_empire
				override_id = timeline_rebellion
				override_tooltip = "TIMELINE_EVENT_REBELLION_TOOLTIP"
				override_types = { country planet }
				override_text = { "text:TIMELINE_REBELLION" }
				override_texture = { "background:GFX_evt_open_revolt" }
				targets = { event_target:this_country event_target:this_planet }
			}
		}
	}
}

# Megastructure
country_event = {
	id = timeline.8
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		from.owner? = {
			is_same_value = root
		}
	}

	immediate = {
		save_event_target_as = this_country

		from = {
			save_event_target_as = this_megastructure
		}

		if = {
			limit = {
				NOT = { has_country_flag = first_megastructure }
			}
			set_country_flag = first_megastructure
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_megastructure
				override_tooltip = "TIMELINE_EVENT_FIRST_MEGASTRUCTURE_TOOLTIP"
				override_types = { country megastructure }
				override_text = { "text:TIMELINE_FIRST_MEGASTRUCTURE" }
				override_texture = { "background:GFX_evt_megastructure_construction" }
				targets = { event_target:this_country event_target:this_megastructure }
			}
		}
		else = {
			add_timeline_event = {
				type = timeline_empire
				override_id = timeline_megastructure
				override_tooltip = "TIMELINE_EVENT_MEGASTRUCTURE_TOOLTIP"
				override_types = { country megastructure }
				override_text = { "text:TIMELINE_EVENT_MEGASTRUCTURE" }
				override_texture = { "background:GFX_evt_megastructure_construction" }
				targets = { event_target:this_country event_target:this_megastructure }
			}
		}
	}
}

# First Precursor
country_event = {
	id = timeline.9
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		has_precursor_intro = yes
		NOT = { has_country_flag = first_precursor }
	}

	immediate = {
		set_country_flag = first_precursor

		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_first_precursor_discovered
			override_tooltip = "TIMELINE_EVENT_FIRST_PRECURSOR_DISCOVERED_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_FIRST_PRECURSOR_DISCOVERED" }
			override_texture = { "background:GFX_evt_alien_ruins" }
			targets = { event_target:this_country }
		}
	}
}

# First Espionage Action
country_event = {
	id = timeline.10
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		NOT = { has_country_flag = first_espionage_action }
	}

	immediate = {
		set_country_flag = first_espionage_action
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_first_espionage_action
			override_tooltip = "TIMELINE_EVENT_FIRST_ESPIONAGE_ACTION_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_FIRST_ESPIONAGE_ACTION" }
			override_texture = { "background:GFX_evt_spy_network" }
			targets = { event_target:this_country }
		}
	}
}

# First Astral Rift
country_event = {
	id = timeline.11
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		NOT = { has_country_flag = first_astral_rift }
	}

	immediate = {
		set_country_flag = first_astral_rift

		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_first_astral_rift
			override_tooltip = "TIMELINE_EVENT_FIRST_ASTRAL_RIFT_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_FIRST_ASTRAL_RIFT" }
			override_texture = { "background:GFX_evt_astral_rift" }
			targets = { event_target:this_country }
		}
	}
}

# First Arc Site
ship_event = {
	id = timeline.12
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		owner = {
			is_country_type = default
			NOT = { has_country_flag = first_arc_site }
		}
		from = {
			exists = archaeological_site
		}
	}

	immediate = {
		from = {
			save_event_target_as = this_planet
		}

		owner = {
			set_country_flag = first_arc_site
			save_event_target_as = this_country
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_arc_site
				override_tooltip = "TIMELINE_EVENT_FIRST_ARC_SITE_TOOLTIP"
				override_types = { country planet }
				override_text = { "text:TIMELINE_FIRST_ARC_SITE" }
				override_texture = { "background:GFX_evt_archaeological_dig" }
				targets = { event_target:this_country event_target:this_planet }
			}
		}
	}
}

# First Ascension Perk
country_event = {
	id = timeline.13
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		num_ascension_perks > 0
		NOT = { has_country_flag = first_ascension_perk }
	}

	immediate = {
		set_country_flag = first_ascension_perk

		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_first_ascension_perk
			override_tooltip = "TIMELINE_EVENT_FIRST_ASCENSION_PERK_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_FIRST_ASCENSION_PERK" }
			override_texture = { "background:GFX_evt_throne_room" }
			targets = { event_target:this_country }
		}
	}
}

# War Won
country_event = {
	id = timeline.14
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		from = {
			save_event_target_as = this_loser_country
		}

		save_event_target_as = this_country

		if = {
			limit = {
				NOT = { has_country_flag = first_war_won }
			}
			set_country_flag = first_war_won
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_war_won
				override_tooltip = "TIMELINE_EVENT_FIRST_WAR_WON_TOOLTIP"
				override_types = { country country }
				override_text = { "text:TIMELINE_FIRST_WAR_WON" }
				override_texture = { "background:GFX_evt_victorious_army" }
				targets = { event_target:this_country event_target:this_loser_country }
			}
		}
		else = {
			add_timeline_event = {
				type = timeline_empire
				override_id = timeline_war_won
				override_tooltip = "TIMELINE_EVENT_WAR_WON_TOOLTIP"
				override_types = { country country }
				override_text = { "text:TIMELINE_WAR_WON" }
				override_texture = { "background:GFX_evt_signing" }
				targets = { event_target:this_country event_target:this_loser_country }
			}
		}
	}
}

# War Lost
country_event = {
	id = timeline.15
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		from = {
			save_event_target_as = this_winner_country
		}

		save_event_target_as = this_country

		if = {
			limit = {
				NOT = { has_country_flag = first_war_lost }
			}
			set_country_flag = first_war_lost
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_war_lost
				override_tooltip = "TIMELINE_EVENT_FIRST_WAR_LOST_TOOLTIP"
				override_types = { country country }
				override_text = { "text:TIMELINE_FIRST_WAR_LOST" }
				override_texture = { "background:GFX_evt_exploding_ship" }
				targets = { event_target:this_country event_target:this_winner_country }
			}
		}
		else = {
			add_timeline_event = {
				type = timeline_empire
				override_id = timeline_war_lost
				override_tooltip = "TIMELINE_EVENT_WAR_LOST_TOOLTIP"
				override_types = { country country }
				override_text = { "text:TIMELINE_WAR_LOST" }
				override_texture = { "background:GFX_evt_surrender" }
				targets = { event_target:this_country event_target:this_winner_country }
			}
		}
	}
}

# First Galactic Custodian Appointment
country_event = {
	id = timeline.16
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		NOT = { has_country_flag = first_custodian_appointment }
	}

	immediate = {
		set_country_flag = first_custodian_appointment

		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_first_custodian_appointment
			override_tooltip = "TIMELINE_EVENT_FIRST_CUSTODIAN_APPOINTMENT_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_FIRST_CUSTODIAN_APPOINTMENT" }
			override_texture = { "background:GFX_evt_galactic_senate" }
			targets = { event_target:this_country }
		}
	}
}

# First Galactic Emperor Appointment
country_event = {
	id = timeline.17
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		is_galactic_emperor = yes
		NOT = { has_country_flag = first_emperor_appointment }
	}

	immediate = {
		set_country_flag = first_emperor_appointment

		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_first_galactic_appointment
			override_tooltip = "TIMELINE_EVENT_FIRST_EMPEROR_APPOINTMENT_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_FIRST_EMPEROR_APPOINTMENT" }
			override_texture = { "background:GFX_evt_galactic_empire" }
			targets = { event_target:this_country }
		}
	}
}

# Join Federation
country_event = {
	id = timeline.18
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		days_passed > 1
	}

	immediate = {
		save_event_target_as = this_country

		if = {
			limit = {
				NOT = { has_country_flag = first_federation_formed }
				is_federation_leader = yes
			}
			set_country_flag = first_federation_formed
			add_timeline_event = {
			type = timeline_milestone
				override_id = timeline_first_federation_formed
				override_tooltip = "TIMELINE_EVENT_FIRST_FEDERATION_FORMED_TOOLTIP"
				override_types = { country }
				override_text = { "text:TIMELINE_FIRST_FEDERATION_FORMED" }
				override_texture = { "background:GFX_evt_federation_fleet" }
				targets = { event_target:this_country }
			}
		}
		else = {
			add_timeline_event = {
				type = timeline_empire
				override_id = timeline_joined_federation
				override_tooltip = "TIMELINE_EVENT_JOIN_FEDERATION_TOOLTIP"
				override_types = { country }
				override_text = { "text:TIMELINE_JOIN_FEDERATION" }
				override_texture = { "background:GFX_evt_federation_fleet" }
				targets = { event_target:this_country }
			}
		}
	}
}

# Deficit
country_event = {
	id = timeline.19
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		if = {
			limit = {
				NOT = { has_country_flag = first_deficit }
			}
			set_country_flag = first_deficit
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_deficit
				override_tooltip = "TIMELINE_EVENT_FIRST_DEFICIT_TOOLTIP"
				override_types = { country }
				override_text = { "text:TIMELINE_FIRST_DEFICIT" }
				override_texture = { "background:GFX_evt_deficit" }
				targets = { event_target:this_country }
			}
		}
		else = {
			add_timeline_event = {
			type = timeline_empire
				override_id = timeline_deficit
				override_tooltip = "TIMELINE_EVENT_DEFICIT_TOOLTIP"
				override_types = { country }
				override_text = { "text:TIMELINE_DEFICIT" }
				override_texture = { "background:GFX_evt_deficit" }
				targets = { event_target:this_country }
			}
		}
	}
}

# First Species Modification
country_event = {
    id = timeline.20
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        is_country_type = default
        NOT = { has_country_flag = first_species_modification }
    }

    immediate = {
        set_country_flag = first_species_modification

        save_event_target_as = this_country

        add_timeline_event = {
            type = timeline_milestone
			override_id = timeline_first_species_modification
			override_tooltip = "TIMELINE_EVENT_FIRST_SPECIES_MODIFICATION_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_FIRST_SPECIES_MODIFICATION" }
			override_texture = { "background:GFX_evt_genetic_modification" }
            targets = { event_target:this_country }
        }
    }
}

# First Relic
country_event = {
    id = timeline.21
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        is_country_type = default
		NOT = { has_country_flag = first_relic }
        num_owned_relics > 0
    }

    immediate = {
        set_country_flag = first_relic

        save_event_target_as = this_country

        add_timeline_event = {
            type = timeline_milestone
			override_id = timeline_first_relic
			override_tooltip = "TIMELINE_EVENT_FIRST_RELIC_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_FIRST_RELIC" }
			override_texture = { "background:GFX_evt_analyzing_artifacts" }
            targets = { event_target:this_country }
        }
	}
}

# Holy World Colonized
carrier_event = {
    id = timeline.22
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		owner = {
			is_country_type = default
		}
		is_holy_world = yes
    }

    immediate = {
		save_event_target_as = this_planet

        owner = {
			save_event_target_as = this_country
			if = {
				limit = {
					NOT = { has_country_flag = first_holy_world_colonized }
				}
				set_country_flag = first_holy_world_colonized
				add_timeline_event = {
					type = timeline_milestone
					override_id = timeline_first_holy_world_colonized
					override_tooltip = "TIMELINE_EVENT_FIRST_HOLY_WORLD_COLONIZED_TOOLTIP"
					override_types = { country planet }
					override_text = { "text:TIMELINE_FIRST_HOLY_WORLD_COLONIZED" }
					override_texture = { "background:GFX_evt_aggressive_flora" }
					targets = { event_target:this_country event_target:this_planet }
				}
			}
			else = {
				add_timeline_event = {
					type = timeline_empire
					override_id = timeline_holy_world_colonized
					override_tooltip = "TIMELINE_EVENT_HOLY_WORLD_COLONIZED_TOOLTIP"
					override_types = { country planet }
					override_text = { "text:TIMELINE_HOLY_WORLD_COLONIZED" }
					override_texture = { "background:GFX_evt_aggressive_flora" }
					targets = { event_target:this_country event_target:this_planet }
				}
			}
		}
    }
}

# Pop Purge
carrier_event = {
    id = timeline.23
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		from = {
			is_country_type = default
			NAND = {
				has_country_flag = first_pop_purged
				has_country_flag = has_purged_species@fromfrom.species
			}
		}
    }

    immediate = {
		fromfrom.species = {
			save_event_target_as = this_species
		}

		from = {
			save_event_target_as = this_country
			if = {
				limit = {
					NOT = { has_country_flag = first_pop_purged }
				}
				set_country_flag = first_pop_purged
				add_timeline_event = {
					type = timeline_milestone
					override_id = timeline_first_pop_purged
					override_tooltip = "TIMELINE_EVENT_FIRST_PURGE_TOOLTIP"
					override_types = { country species }
					override_text = { "text:TIMELINE_FIRST_PURGE" }
					override_texture = { "background:GFX_evt_death_from_above" }
					targets = { event_target:this_country event_target:this_species }
				}
			}
			if = {
				limit = {
					NOT = { has_country_flag = has_purged_species@event_target:this_species }
				}
				set_country_flag = has_purged_species@event_target:this_species
				add_timeline_event = {
					type = timeline_empire
					override_id = timeline_pop_purged
					override_tooltip = "TIMELINE_EVENT_PURGE_TOOLTIP"
					override_types = { country species }
					override_text = { "text:TIMELINE_PURGE" }
					override_texture = { "background:GFX_evt_death_from_above" }
					targets = { event_target:this_country event_target:this_species }
				}
			}
		}
    }
}

# End of the Cycle
country_event = {
    id = timeline.24
    hide_window = yes
    is_triggered_only = yes
	fire_only_once = yes

    trigger = {
		is_country_type = default
		has_country_flag = covenant_end_of_the_cycle
    }

    immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_end_of_the_cycle
			override_tooltip = "TIMELINE_EVENT_END_OF_THE_CYCLE_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_END_OF_THE_CYCLE" }
			override_texture = { "background:GFX_evt_unspeakable_horror" }
			targets = { event_target:this_country }
		}
    }
}

# First Rare Tech
country_event = {
    id = timeline.25
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		is_country_type = default
		has_global_flag = game_started
		days_passed > 1
		NOT = { has_country_flag = first_rare_tech }
		num_rare_techs > 0
    }

    immediate = {
		set_country_flag = first_rare_tech

		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_first_rare_tech
			override_tooltip = "TIMELINE_EVENT_FIRST_RARE_TECH_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_FIRST_RARE_TECH" }
			override_texture = { "background:GFX_evt_rare_tech_cache" }
			targets = { event_target:this_country }
		}
    }
}

# City Planet
carrier_event = {
    id = timeline.26
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		this = {
			is_planet_class = pc_city
		}
		owner = {
			is_country_type = default
		}
    }

    immediate = {
		this = {
			save_event_target_as = this_planet
		}

		owner = {
			save_event_target_as = this_country
			if = {
				limit = {
					NOT = { has_country_flag = first_city_planet }
				}
				set_country_flag = first_city_planet
				add_timeline_event = {
					type = timeline_milestone
					override_id = timeline_first_city_planet
					override_tooltip = "TIMELINE_EVENT_FIRST_CITY_PLANET_TOOLTIP"
					override_types = { country planet }
					override_text = { "text:TIMELINE_FIRST_CITY_PLANET" }
					override_texture = { "background:GFX_evt_city_planet" }
					targets = { event_target:this_country event_target:this_planet }
				}
			}
			else = {
				add_timeline_event = {
					type = timeline_empire
					override_id = timeline_city_planet
					override_tooltip = "TIMELINE_EVENT_CITY_PLANET_TOOLTIP"
					override_types = { country planet }
					override_text = { "text:TIMELINE_CITY_PLANET" }
					override_texture = { "background:GFX_evt_city_planet" }
					targets = { event_target:this_country event_target:this_planet }
				}
			}
		}
    }
}

# Destroyed Planet
carrier_event = {
    id = timeline.27
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		from.owner? = {
			is_country_type = default
		}
    }

    immediate = {
		this = {
			save_event_target_as = this_planet
		}

		from.owner? = {
			save_event_target_as = this_country
			if = {
				limit = {
					NOT = { has_country_flag = first_destroyed_planet }
				}
				set_country_flag = first_destroyed_planet
				add_timeline_event = {
					type = timeline_milestone
					override_id = timeline_first_destroyed_planet
					override_tooltip = "TIMELINE_EVENT_FIRST_DESTROYED_PLANET_TOOLTIP"
					override_types = { country planet }
					override_text = { "text:TIMELINE_FIRST_DESTROYED_PLANET" }
					override_texture = { "background:GFX_evt_planet_beam" }
					targets = { event_target:this_country event_target:this_planet }
				}
			}
			else = {
				add_timeline_event = {
					type = timeline_empire
					override_id = timeline_destroyed_planet
					override_tooltip = "TIMELINE_EVENT_DESTROYED_PLANET_TOOLTIP"
					override_types = { country planet }
					override_text = { "text:TIMELINE_DESTROYED_PLANET" }
					override_texture = { "background:GFX_evt_planet_beam" }
					targets = { event_target:this_country event_target:this_planet }
				}
			}
		}
    }
}

# Won War in Heaven
country_event = {
    id = timeline.28
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		is_country_type = default
		NOT = { has_country_flag = won_war_in_heaven }
		fromfrom = {
			using_war_goal = {
				type = wg_war_in_heaven
				owner = prev
			}
		}
    }

    immediate = {
		set_country_flag = won_war_in_heaven

		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_won_war_in_heaven
			override_tooltip = "TIMELINE_EVENT_WON_WAR_IN_HEAVEN_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_WON_WAR_IN_HEAVEN" }
			override_texture = { "background:GFX_evt_ground_combat" }
			targets = { event_target:this_country }
		}
    }
}

# Breached the Shroud
country_event = {
    id = timeline.29
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		is_country_type = default
		NOT = { has_country_flag = breached_the_shroud }
		has_completed_special_project_in_log = BREACHING_SHROUD_PROJECT
    }

    immediate = {
		set_country_flag = breached_the_shroud

		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_breached_the_shroud
			override_tooltip = "TIMELINE_EVENT_BREACHED_THE_SHROUD_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_BREACHED_THE_SHROUD" }
			override_texture = { "background:GFX_evt_psionics" }
			targets = { event_target:this_country }
		}
    }
}

# Branch Office
carrier_event = {
    id = timeline.30
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		from = {
			is_country_type = default
		}
    }

    immediate = {
		this = {
			save_event_target_as = this_planet
		}

		from = {
			save_event_target_as = this_country
			if = {
				limit = {
					NOT = { has_country_flag = first_branch_office }
				}
				set_country_flag = first_branch_office
				add_timeline_event = {
					type = timeline_milestone
					override_id = timeline_first_branch_office
					override_tooltip = "TIMELINE_EVENT_FIRST_BRANCH_OFFICE_TOOLTIP"
					override_types = { country planet }
					override_text = { "text:TIMELINE_FIRST_BRANCH_OFFICE" }
					override_texture = { "background:GFX_evt_tradestation_interior" }
					targets = { event_target:this_country event_target:this_planet }
				}
			}
			else = {
				add_timeline_event = {
					type = timeline_empire
					override_id = timeline_branch_office
					override_tooltip = "TIMELINE_EVENT_BRANCH_OFFICE_TOOLTIP"
					override_types = { country planet }
					override_text = { "text:TIMELINE_BRANCH_OFFICE" }
					override_texture = { "background:GFX_evt_tradestation_interior" }
					targets = { event_target:this_country event_target:this_planet }
				}
			}
		}
    }
}

# Obtained Galatron
country_event = {
    id = timeline.31
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        is_country_type = default
		NOT = { has_country_flag = obtained_galatron }
        has_relic = r_galatron
    }

    immediate = {
        set_country_flag = obtained_galatron

        save_event_target_as = this_country

        add_timeline_event = {
            type = timeline_milestone
			override_id = timeline_obtained_galatron
			override_tooltip = "TIMELINE_EVENT_OBTAINED_GALATRON_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_OBTAINED_GALATRON" }
			override_texture = { "background:GFX_evt_relic_galatron" }
            targets = { event_target:this_country }
        }
	}
}

# Lost Galatron
country_event = {
    id = timeline.32
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        is_country_type = default
		NOT = { has_country_flag = lost_galatron }
		last_lost_relic = r_galatron
    }

    immediate = {
        set_country_flag = lost_galatron

        save_event_target_as = this_country

        add_timeline_event = {
            type = timeline_milestone
			override_id = timeline_lost_galatron
			override_tooltip = "TIMELINE_EVENT_LOST_GALATRON_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_LOST_GALATRON" }
			override_texture = { "background:GFX_evt_relic_galatron" }
            targets = { event_target:this_country }
        }
	}
}

# Reached End
country_event = {
    id = timeline.33
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        is_country_type = default
		NOT = { has_country_flag = reached_end }
		check_galaxy_setup_value = { setting = victory_year value <= years_passed }
    }

    immediate = {
        set_country_flag = reached_end

        save_event_target_as = this_country

        add_timeline_event = {
            type = timeline_milestone
			override_id = timeline_reached_end
			override_tooltip = "TIMELINE_EVENT_REACHED_END_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_REACHED_END" }
			override_texture = { "background:GFX_evt_victorious_army" }
            targets = { event_target:this_country }
        }
	}
}

# Destroyed Galaxy
country_event = {
    id = timeline.34
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        is_country_type = default
        NOT = { has_country_flag = destroyed_galaxy }
    }

    immediate = {
        set_country_flag = destroyed_galaxy

        save_event_target_as = this_country

        add_timeline_event = {
            type = timeline_milestone
			override_id = timeline_destroyed_galaxy
			override_tooltip = "TIMELINE_EVENT_DESTROYED_GALAXY_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_DESTROYED_GALAXY" }
			override_texture = { "background:GFX_evt_vortex" }
            targets = { event_target:this_country }
        }
	}
}

# Unique System
country_event = {
	id = timeline.35
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		from = {
			has_star_flag = unique_system
		}
		this = {
			is_country_type = default
		}
	}

	immediate = {
		from = {
			save_event_target_as = this_system
		}

		this = {
			save_event_target_as = this_country
			if = {
				limit = {
					NOT = { has_country_flag = first_unique_system }
				}
				set_country_flag = first_unique_system
				add_timeline_event = {
					type = timeline_milestone
					override_id = timeline_first_unique_system
					override_tooltip = "TIMELINE_EVENT_FIRST_UNIQUE_SYSTEM_TOOLTIP"
					override_types = { country galactic_object }
					override_text = { "text:TIMELINE_FIRST_UNIQUE_SYSTEM" }
					override_texture = { "background:GFX_evt_ruined_system" }
					targets = { event_target:this_country event_target:this_system }
				}
			}
			else = {
				add_timeline_event = {
					type = timeline_empire
					override_id = timeline_unique_system
					override_tooltip = "TIMELINE_EVENT_UNIQUE_SYSTEM_TOOLTIP"
					override_types = { country galactic_object }
					override_text = { "text:TIMELINE_UNIQUE_SYSTEM" }
					override_texture = { "background:GFX_evt_ruined_system" }
					targets = { event_target:this_country event_target:this_system }
				}
			}
		}
	}

}

# Leave Federation
country_event = {
	id = timeline.36
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		from = {
			save_event_target_as = this_country

			add_timeline_event = {
				type = timeline_empire
				override_id = timeline_leave_federation
				override_tooltip = "TIMELINE_EVENT_LEAVE_FEDERATION_TOOLTIP"
				override_types = { country }
				override_text = { "text:TIMELINE_LEAVE_FEDERATION" }
				override_texture = { "background:GFX_evt_federation_fleet" }
				targets = { event_target:this_country }
			}
		}
	}
}

# Meet Fallen Empire
country_event = {
	id = timeline.37
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		OR = {
			AND = {
				from = {
					OR = {
						is_country_type = fallen_empire
						is_country_type = awakened_fallen_empire
					}
					NOR = {
						has_country_flag = second_hive_fe_fragment	# Only show the first fragment in the Timeline
						has_country_flag = third_hive_fe_fragment	# Only show the first fragment in the Timeline
					}
				}
				this = {
					is_country_type = default
					NOT = { has_country_flag = met_fallen_empire_@from }
				}
			}
			AND = {
				this = {
					OR = {
						is_country_type = fallen_empire
						is_country_type = awakened_fallen_empire
					}
					NOR = {
						has_country_flag = second_hive_fe_fragment	# Only show the first fragment in the Timeline
						has_country_flag = third_hive_fe_fragment	# Only show the first fragment in the Timeline
					}
				}
				from = {
					is_country_type = default
					NOT = { has_country_flag = met_fallen_empire_@this }
				}
			}
		}
	}

	immediate = {
		if = {
			limit = {
				from = {
					OR = {
						is_country_type = fallen_empire
						is_country_type = awakened_fallen_empire
					}
				}
			}
			from = {
				save_event_target_as = this_fallen_empire
			}
			this = {
				save_event_target_as = this_country
				set_country_flag = met_fallen_empire_@from
				add_timeline_event = {
					type = timeline_empire
					override_id = timeline_meet_fallen_empire_discover
					override_tooltip = "TIMELINE_EVENT_MEET_FALLEN_EMPIRE_TOOLTIP"
					override_types = { country country }
					override_text = { "text:TIMELINE_MEET_FALLEN_EMPIRE" }
					override_texture = { "background:GFX_evt_fallen_empire" }
					targets = { event_target:this_country event_target:this_fallen_empire }
				}
			}
		}
		else = {
			this = {
				save_event_target_as = this_fallen_empire
			}
			from = {
				save_event_target_as = this_country
				set_country_flag = met_fallen_empire_@this
				add_timeline_event = {
					type = timeline_empire
					override_id = timeline_meet_fallen_empire_discovered
					override_tooltip = "TIMELINE_EVENT_MEET_FALLEN_EMPIRE_TOOLTIP"
					override_types = { country country }
					override_text = { "text:TIMELINE_MEET_FALLEN_EMPIRE" }
					override_texture = { "background:GFX_evt_fallen_empire" }
					targets = { event_target:this_country event_target:this_fallen_empire }
				}
			}
		}
	}
}

# Enclave Destroyed
country_event = {
	id = timeline.38
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		OR = {
			AND = {
				has_country_flag = destroyed_curator
				NOT = { has_country_flag = destroyed_curator_timeline_event }
			}
			AND = {
				has_country_flag = destroyed_trader
				NOT = { has_country_flag = destroyed_trader_timeline_event }
			}
			AND = {
				has_country_flag = destroyed_artist
				NOT = { has_country_flag = destroyed_artist_timeline_event }
			}
			AND = {
				has_country_flag = destroyed_salvager
				NOT = { has_country_flag = destroyed_salvager_timeline_event }
			}
			AND = {
				has_country_flag = destroyed_shroudwalkers
				NOT = { has_country_flag = destroyed_shroudwalkers_timeline_event }
			}
			AND = {
				has_country_flag = destroyed_mercs
				NOT = { has_country_flag = destroyed_mercs_timeline_event }
			}
		}
	}

	immediate = {
		from = {
			save_event_target_as = this_enclave
		}

		save_event_target_as = this_country

		if = {
			limit = {
				has_country_flag = destroyed_curator
				NOT = { has_country_flag = destroyed_curator_timeline_event }
			}
			set_country_flag = destroyed_curator_timeline_event
		}
		else_if = {
			limit = {
				has_country_flag = destroyed_trader
				NOT = { has_country_flag = destroyed_trader_timeline_event }
			}
			set_country_flag = destroyed_trader_timeline_event
		}
		else_if = {
			limit = {
				has_country_flag = destroyed_artist
				NOT = { has_country_flag = destroyed_artist_timeline_event }
			}
			set_country_flag = destroyed_artist_timeline_event
		}
		else_if = {
			limit = {
				has_country_flag = destroyed_salvager
				NOT = { has_country_flag = destroyed_salvager_timeline_event }
			}
			set_country_flag = destroyed_salvager_timeline_event
		}
		else_if = {
			limit = {
				has_country_flag = destroyed_shroudwalkers
				NOT = { has_country_flag = destroyed_shroudwalkers_timeline_event }
			}
			set_country_flag = destroyed_shroudwalkers_timeline_event
		}
		else = {
			set_country_flag = destroyed_mercs_timeline_event
		}

		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_enclave_destroyed
			override_tooltip = "TIMELINE_EVENT_ENCLAVE_DESTROYED_TOOLTIP"
			override_types = { country country }
			override_text = { "text:TIMELINE_ENCLAVE_DESTROYED" }
			override_texture = { "background:GFX_evt_enclave_overlord" }
			targets = { event_target:this_country event_target:this_enclave }
		}
	}
}

# Emperor Dies
country_event = {
	id = timeline.39
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		is_galactic_emperor = yes
	}

	immediate = {
		from = {
			save_event_target_as = this_leader
		}

		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_emperor_dies
			override_tooltip = "TIMELINE_EVENT_EMPEROR_DIES_TOOLTIP"
			override_types = { leader }
			override_text = { "text:TIMELINE_EMPEROR_DIES" }
			override_texture = { "background:GFX_evt_space_funeral" }
			targets = { event_target:this_leader }
		}
	}
}

# Elections
country_event = {
	id = timeline.40
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_elections
			override_tooltip = "TIMELINE_EVENT_ELECTIONS_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_ELECTIONS" }
			override_texture = { "background:GFX_evt_arguing_senate" }
			targets = { event_target:this_country }
		}
	}
}

# First Trade Deal
country_event = {
	id = timeline.41
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		NOT = { has_country_flag = first_trade_deal }
	}

	immediate = {
		this = {
			save_event_target_as = this_country_benefactor
		}

		from = {
			save_event_target_as = this_country
			set_country_flag = first_trade_deal
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_trade_deal
				override_tooltip = "TIMELINE_EVENT_FIRST_TRADE_DEAL_TOOLTIP"
				override_types = { country country }
				override_text = { "text:TIMELINE_FIRST_TRADE_DEAL" }
				override_texture = { "background:GFX_evt_tradedeal" }
				targets = { event_target:this_country event_target:this_country_benefactor }
			}
		}
	}
}

# First Terraform
carrier_event = {
	id = timeline.42
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		from = {
			is_country_type = default
			NOT = { has_country_flag = first_terraform }
		}
	}

	immediate = {
		save_event_target_as = this_planet
		from = {
			save_event_target_as = this_country
			set_country_flag = first_terraform
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_terraform
				override_tooltip = "TIMELINE_EVENT_FIRST_TERRAFORM_TOOLTIP"
				override_types = { country planet }
				override_text = { "text:TIMELINE_FIRST_TERRAFORM" }
				override_texture = { "background:GFX_evt_astral_rift_lonely_planet" }
				targets = { event_target:this_country event_target:this_planet }
			}
		}
	}
}

# First Wormhole
ship_event = {
	id = timeline.43
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		fromfrom = {
			is_country_type = default
			has_country_flag = encountered_first_wormhole
			NOT = { has_country_flag = first_wormhole }
		}
	}

	immediate = {
		from = {
			random_system_planet = {
				save_event_target_as = this_planet # system scope still not suported...
			}
		}

		fromfrom = {
			save_event_target_as = this_country
			set_country_flag = first_wormhole
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_wormhole
				override_tooltip = "TIMELINE_EVENT_FIRST_WORMHOLE_TOOLTIP"
				override_types = { country planet }
				override_text = { "text:TIMELINE_FIRST_WORMHOLE" }
				override_texture = { "background:GFX_evt_wormhole" }
				targets = { event_target:this_country event_target:this_planet }
			}
		}
	}
}

# First Gateway
ship_event = {
	id = timeline.44
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		fromfrom = {
			is_country_type = default
			has_country_flag = encountered_first_gateway
			NOT = { has_country_flag = first_gateway }
		}
	}

	immediate = {
		from = {
			random_system_planet = {
				save_event_target_as = this_planet # system scope still not suported...
			}
		}

		fromfrom = {
			save_event_target_as = this_country
			set_country_flag = first_gateway
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_gateway
				override_tooltip = "TIMELINE_EVENT_FIRST_GATEWAY_TOOLTIP"
				override_types = { country planet }
				override_text = { "text:TIMELINE_FIRST_GATEWAY" }
				override_texture = { "background:GFX_evt_drifting_gateway" }
				targets = { event_target:this_country event_target:this_planet }
			}
		}
	}
}

# First 100K Fleet
ship_event = {
	id = timeline.45
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		root.fleet = {
			fleet_power >= 100000
		}
		from.owner? = {
			is_country_type = default
			NOT = { has_country_flag = first_100k_fleet }
		}
	}

	immediate = {
		root.fleet = {
			save_event_target_as = this_fleet
		}

		from.owner? = {
			save_event_target_as = this_country
			set_country_flag = first_100k_fleet
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_100k_fleet
				override_tooltip = "TIMELINE_EVENT_FIRST_100K_FLEET_TOOLTIP"
				override_types = { country fleet }
				override_text = { "text:TIMELINE_FIRST_100K_FLEET" }
				override_texture = { "background:GFX_evt_federation_fleet" }
				targets = { event_target:this_country event_target:this_fleet }
			}
		}
	}
}

# First Robot
carrier_event = {
	id = timeline.46
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		from = {
			is_country_type = default
			NOR = {
				has_country_flag = first_robot
				is_machine_empire = yes
				is_individual_machine = yes
			}
		}
	}

	immediate = {
		this = {
			save_event_target_as = this_planet
		}

		from = {
			save_event_target_as = this_country
			set_country_flag = first_robot
			if = {
				limit = { is_nomadic = no }
				add_timeline_event = {
					type = timeline_milestone
					override_id = timeline_first_robot
					override_tooltip = "TIMELINE_EVENT_FIRST_ROBOT_TOOLTIP"
					override_types = { country planet }
					override_text = { "text:TIMELINE_FIRST_ROBOT" }
					override_texture = { "background:GFX_evt_robot_assembly_plant" }
					targets = { event_target:this_country event_target:this_planet }
				}
			}
			else = {
				add_timeline_event = {
					type = timeline_milestone
					override_id = timeline_first_robot_nomad
					override_tooltip = "TIMELINE_EVENT_FIRST_ROBOT_TOOLTIP"
					override_types = { country ship }
					override_text = { "text:TIMELINE_FIRST_ROBOT" }
					override_texture = { "background:GFX_evt_robot_assembly_plant" }
					targets = { event_target:this_country event_target:this_planet }
				}
			}
		}
	}
}

# Council Expanded to Maximum
country_event = {
	id = timeline.47
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		NOT = { has_country_flag = council_expanded_to_max }
	}

	immediate = {
		save_event_target_as = this_country
		set_country_flag = council_expanded_to_max
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_council_max_expansion
			override_tooltip = "TIMELINE_EVENT_COUNCIL_MAX_EXPAND_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_COUNCIL_MAX_EXPAND" }
			override_texture = { "background:GFX_evt_grand_speech" }
			targets = { event_target:this_country }
		}
	}
}

# First Titan/Juggernaut/BioTitan/BioJuggernaut
ship_event = {
	id = timeline.48
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		OR = {
			AND = {
				root = {
					OR = {
						is_ship_size = titan
						is_ship_size = bio_titan
					}
				}
				from.owner? = {
					is_country_type = default
					NOT = { has_country_flag = first_titan }
				}
			}
			AND = {
				root = {
					is_ship_size = juggernaut
				}
				from.owner? = {
					is_country_type = default
					NOT = { has_country_flag = first_juggernaut }
				}
			}
		}
	}

	immediate = {
		root = {
			save_event_target_as = this_ship
			switch = {
				trigger = is_ship_size
				titan = {
					from.owner? = {
						set_country_flag = first_titan
					}
				}
				juggernaut = {
					from.owner? = {
						set_country_flag = first_juggernaut
					}
				}
			}
		}
		from.owner? = {
			save_event_target_as = this_country
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_big_ship
				override_tooltip = "TIMELINE_EVENT_FIRST_BIG_SHIP_TOOLTIP"
				override_types = { country ship }
				override_text = { "text:TIMELINE_FIRST_BIG_SHIP" }
				override_texture = { "background:GFX_evt_juggernaut" }
				targets = { event_target:this_country event_target:this_ship }
			}
		}
	}
}

# First Storm Appears Within Borders
system_event = {
	id = timeline.49
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		exists = owner
		owner = {
			is_country_type = default
			NOT = { has_country_flag = first_storm_appears_within_borders }
		}
	}

	immediate = {
		from = {
			save_event_target_as = this_storm
		}
		save_event_target_as = this_system
		owner = {
			save_event_target_as = this_country
			set_country_flag = first_storm_appears_within_borders
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_storm_within_borders
				override_tooltip = "TIMELINE_EVENT_FIRST_STORM_WITHIN_BORDERS_TOOLTIP"
				override_types = { country storms galactic_object }
				override_text = { "text:TIMELINE_FIRST_STORM_WITHIN_BORDERS" }
				override_texture = { "background:GFX_evt_storm_formation" }
				targets = { event_target:this_country event_target:this_storm event_target:this_system }
			}
		}
	}
}

# First Legendary Trait
country_event = {
	id = timeline.50
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
		NOT = { has_country_flag = first_leader_destiny_trait }
	}

	immediate = {
		from = {
			save_event_target_as = this_leader
		}
		save_event_target_as = this_country
		set_country_flag = first_leader_destiny_trait
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_first_leader_destiny_trait
			override_tooltip = "TIMELINE_EVENT_FIRST_LEADER_DESTINY_TRAIT_TOOLTIP"
			override_types = { country leader }
			override_text = { "text:TIMELINE_FIRST_LEADER_DESTINY_TRAIT" }
			override_texture = { "background:GFX_evt_legendary_leader" }
			targets = { event_target:this_country event_target:this_leader }
		}
	}
}

# First Repeatable Tech
country_event = {
    id = timeline.51
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		is_country_type = default
		NOT = { has_country_flag = first_repeatable_tech }
		num_repeatable_techs > 0
    }

    immediate = {
		set_country_flag = first_repeatable_tech
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_first_repeatable_tech
			override_tooltip = "TIMELINE_EVENT_FIRST_REPEATABLE_TECH_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_FIRST_REPEATABLE_TECH" }
			override_texture = { "background:GFX_evt_engineering_research" }
			targets = { event_target:this_country }
		}
    }
}

# Change of Capital
carrier_event = {
    id = timeline.52
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		owner = {
			is_country_type = default
		}
		days_passed >= 1 # Prevents log errors upon game start
    }

    immediate = {
		save_event_target_as = this_new_capital
		owner = {
			save_event_target_as = this_country
			add_timeline_event = {
				type = timeline_empire
				override_id = timeline_change_of_capital
				override_tooltip = "TIMELINE_EVENT_CHANGE_OF_CAPITAL_TOOLTIP"
				override_types = { country planet }
				override_text = { "text:TIMELINE_CHANGE_OF_CAPITAL" }
				override_texture = { "background:GFX_evt_news_room" }
				targets = { event_target:this_country event_target:this_new_capital }
			}
		}
    }
}

# Encountered Leviathan
country_event = {
    id = timeline.53
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		is_country_type = default
    }

    immediate = {
		set_country_flag = disabled_enigmatic_fortress
		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_encountered_leviathan
			override_tooltip = "TIMELINE_EVENT_ENCOUNTERED_LEVIATHAN_TOOLTIP"
			override_types = { country country }
			override_text = { "text:TIMELINE_ENCOUNTERED_LEVIATHAN" }
			override_texture = { "background:GFX_evt_stellarites" }
			targets = { event_target:this_country event_target:leviathan_story_country }
		}
    }
}

# Destroyed Leviathan
country_event = {
    id = timeline.54
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		is_country_type = default
    }

    immediate = {
		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_destroyed_leviathan
			override_tooltip = "TIMELINE_EVENT_DESTROYED_LEVIATHAN_TOOLTIP"
			override_types = { country country }
			override_text = { "text:TIMELINE_DESTROYED_LEVIATHAN" }
			override_texture = { "background:GFX_evt_astral_rift_ancient_battlegrounds_leviathan" }
			targets = { event_target:leviathan_destroyer_country event_target:leviathan_destroyed_country }
		}
    }
}

# First Species Uplifted
carrier_event = {
    id = timeline.55
    hide_window = yes
    is_triggered_only = yes

    trigger = {
		owner = {
			is_country_type = default
		}
    }

    immediate = {
		save_event_target_as = this_planet
		from = {
			save_event_target_as = this_species
		}
		owner = {
			save_event_target_as = this_country
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_species_uplifted
				override_tooltip = "TIMELINE_EVENT_FIRST_UPLIFTED_SPECIES_TOOLTIP"
				override_types = { country species planet }
				override_text = { "text:TIMELINE_FIRST_UPLIFTED_SPECIES" }
				override_texture = { "background:GFX_evt_friendly_enlightenment" }
				targets = { event_target:this_country event_target:this_species event_target:this_planet }
			}
		}
    }
}

###################################
########## Origin Events ##########
###################################

### Galactic Doorstep ###

# See event origin.1050

### Lost Colony ###

# Finds Parent
country_event = {
	id = timeline.56
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		OR = {
			from = {
				is_same_species = this
				has_origin = origin_lost_colony
				is_country_type = default
				NOT = { has_country_flag = lost_colony_found_homeworld }
				#has_country_flag = lost_colony_parent_of@root.owner # Extra check in case the above is not enough
			}
			this = {
				is_same_species = from
				has_origin = origin_lost_colony
				is_country_type = default
				NOT = { has_country_flag = lost_colony_found_homeworld }
				#has_country_flag = lost_colony_parent_of@root.owner # Extra check in case the above is not enough
			}
		}
	}

	immediate = {
		if = {
			limit = {
				from = {
					has_origin = origin_lost_colony
				}
			}
			from = {
				set_country_flag = lost_colony_found_homeworld
				save_event_target_as = this_country
				add_timeline_event = {
					type = timeline_origin_specific
					override_id = timeline_lost_colony_found_homeworld_sender
					override_tooltip = "TIMELINE_EVENT_LOST_COLONY_TOOLTIP"
					override_types = { }
					override_text = { "text:TIMELINE_EVENT_LOST_COLONY" }
					override_texture = { "background:GFX_evt_ship_in_orbit_3" }
					targets = { }
				}
			}
		}
		else = {
			this = {
				set_country_flag = lost_colony_found_homeworld
				save_event_target_as = this_country
				add_timeline_event = {
					type = timeline_origin_specific
					override_id = timeline_lost_colony_found_homeworld_receiver
					override_tooltip = "TIMELINE_EVENT_LOST_COLONY_TOOLTIP"
					override_types = { }
					override_text = { "text:TIMELINE_EVENT_LOST_COLONY" }
					override_texture = { "background:GFX_evt_ship_in_orbit_3" }
					targets = { }
				}
			}
		}
	}
}

### Resource Consolidation ###

# Creates Machine World
carrier_event = {
	id = timeline.57
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		this = {
			is_planet_class = pc_machine
		}
		owner = {
			has_origin = origin_machine
			is_country_type = default
			NOT = { has_country_flag = resource_consolidation_created_machine_world }
		}
	}

	immediate = {
		this = {
			save_event_target_as = this_planet
		}

		owner = {
			set_country_flag = resource_consolidation_created_machine_world
			save_event_target_as = this_country
			add_timeline_event = {
				type = timeline_origin_specific
				override_id = timeline_resource_consolidation_created_machine_world
				override_tooltip = "TIMELINE_EVENT_RESOURCE_CONSOLIDATION_TOOLTIP"
				override_types = { }
				override_text = { "text:TIMELINE_EVENT_RESOURCE_CONSOLIDATION" }
				override_texture = { "background:GFX_evt_ai_planet" }
				targets = { }
			}
		}
	}
}

### Remnants ###

# Restore Ecumenopolis
carrier_event = {
	id = timeline.58
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		this = {
			is_planet_class = pc_city
			is_homeworld = yes
		}
		owner = {
			has_origin = origin_remnants
			is_country_type = default
			NOT = { has_country_flag = remnants_restored_ecumenopolis }
		}
	}

	immediate = {
		this = {
			save_event_target_as = this_planet
		}

		owner = {
			set_country_flag = remnants_restored_ecumenopolis
			save_event_target_as = this_country
			add_timeline_event = {
				type = timeline_origin_specific
				override_id = timeline_remnants_restored_ecumenopolis
				override_tooltip = "TIMELINE_EVENT_REMNANTS_TOOLTIP"
				override_types = { }
				override_text = { "text:TIMELINE_EVENT_REMNANTS" }
				override_texture = { "background:GFX_evt_overgrown_city" }
				targets = { }
			}
		}
	}
}

### Shattered Ring ###

# Repaired Ringworld
carrier_event = {
	id = timeline.59
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		root = {
			is_planet_class = pc_shattered_ring_habitable
		}
		solar_system = {
			any_system_planet = { is_planet_class = pc_ringworld_habitable }
			NOT = { any_system_planet = { has_planet_flag = interloper } }
		}
		from = {
			has_origin = origin_shattered_ring
			is_country_type = default
			NOT = { has_country_flag = shattered_ring_repaired_ring }
		}
	}

	immediate = {
		root = {
			save_event_target_as = this_planet
		}

		from = {
			set_country_flag = shattered_ring_repaired_ring
			save_event_target_as = this_country
			add_timeline_event = {
				type = timeline_origin_specific
				override_id = timeline_shattered_ring_repaired_ringworld
				override_tooltip = "TIMELINE_EVENT_SHATTERED_RING_TOOLTIP"
				override_types = { }
				override_text = { "text:TIMELINE_EVENT_SHATTERED_RING" }
				override_texture = { "background:GFX_evt_ringworld" }
				targets = { }
			}
		}
	}
}

### Under One Rule ###

# See event paragon.6035

### Teachers of the Shroud ###

# Built Shroud Tunnel
country_event = {
	id = timeline.60
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		has_origin = origin_shroudwalker_apprentice
		is_country_type = default
		NOT = { has_country_flag = teachers_of_the_shroud_built_shroud_tunnel }
	}

	immediate = {
		set_country_flag = teachers_of_the_shroud_built_shroud_tunnel
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_origin_specific
			override_id = timeline_teachers_of_the_shroud_built_shroud_tunnel
			override_tooltip = "TIMELINE_EVENT_SHROUDWALKER_APPRENTICE_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_SHROUDWALKER_APPRENTICE" }
			override_texture = { "background:GFX_evt_shroudwalker_teachers" }
			targets = { }
		}
	}
}

### Void Dwellers ###

# Built Second Habitat
country_event = {
	id = timeline.61
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		count_system_within_border = {
			count >= 2
			limit = {
				any_system_planet = { is_planet_class = pc_habitat }
			}
		}
		has_origin = origin_void_dwellers
		is_country_type = default
		NOT = { has_country_flag = void_dwellers_built_second_habitat }
	}

	immediate = {
		set_country_flag = void_dwellers_built_second_habitat
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_origin_specific
			override_id = timeline_void_dwellers_built_second_habitat
			override_tooltip = "TIMELINE_EVENT_VOID_DWELLERS_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_VOID_DWELLERS" }
			override_texture = { "background:GFX_evt_shattered_planet" }
			targets = { }
		}
	}
}

### Ocean Paradise ###

# Acquired Hydrocentric Ascension Perk (masters of ocean worlds)
country_event = {
	id = timeline.62
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		has_origin = origin_ocean_paradise
		is_country_type = default
		has_ascension_perk = ap_hydrocentric
		NOT = { has_country_flag = ocean_paradise_hydrocentric }
	}

	immediate = {
		set_country_flag = ocean_paradise_hydrocentric
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_origin_specific
			override_id = timeline_ocean_paradise_hydrocentric_ascension_perk
			override_tooltip = "TIMELINE_EVENT_OCEAN_PARADISE_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_OCEAN_PARADISE" }
			override_texture = { "background:GFX_evt_ocean" }
			targets = { }
		}
	}
}

### Doomsday ###

# See event origin_90

#####################
### Crisis events ###
#####################

# Great Khan
country_event = {
	id = timeline.63
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_crisis
			override_id = timeline_great_khan
			override_tooltip = "TIMELINE_EVENT_CRISIS_GREAT_KHAN_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_CRISIS_GREAT_KHAN" }
			override_texture = { "background:GFX_evt_khan_throne_room" }
			targets = { }
		}
	}
}

# Gray Tempest
country_event = {
	id = timeline.64
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_crisis
			override_id = timeline_gray_tempest
			override_tooltip = "TIMELINE_EVENT_CRISIS_GRAY_TEMPEST_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_CRISIS_GRAY_TEMPEST" }
			override_texture = { "background:GFX_evt_gray_gooed_planet" }
			targets = { }
		}
	}
}

# Formless
country_event = {
	id = timeline.65
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_crisis
			override_id = timeline_formless
			override_tooltip = "TIMELINE_EVENT_CRISIS_FORMLESS_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_CRISIS_FORMLESS" }
			override_texture = { "background:GFX_evt_formless_system" }
			targets = { }
		}
	}
}

# Voidworm Plague
country_event = {
	id = timeline.66
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_crisis
			override_id = timeline_voidworm_plague
			override_tooltip = "TIMELINE_EVENT_CRISIS_VOIDWORM_PLAGUE_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_CRISIS_VOIDWORM_PLAGUE" }
			override_texture = { "background:GFX_evt_frenzied_voidworms" }
			targets = { }
		}
	}
}

# Unbidden
country_event = {
	id = timeline.67
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_crisis
			override_id = timeline_unbidden
			override_tooltip = "TIMELINE_EVENT_CRISIS_UNBIDDEN_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_CRISIS_UNBIDDEN" }
			override_texture = { "background:GFX_evt_dimensional_horror" }
			targets = { }
		}
	}
}

# Kaleidoscope
country_event = {
	id = timeline.68
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_crisis
			override_id = timeline_kaleidoscope
			override_tooltip = "TIMELINE_EVENT_CRISIS_KALEIDOSCOPE_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_CRISIS_KALEIDOSCOPE" }
			override_texture = { "background:GFX_evt_kaleidoscopic_lights" }
			targets = { }
		}
	}
}

# Become the crisis
country_event = {
	id = timeline.69
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_crisis
			override_id = timeline_become_the_crisis
			override_tooltip = "TIMELINE_EVENT_BECOME_THE_CRISIS_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_EVENT_BECOME_THE_CRISIS" }
			override_texture = { "background:GFX_evt_crisis_declared" }
			targets = { event_target:this_country }
		}
	}
}

# Prethoryn Scourge
country_event = {
	id = timeline.70
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_crisis
			override_id = timeline_prethoryn_sourge
			override_tooltip = "TIMELINE_EVENT_CRISIS_PRETHORYN_SCOURGE_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_CRISIS_PRETHORYN_SCOURGE" }
			override_texture = { "background:GFX_evt_infested" }
			targets = { }
		}
	}
}

# Contingency
country_event = {
	id = timeline.71
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_crisis
			override_id = timeline_contingency
			override_tooltip = "TIMELINE_EVENT_CRISIS_CONTINGENCY_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_CRISIS_CONTINGENCY" }
			override_texture = { "background:GFX_evt_contingency_planet" }
			targets = { }
		}
	}
}

# Cetana
country_event = {
	id = timeline.72
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		add_timeline_event = {
			type = timeline_crisis
			override_id = timeline_cetana
			override_tooltip = "TIMELINE_EVENT_CRISIS_CETANA_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_CRISIS_CETANA" }
			override_texture = { "background:GFX_evt_synth_queen_enlightenment" }
			targets = { }
		}
	}
}

##############
## Galactic ##
##############

# Galactic Market
country_event = {
	id = timeline.73
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_galactic
			override_id = timeline_galactic_market
			override_tooltip = "TIMELINE_EVENT_GALACTIC_MARKET_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_GALACTIC_MARKET" }
			override_texture = { "background:GFX_evt_financial_instruments" }
			targets = { }
		}
	}
}

# Galactic Community
country_event = {
	id = timeline.74
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_galactic
			override_id = timeline_galactic_community
			override_tooltip = "TIMELINE_EVENT_GALACTIC_COMMUNITY_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_GALACTIC_COMMUNITY" }
			override_texture = { "background:GFX_evt_galactic_community" }
			targets = { }
		}
	}
}

# Galactic Community Resolution
country_event = {
	id = timeline.75
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country

		every_playable_country = {
			add_timeline_event = {
			type = timeline_galactic
			override_id = timeline_galactic_community_resolution
			override_tooltip = "TIMELINE_EVENT_GALACTIC_COMMUNITY_RESOLUTION_TOOLTIP"
			override_types = { }
			override_text = { "text:TIMELINE_EVENT_GALACTIC_COMMUNITY_RESOLUTION" }
			override_texture = { "background:GFX_evt_galactic_senate" }
			targets = { }
			}
		}
	}
}

# War in Heaven
country_event = {
	id = timeline.76
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_galactic
			override_id = timeline_war_in_heaven
			override_tooltip = "TIMELINE_EVENT_WAR_IN_HEAVEN_TOOLTIP"
			override_types = { country country }
			override_text = { "text:TIMELINE_EVENT_WAR_IN_HEAVEN" }
			override_texture = { "background:GFX_evt_crisis_declared" }
			targets = { event_target:FirstSleeper event_target:SecondSleeper }
		}
	}
}

# Nexus Storm
country_event = {
	id = timeline.77
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_galactic
			override_id = timeline_nexus_storm
			override_tooltip = "TIMELINE_EVENT_NEXUS_STORM_TOOLTIP"
			override_types = { galactic_object }
			override_text = { "text:TIMELINE_EVENT_NEXUS_STORM" }
			override_texture = { "background:GFX_evt_cosmic_storms_nexus_storm" }
			targets = { event_target:new_storm_location }
		}
	}
}

# Ascension Milestones
# Cyberization - Regular Empire
# With Machine Age DLC: fires from cyber.2
# Without Machine Age: fires from tr_cybernetics_finish
country_event = {
	id = timeline.78
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_cyberization_regular
			override_tooltip = "TIMELINE_EVENT_CYBERIZATION_REGULAR_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_EVENT_CYBERIZATION_REGULAR" }
			override_texture = { "background:GFX_evt_cybernetics" }
			targets = { event_target:this_country }
		}
	}
}

# With Machine Age DLC: fires from synth.2 or machine_age.1090 or machine_age.1100
# Without Machine Age: fires from tr_synthetics_finish
# Synthesization
country_event = {
	id = timeline.79
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_synthesization_regular
			override_tooltip = "TIMELINE_EVENT_SYNTHESIZATION_REGULAR_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_EVENT_SYNTHESIZATION_REGULAR" }
			override_texture = { "background:GFX_evt_robot_assembly_plant" }
			targets = { event_target:this_country }
		}
	}
}

# Biomorphosis
#Fires from utopia.2703, tr_cloning_finish, tr_purity_finish, or tr_mutation_adopt
country_event = {
	id = timeline.80
	hide_window = yes
	is_triggered_only = yes
	fire_only_once = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_biomorphosis_regular
			override_tooltip = "TIMELINE_EVENT_BIOMORPHOSIS_REGULAR_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_EVENT_BIOMORPHOSIS_REGULAR" }
			override_texture = { "background:GFX_evt_genetic_modification" }
			targets = { event_target:this_country }
		}
	}
}

# Psionic
# Fired by utopia.2650
country_event = {
	id = timeline.81
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_psionic_regular
			override_tooltip = "TIMELINE_EVENT_PSIONIC_REGULAR_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_EVENT_PSIONIC_REGULAR" }
			override_texture = { "background:GFX_evt_shroudwalker_teachers" }
			targets = {event_target:this_country }
		}
	}
}

# Modularity
# Fires from tr_modularity_finish
country_event = {
	id = timeline.82
	hide_window = yes
	is_triggered_only = yes
	fire_only_once = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_modularity
			override_tooltip = "TIMELINE_EVENT_MODULARITY_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_EVENT_MODULARITY" }
			override_texture = { "background:GFX_evt_robot_assembly_plant" }
			targets = { event_target:this_country }
		}
	}
}

# Nanotech
# Fires from tr_nanotech_finish
country_event = {
	id = timeline.83
	hide_window = yes
	is_triggered_only = yes
	fire_only_once = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_nanotech
			override_tooltip = "TIMELINE_EVENT_NANOTECH_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_EVENT_NANOTECH" }
			override_texture = { "background:GFX_evt_gray_gooed_planet" }
			targets = { event_target:this_country }
		}
	}
}

# Virtuality
# Fires from tr_virtuality_finish
country_event = {
	id = timeline.84
	hide_window = yes
	is_triggered_only = yes
	fire_only_once = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_virtuality
			override_tooltip = "TIMELINE_EVENT_VIRTUALITY_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_EVENT_VIRTUALITY" }
			override_texture = { "background:GFX_origin_synthetic_fertility" }
			targets = { event_target:this_country }
		}
	}
}

# Cyberization - Driven Assimilators
# Fires from tr_cybernetics_assimilator_finish
country_event = {
	id = timeline.85
	hide_window = yes
	is_triggered_only = yes
	fire_only_once = yes

	trigger = {
		is_country_type = default
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_cyberization_assimilator
			override_tooltip = "TIMELINE_EVENT_CYBERIZATION_ASSIMILATOR_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_EVENT_CYBERIZATION_ASSIMILATOR" }
			override_texture = { "background:GFX_evt_cybernetics" }
			targets = { event_target:this_country }
		}
	}
}

### NOMADS TIMELINE EVENTS

# First Waystation Built
system_event = {
	id = timeline.95
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		from = {
			is_nomadic = yes
			NOT = { has_country_flag = first_waystation_built }
		}
	}

	immediate = {
		save_event_target_as = this_system

		from = {
			save_event_target_as = this_country
			set_country_flag = first_waystation_built
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_waystation_built
				override_tooltip = "TIMELINE_EVENT_FIRST_WAYSTATION_BUILT_TOOLTIP"
				override_types = { country galactic_object }
				override_text = { "text:TIMELINE_FIRST_WAYSTATION_BUILT" }
				override_texture = { "background:GFX_evt_waystation" }
				targets = { event_target:this_country event_target:this_system }
			}
		}
	}
}

# Arkship Built
# Fired by: inline_scripts/megastructures/arkship.txt on_build_complete
# this = country
country_event = {
	id = timeline.100
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_nomadic = yes
	}

	immediate = {
		save_event_target_as = this_country
		if = {
			limit = { NOT = { has_country_flag = first_arkship_built } }
			set_country_flag = first_arkship_built
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_arkship_built
				override_tooltip = "TIMELINE_EVENT_FIRST_ARKSHIP_BUILT_TOOLTIP"
				override_types = { country }
				override_text = { "text:TIMELINE_FIRST_ARKSHIP_BUILT" }
				override_texture = { "background:GFX_evt_arkship_in_orbit" }
				targets = { event_target:this_country }
			}
		}
		else = {
			add_timeline_event = {
				type = timeline_empire
				override_id = timeline_arkship_built
				override_tooltip = "TIMELINE_EVENT_ARKSHIP_BUILT_TOOLTIP"
				override_types = { country }
				override_text = { "text:TIMELINE_ARKSHIP_BUILT" }
				override_texture = { "background:GFX_evt_arkship_in_orbit" }
				targets = { event_target:this_country }
			}
		}
	}
}

# First Arkship Upgraded to Tier 2
# Fired by: on_ship_upgraded (root = ship)
ship_event = {
	id = timeline.105
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_arkship_tier_2 = yes
		owner = {
			is_nomadic = yes
			NOT = { has_country_flag = first_arkship_tier_2_upgrade }
		}
	}

	immediate = {
		owner = {
			save_event_target_as = this_country
			set_country_flag = first_arkship_tier_2_upgrade
			add_timeline_event = {
				type = timeline_milestone
				override_id = timeline_first_arkship_tier_2
				override_tooltip = "TIMELINE_EVENT_FIRST_ARKSHIP_TIER_2_TOOLTIP"
				override_types = { country }
				override_text = { "text:TIMELINE_FIRST_ARKSHIP_TIER_2" }
				override_texture = { "background:GFX_evt_arkship_in_orbit" }
				targets = { event_target:this_country }
			}
		}
	}
}

# Arkship Upgraded to Tier 3
# Fired by: on_ship_upgraded (root = ship)
ship_event = {
	id = timeline.110
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_arkship_tier_3 = yes
		owner = { is_nomadic = yes }
	}

	immediate = {
		owner = {
			save_event_target_as = this_country
			if = {
				limit = { NOT = { has_country_flag = first_arkship_tier_3_upgrade } }
				set_country_flag = first_arkship_tier_3_upgrade
				add_timeline_event = {
					type = timeline_milestone
					override_id = timeline_first_arkship_tier_3
					override_tooltip = "TIMELINE_EVENT_FIRST_ARKSHIP_TIER_3_TOOLTIP"
					override_types = { country }
					override_text = { "text:TIMELINE_FIRST_ARKSHIP_TIER_3" }
					override_texture = { "background:GFX_evt_arkship_bridge" }
					targets = { event_target:this_country }
				}
			}
			else = {
				add_timeline_event = {
					type = timeline_empire
					override_id = timeline_arkship_tier_3
					override_tooltip = "TIMELINE_EVENT_ARKSHIP_TIER_3_TOOLTIP"
					override_types = { country }
					override_text = { "text:TIMELINE_ARKSHIP_TIER_3" }
					override_texture = { "background:GFX_evt_arkship_bridge" }
					targets = { event_target:this_country }
				}
			}
		}
	}
}

### ORIGIN-SPECIFIC NOMAD TIMELINE EVENTS

# Forever Cruise: Planetfall
# Fired by: nomads.4705 after block
# this = country
country_event = {
	id = timeline.115
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_origin_specific
			override_id = timeline_forever_cruise_planetfall
			override_tooltip = "TIMELINE_EVENT_FOREVER_CRUISE_PLANETFALL_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_FOREVER_CRUISE_PLANETFALL" }
			override_texture = { "background:GFX_evt_big_landing_ship" }
			targets = { event_target:this_country }
		}
	}
}

# Forever Cruise: Mutiny
# Fired by: nomads.1030 after block
# this = country
country_event = {
	id = timeline.120
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_origin_specific
			override_id = timeline_forever_cruise_mutiny
			override_tooltip = "TIMELINE_EVENT_FOREVER_CRUISE_MUTINY_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_FOREVER_CRUISE_MUTINY" }
			override_texture = { "background:GFX_evt_arkship_crisis" }
			targets = { event_target:this_country }
		}
	}
}

# Sacred Path: Pilgrimage Complete
# Fired by: nomads.2100 after block
# this = country
country_event = {
	id = timeline.125
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_origin_specific
			override_id = timeline_sacred_path_complete
			override_tooltip = "TIMELINE_EVENT_SACRED_PATH_COMPLETE_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_SACRED_PATH_COMPLETE" }
			override_texture = { "background:GFX_evt_sacred_path" }
			targets = { event_target:this_country }
		}
	}
}

# Heirs of the Khan: Khan Ascendant
# Fired by: nomads.610.a, nomads.620.a, nomads.700.a
# this = country
country_event = {
	id = timeline.130
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_origin_specific
			override_id = timeline_heirs_khan_ascendant
			override_tooltip = "TIMELINE_EVENT_HEIRS_KHAN_ASCENDANT_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_HEIRS_KHAN_ASCENDANT" }
			override_texture = { "background:GFX_evt_heirs_of_the_khan" }
			targets = { event_target:this_country }
		}
	}
}

# Sacred Path: Joyous Enlightenment
# Fired by: nomads.2130 option a
# this = country
country_event = {
	id = timeline.135
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_origin_specific
			override_id = timeline_sacred_path_enlightenment
			override_tooltip = "TIMELINE_EVENT_SACRED_PATH_ENLIGHTENMENT_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_SACRED_PATH_ENLIGHTENMENT" }
			override_texture = { "background:GFX_evt_sacred_path" }
			targets = { event_target:this_country }
		}
	}
}

# Sacred Path: Middle Path
# Fired by: nomads.2135 option a
# this = country
country_event = {
	id = timeline.140
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_origin_specific
			override_id = timeline_sacred_path_middle
			override_tooltip = "TIMELINE_EVENT_SACRED_PATH_MIDDLE_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_SACRED_PATH_MIDDLE" }
			override_texture = { "background:GFX_evt_sacred_path" }
			targets = { event_target:this_country }
		}
	}
}

# Sacred Path: Embracing Chaos
# Fired by: nomads.2140 option a
# this = country
country_event = {
	id = timeline.145
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_origin_specific
			override_id = timeline_sacred_path_chaos
			override_tooltip = "TIMELINE_EVENT_SACRED_PATH_CHAOS_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_SACRED_PATH_CHAOS" }
			override_texture = { "background:GFX_evt_sacred_path" }
			targets = { event_target:this_country }
		}
	}
}

### BIOGENESIS TIMELINE EVENTS

# Absorb a Species Trait

country_event = {
	id = timeline.90
	hide_window = yes
	is_triggered_only = yes
	fire_only_once = no

	trigger = {
		has_origin = origin_evolutionary_predators
		NOT = {
			owner = {
				has_country_flag = evopred_first_absorb_flag
			}
		}
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_empire
			override_id = timeline_evopred_absorb
			override_tooltip = "TIMELINE_EVENT_EVOPRED_ABSORB_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_EVENT_EVOPRED_ABSORB" }
			override_texture = { "background:GFX_origin_evolutionary_predators" }
			targets = {event_target:this_country }
		}
	}

	after = {
		owner = {
			set_country_flag = evopred_first_absorb_flag
		}
	}
}

# Hatch a Behemoth Egg

country_event = {
	id = timeline.91
	hide_window = yes
	is_triggered_only = yes
	fire_only_once = no

	trigger = {
		NOT = {
			has_country_flag = timeline_behemoth_flag
		}
	}

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_hatch_behemoth
			override_tooltip = "TIMELINE_EVENT_HATCH_BEHEMOTH_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_EVENT_HATCH_BEHEMOTH" }
			override_texture = { "background:GFX_evt_behemoth_fight" }
			targets = {event_target:this_country }
		}
	}

	after = {
		set_country_flag = timeline_behemoth_flag
	}
}

# Defend the Wormhole

country_event = {
	id = timeline.92
	hide_window = yes
	is_triggered_only = yes
	fire_only_once = yes

	immediate = {
		save_event_target_as = this_country
		add_timeline_event = {
			type = timeline_milestone
			override_id = timeline_wormhole_defended
			override_tooltip = "TIMELINE_EVENT_WORMHOLE_DEFENDED_TOOLTIP"
			override_types = { country }
			override_text = { "text:TIMELINE_EVENT_WORMHOLE_DEFENDED" }
			override_texture = { "background:GFX_evt_behemoth_fight" }
			targets = {event_target:this_country }
		}
	}
}
