############################
#
# Tutorial Events
#
# Written by Henrik Eklund & Niclas Karlsson
#
############################

namespace = tutorial

### TUTORIAL 1: SURVEY HOME SYSTEM

# Start
country_event = {
	id = tutorial.1
	title = tutorial.1.name
	desc = tutorial.1.desc
	show_sound = tut_survey_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_event_chain = tutorial_1_chain
			has_country_flag = waiting_tutorial_4
			has_country_flag = tutorial_1
		}
	}

	immediate = {
		capital_scope = {
			solar_system = { save_event_target_as = home_system }
		}
		set_country_flag = tutorial_1
		begin_event_chain = {
			event_chain = "tutorial_1_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_1_tooltip
		hidden_effect = {
			country_event = { id = tutorial.71 days = 10 }
		}
	}
}

# Cleared when tutorial is off
ship_event = {
	id = tutorial.299
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		owner = {
			is_ai = no
			NOT = {
				has_country_flag = waiting_tutorial_4
				has_country_flag = tutorial_1
				has_country_flag = tutorial_2
			}
			FROM = {
				solar_system = {
					any_planet = {
						is_capital = yes
						is_owned_by = PREVPREVPREV
					}
				}
			}
		}
	}
	
	immediate = {
		owner = {
			country_event = { id = tutorial.17 days = 20 }
			set_country_flag = waiting_tutorial_4 #Moved here due to construction ship tutorial removed}
		}
	}
}

# Finished
ship_event = {
	id = tutorial.2
	title = tutorial.2.name
	desc = tutorial.2.desc
	show_sound = tut_survey_success
	
	is_advisor_event = yes
	is_triggered_only = yes

	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_country_flag = tutorial_1
		}
	}
	
	immediate = {
		owner = {
			remove_country_flag = tutorial_1
			end_event_chain = "tutorial_1_chain"
			set_country_flag = waiting_tutorial_4 #Moved here due to construction ship tutorial removed
		}
	}
		
	option = {
		name = "OK"
		hidden_effect = {
			owner = {
				country_event = { id = tutorial.17 days = 20 }
			}
		}
	}
}

### TUTORIAL 2: RESEARCH TECHNOLOGIES

# Triggering Event (HIDDEN)
country_event = {
	id = tutorial.501
	hide_window = yes
	
	is_triggered_only = yes

	trigger = {
		is_ai = no
		any_owned_ship = {
			has_fleet_order = survey_planet_order
		}
		is_tutorial_level = 2
		has_country_flag = tutorial_1
		NOT = { has_country_flag = tutorial_2 }
	}
			
	immediate = {
		set_country_flag = tutorial_2
		country_event = { id = tutorial.3 days = 25 }
		country_event = { id = tutorial.300 days = 25 }
		country_event = { id = tutorial.13 days = 120 }
	}
}

# Triggering Event from on-action (HIDDEN)
ship_event = {
	id = tutorial.500
	hide_window = yes
	
	is_triggered_only = yes

	trigger = {
		has_fleet_order = survey_planet_order
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_country_flag = tutorial_1
			NOT = { has_country_flag = tutorial_2 }
		}
	}
			
	immediate = {
		owner = {
			set_country_flag = tutorial_2
			country_event = { id = tutorial.3 days = 25 }
			country_event = { id = tutorial.300 days = 25 }
			country_event = { id = tutorial.13 days = 120 }
		}
	}
}

# Start
country_event = {
	id = tutorial.3
	title = tutorial.3.name
	desc = tutorial.3.desc
	show_sound = tut_technologies_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_event_chain = tutorial_2_chain
			has_technology = tech_colonization_1
		}
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_2_chain"
			target = ROOT
		}
		country_event = { id = tutorial.7 days = 21 }
		country_event = { id = tutorial.700 days = 21 } #Backup to set flags if finished early
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_2_tooltip
		hidden_effect = {
			if = {
				limit = {
					has_technology = tech_colonization_1
				}
				country_event = { id = tutorial.6 }
			}
		}
	}
}

# Clear Early
country_event = {
	id = tutorial.300
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		has_technology = tech_colonization_1
		is_tutorial_level = 2
		NOT = {
			has_country_flag = tutorial_2
		}
	}

	immediate = {
		#country_event = { id = tutorial.7 days = 21 } #Moved to earlier due to research taking so long
		#country_event = { id = tutorial.700 days = 21 } #Backup to set flags if finished early
	}
}

# Researched Colonization
#country_event = {
#	id = tutorial.4
#	hide_window = yes
#
#	is_triggered_only = yes
#	
#	trigger = {
#		is_ai = no
#		is_tutorial_level = 2
#		has_technology = tech_colonization_1
#		has_event_chain = "tutorial_2_chain"
#		NOT = { has_country_flag = tech_1_researched }
#	}
#	
#	immediate = {
#		set_country_flag = tech_1_researched
#		add_event_chain_counter = {
#			event_chain = "tutorial_2_chain" 
#			counter = "tech_1_researched" 
#			amount = 1
#		}
#		country_event = { id = tutorial.6 }
#	}
#}
#
# Researched Space Construction #Removed due to changed earlygame
#country_event = {
#	id = tutorial.5
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	trigger = {
#		is_ai = no
#		last_increased_tech = "tech_space_construction"
#		has_event_chain = "tutorial_2_chain"
#		NOT = { has_country_flag = tech_2_researched }
#		has_technology = tech_space_construction
#	}
#
#	immediate = {
#		set_country_flag = tech_2_researched
#		add_event_chain_counter = { 
#			event_chain = "tutorial_2_chain" 
#			counter = "tech_2_researched" 
#			amount = 1 
#		}
#		if = {
#			limit = {
#				AND = {
#					has_technology = tech_colonization_1
#					has_technology = tech_space_construction
#				}
#			}
#			country_event = { id = tutorial.6 }
#		}
#	}
#}

# Finished
country_event = {
	id = tutorial.6
	title = tutorial.6.name
	desc = tutorial.6.desc
	show_sound = tut_technologies_success
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_technology = tech_colonization_1
		has_event_chain = "tutorial_2_chain"
	}

	
	immediate = {
		end_event_chain = "tutorial_2_chain"
		remove_country_flag = tech_1_researched
		remove_country_flag = tech_2_researched
		remove_country_flag = tutorial_2
	}
	
	option = {
		name = "OK"
		hidden_effect = {
			#country_event = { id = tutorial.7 days = 10 } #Moved to earlier due to research taking so long
			#country_event = { id = tutorial.700 days = 10 } #Backup to set flags if finished early
		}
	}
}

### TUTORIAL: BUILD CONSTRUCTION SHIP

# Start
country_event = {
	id = tutorial.7
	title = tutorial.7.name
	desc = tutorial.7.desc
	show_sound = tut_construction_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		count_owned_ships = {
			limit = { is_ship_class = shipclass_constructor }
			count < 1
		}
		NOT = {
			has_event_chain = tutorial_3_chain
		}
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_3_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_3_tooltip
	}
}

# Cleared early
country_event = {
	id = tutorial.700
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		count_owned_ships = {
			limit = { is_ship_class = shipclass_constructor }
			count > 0
		}
	}
		
	immediate = {
		set_country_flag = waiting_tutorial_4
	}
}

# Finished
ship_event = {
	id = tutorial.8
	title = tutorial.8.name
	desc = tutorial.8.desc
	show_sound = tut_construction_success
	
	is_triggered_only = yes
	is_advisor_event = yes
	
	trigger = {
		is_ship_size = constructor
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_event_chain = "tutorial_3_chain"
		}
	}
		
	immediate = {
		owner = { end_event_chain = "tutorial_3_chain" }
	}
	
	option = {
		name = "OK"
		hidden_effect = {
			owner = { set_country_flag = waiting_tutorial_4 }
		}
	}
}

### TUTORIAL: BUILD MINING STATION

# Start
country_event = {
	id = tutorial.9
	title = tutorial.9.name
	desc = tutorial.9.desc
	show_sound = tut_construction_intro
	
	is_advisor_event = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_country_flag = waiting_tutorial_4
		NOT = {
			any_owned_ship = { is_ship_size = mining_station }
			has_event_chain = tutorial_4_chain
		}
		capital_scope = {
			solar_system = {
				closest_system = {
					max_steps = 10
					limit = {
						any_planet = {
							is_capital = no
							is_surveyed = { who = ROOT status = yes }
							orbital_deposit_tile = {
								OR = {
									has_resource = {
										type = minerals
										amount > 0
									}
									has_resource = {
										type = energy
										amount > 0
									}
								}
							}
						}
					}
				}
			}
		}
	}
	
	mean_time_to_happen = {
		days = 10
	}
	
	immediate = {
		remove_country_flag = waiting_tutorial_4
		set_country_flag = waiting_tutorial_5
		begin_event_chain = {
			event_chain = "tutorial_4_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_4_tooltip
	}
}

# Cleared early
ship_event = {
	id = tutorial.1000
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			NOT = {
				has_event_chain = "tutorial_4_chain"
				#has_country_flag = "waiting_tutorial_4"
				#has_country_flag = "waiting_tutorial_5"
			}
		}
	}
		
	immediate = {
		owner = {
			remove_country_flag = waiting_tutorial_4
			set_country_flag = waiting_tutorial_5
		}
	}
}

# Finished
ship_event = {
	id = tutorial.10
	title = tutorial.10.name
	desc = tutorial.10.desc
	show_sound = tut_mining_station_success
	
	is_triggered_only = yes
	is_advisor_event = yes
	
	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_event_chain = "tutorial_4_chain"
			#any_owned_ship = { is_ship_size = mining_station }
		}
	}
		
	immediate = {
		owner = {
			end_event_chain = "tutorial_4_chain"
		}
	}
	
	option = {
		name = "OK"
	}
}


### TUTORIAL: BUILD RESEARCH STATION

# Start
country_event = {
	id = tutorial.11
	title = tutorial.11.name
	desc = tutorial.11.desc
	show_sound = tut_research_station_intro
	
	is_advisor_event = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_country_flag = waiting_tutorial_5
		NOT = {
			any_owned_ship = {is_ship_size = research_station }
			has_event_chain = tutorial_5_chain
		}
		capital_scope = {
			solar_system = {
				closest_system = {
					max_steps = 10
					limit = {
						any_planet = {
							is_capital = no
							is_surveyed = { who = ROOT status = yes }
							orbital_deposit_tile = {
								OR = {
									has_resource = {
										type = society_research
										amount > 0
									}
									has_resource = {
										type = physics_research
										amount > 0
									}
									has_resource = {
										type = engineering_research
										amount > 0
									}
								}
							}
						}
					}
				}
			}
		}
	}
	
	mean_time_to_happen = {
		days = 10
	}
	
	immediate = {
		remove_country_flag = waiting_tutorial_5
		begin_event_chain = {
			event_chain = "tutorial_5_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_5_tooltip
	}
}

# Cleared early
ship_event = {
	id = tutorial.1200
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			NOT = {
				has_event_chain = "tutorial_5_chain"
				has_country_flag = "waiting_tutorial_5"
			}
		}
	}
		
	immediate = {
		owner = {
			remove_country_flag = waiting_tutorial_5
			country_event = { id = tutorial.39 days = 25 }
		}
	}
}

# Finished
ship_event = {
	id = tutorial.12
	title = tutorial.12.name
	desc = tutorial.12.desc
	show_sound = tut_research_station_success
	
	is_triggered_only = yes
	is_advisor_event = yes
	
	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_event_chain = "tutorial_5_chain"
			#any_owned_ship = { is_ship_size = research_station } #removed cause otherwise you need to build 2 before this is triggered
		}
	}

	immediate = {
		owner = { end_event_chain = "tutorial_5_chain" }
	}
	
	option = {
		name = "OK"
		hidden_effect = {
			owner = { country_event = { id = tutorial.39 days = 25 } }
		}
	}
}

### TUTORIAL: CONSTRUCT PLANETARY BUILDING

# Start
country_event = {
	id = tutorial.13
	title = tutorial.13.name
	desc = tutorial.13.desc
	show_sound = tut_planetary_buildings_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_event_chain = tutorial_6_chain
			any_owned_planet = {
				has_building_construction = yes
			}
			has_country_flag = tutorial_cleared_early_14
		}
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_6_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_6_tooltip
	}
}

# Cleared Early
planet_event = {
	id = tutorial.140
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			NOT = { has_country_flag = tutorial_cleared_early_14 }
		}
	}
	
	immediate = {
		owner = {
			set_country_flag = tutorial_cleared_early_14
			country_event = { id = tutorial.15 days = 10 }
		}
	}
}

# Finished
planet_event = {
	id = tutorial.14
	title = tutorial.14.name
	desc = tutorial.14.desc
	show_sound = tut_planetary_buildings_success
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_event_chain = "tutorial_6_chain"
		}
	}
	
	immediate = {
		owner = { end_event_chain = "tutorial_6_chain" }
	}
	
	option = {
		name = "OK"
		hidden_effect = {
			owner = {
				country_event = { id = tutorial.15 days = 10 }
			}
		}
	}
}

### TUTORIAL: CLEAR TILE BLOCKER

# Start
country_event = {
	id = tutorial.15
	title = tutorial.15.name
	desc = tutorial.15.desc
	show_sound = tut_tile_blockers_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_country_flag = tutorial_cleared_early_16
			has_event_chain = tutorial_7_chain
		}
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_7_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_7_tooltip
	}
}

# Finished
planet_event = {
	id = tutorial.160
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			NOT = { has_country_flag = tutorial_cleared_early_16 }
		}
	}
	
	immediate = {
		owner = { set_country_flag = tutorial_cleared_early_16 }
	}
}

# Finished
planet_event = {
	id = tutorial.16
	title = tutorial.16.name
	desc = tutorial.16.desc
	show_sound = tut_tile_blockers_success
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_event_chain = "tutorial_7_chain"
		}
	}
	
	immediate = {
		owner = { end_event_chain = "tutorial_7_chain" }
	}
	
	option = {
		name = "OK"
	}
}

### TUTORIAL: SURVEY NEIGHBORING SYSTEMS

# Start
country_event = {
	id = tutorial.17
	title = tutorial.17.name
	desc = tutorial.17.desc
	show_sound = tut_suvey_systems_intro
	# TEMP fix typos in asset
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_event_chain = tutorial_8_chain
			has_country_flag = tutorial_cleared_early_17
		}
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_8_chain"
			target = ROOT
		}
		capital_scope = {
			solar_system = {
				set_star_flag = home_system
				closest_system = {
					limit = {
						NOT = { has_star_flag = home_system }
					}
					set_star_flag = survey_target_1
					save_event_target_as = survey_target_1
				}
				closest_system = {
					limit = {
						NOT = { 
							has_star_flag = home_system
							has_star_flag = survey_target_1
						}
					}
					set_star_flag = survey_target_2
					save_event_target_as = survey_target_2
				}
				closest_system = {
					limit = {
						NOT = { 
							has_star_flag = home_system
							has_star_flag = survey_target_1
							has_star_flag = survey_target_2
						}
					}
					set_star_flag = survey_target_3
					save_event_target_as = survey_target_3
				}
			}
		}
		create_point_of_interest = {
			id = tutorial_8_poi.1
			name = "tutorial_8_poi"
			desc = tutorial_8_poi_desc
			event_chain = tutorial_8_chain
			category = tutorial_8_cat
			location = event_target:survey_target_1
		}
		create_point_of_interest = {
			id = tutorial_8_poi.2
			name = "tutorial_8_poi"
			desc = tutorial_8_poi_desc
			event_chain = "tutorial_8_chain"
			category = tutorial_8_cat
			location = event_target:survey_target_2
		}
		create_point_of_interest = {
			id = tutorial_8_poi.3
			name = "tutorial_8_poi"
			desc = tutorial_8_poi_desc
			event_chain = "tutorial_8_chain"
			category = tutorial_8_cat
			location = event_target:survey_target_3
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_8_tooltip
		hidden_effect = {
			set_country_flag = waiting_tutorial_11
			country_event = { id = tutorial.20 days = 10 }
			country_event = { id = tutorial.200 days = 10 } #Backup for flags if you finish the quest early
			country_event = { id = tutorial.33 days = 120 }
			country_event = { id = tutorial.330 days = 120 }
		}
	}
}

# Cleared Early
ship_event = {
	id = tutorial.170
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			NOT = {
				has_country_flag = tutorial_cleared_early_17
				has_event_chain = tutorial_8_chain
			}
			FROM = {
				solar_system = {
					NOT = {
						any_planet = {
							is_capital = yes
							is_owned_by = PREVPREVPREV
						}
					}
				}
			}
		}
	}
	
	immediate = {
		owner = {
			save_event_target_as = ShipOwner
			capital_scope = {
				solar_system = {
					random_planet = {
						limit = {
							is_homeworld = yes
						}
						save_event_target_as = HomeSystem
					}
				}
			}
		}
		if = {
			limit = {
				any_system = {
					NOT = { is_same_value = event_target:HomeSystem }
					is_surveyed = {
						who = event_target:ShipOwner
						status = yes
					}
				}
			}
			owner = {
				set_country_flag = tutorial_cleared_early_17
				country_event = { id = tutorial.20 days = 10 }
				country_event = { id = tutorial.200 days = 10 } #Backup for flags 
				country_event = { id = tutorial.33 days = 120 }
				country_event = { id = tutorial.330 days = 120 }
				#country_event = { id = tutorial.24 days = 20 }
				country_event = { id = tutorial.240 days = 20 } #Backup to set flags if finished early
				country_event = { id = tutorial.75 days = 40 }
			}
		}
	}
}

# System Surveyed
country_event = {
	id = tutorial.18
	hide_window = yes
	
	is_triggered_only = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_8_chain"
		FROM = {
			OR = {
				has_star_flag = survey_target_1
				has_star_flag = survey_target_2
				has_star_flag = survey_target_3
			}
		}
	}
	
	immediate = {
		if = {
			limit = {
				FROM = { has_star_flag = survey_target_1 }
			}
			FROM = { remove_star_flag = survey_target_1 }
			remove_point_of_interest = tutorial_8_poi.1
		}
		if = {
			limit = {
				FROM = { has_star_flag = survey_target_2 }
			}
			FROM = { remove_star_flag = survey_target_2 }
			remove_point_of_interest = tutorial_8_poi.2
		}
		if = {
			limit = {
				FROM = { has_star_flag = survey_target_3 }
			}
			FROM = { remove_star_flag = survey_target_3 }
			remove_point_of_interest = tutorial_8_poi.3
		}
		add_event_chain_counter = { 
			event_chain = "tutorial_8_chain" 
			counter = "systems_surveyed" 
			amount = 1 
		}
		country_event = { id = tutorial.19 }
	}
}

# Finished
country_event = {
	id = tutorial.19
	title = tutorial.19.name
	desc = tutorial.19.desc
	show_sound = tut_survey_system_success
	
	is_triggered_only = yes
	is_advisor_event = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_8_chain"
		has_completed_event_chain_counter = {
			event_chain = "tutorial_8_chain" 
			counter = "systems_surveyed" 
		}
	}
	
	immediate = {
		capital_scope = {
			solar_system = {
				remove_star_flag = home_system
			}
		}
		end_event_chain = "tutorial_8_chain"
	}
	
	option = {
		name = "OK"
		hidden_effect = {
			#country_event = { id = tutorial.24 days = 20 }
			country_event = { id = tutorial.240 days = 20 } #Backup to set flags if finished early
			country_event = { id = tutorial.75 days = 40 }
		}
	}
}

### TUTORIAL: BUILD SECOND SCIENCE SHIP

# Start
country_event = {
	id = tutorial.20
	title = tutorial.20.name
	desc = tutorial.20.desc
	show_sound = tut_science_ship_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_event_chain = tutorial_9_chain
			count_owned_ships = {
				limit = { is_ship_class = shipclass_science_ship }
				count > 1
			}
		}
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_9_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_9_tooltip
	}
}

# Finished before triggered
country_event = {
	id = tutorial.200
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		count_owned_ships = {
			limit = { is_ship_class = shipclass_science_ship }
			count > 1
		}
	}
	
	immediate = {
		country_event = { id = tutorial.22 }
	}
}

# Finished
ship_event = {
	id = tutorial.21
	title = tutorial.21.name
	desc = tutorial.21.desc
	show_sound = tut_science_ship_success
	
	is_triggered_only = yes
	is_advisor_event = yes
	
	trigger = {
		is_ship_class = shipclass_science_ship
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_event_chain = "tutorial_9_chain"
			count_owned_ships = {
				limit = { is_ship_class = shipclass_science_ship }
				count > 1
			}
		}
	}
		
	immediate = {
		owner = { end_event_chain = "tutorial_9_chain" }
	}
	
	option = {
		name = "OK"
		hidden_effect = {
			owner = { country_event = { id = tutorial.22 } }
		}
	}
}

### TUTORIAL: RECRUIT SCIENTIST

# Start
country_event = {
	id = tutorial.22
	title = tutorial.22.name
	desc = tutorial.22.desc
	show_sound = tut_recruit_scientist_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		any_owned_ship = {
			is_ship_class = shipclass_science_ship
			NOT = { exists = leader }
		}
		NOT = {
			has_event_chain = tutorial_10_chain
		}
	}
	
	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_10_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_10_tooltip
		hidden_effect = {
			country_event = { id = tutorial.48 days = 200 }
		}
	}
}

# Finished
country_event = {
	id = tutorial.23
	title = tutorial.23.name
	desc = tutorial.23.desc
	show_sound = tut_recruit_scientist_success
	
	is_advisor_event = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_10_chain"
		count_owned_ships = {
			limit = {
				is_ship_class = shipclass_science_ship 
				exists = leader
			}
			count > 1
		}
	}
	
	mean_time_to_happen = {
		days = 1
	}
		
	immediate = {
		end_event_chain = "tutorial_10_chain"
	}
	
	option = {
		name = "OK"
	}
}

### TUTORIAL: BUILD COLONY SHIP

# Start
country_event = {
	id = tutorial.24
	title = tutorial.24.name
	desc = tutorial.24.desc
	show_sound = tut_build_colony_ship_intro
	
	is_advisor_event = yes
	#is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_technology = tech_colonization_1
		count_owned_ships = {
			limit = { is_ship_class = shipclass_colonizer }
			count < 1
		}
		NOT = {
			has_event_chain = tutorial_11_chain
			any_owned_planet = {
				is_capital = no
			}
		}
		any_planet_within_border = {
			is_ideal_planet_class = {
				who = root
				status = yes
			}
			is_colony = no
		}
	}

	mean_time_to_happen = {
		months = 1
	}

	immediate = {
		remove_country_flag = waiting_tutorial_11
		begin_event_chain = {
			event_chain = "tutorial_11_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_11_tooltip
	}
}

# Cleared early
country_event = {
	id = tutorial.240
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		OR = {
			count_owned_ships = {
				limit = { is_ship_class = shipclass_colonizer }
				count > 0
			}
			any_owned_planet = {
				is_capital = no
			}
		}
	}
		
	immediate = {
		country_event = { id = tutorial.26 days = 10 }
		country_event = { id = tutorial.260 days = 10 } #Backup to set flags if cleared early
	}
}

# Finished
ship_event = {
	id = tutorial.25
	title = tutorial.25.name
	desc = tutorial.25.desc
	show_sound = tut_colony_ship_success
	
	is_triggered_only = yes
	is_advisor_event = yes
	
	trigger = {
		is_ship_class = shipclass_colonizer
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_event_chain = "tutorial_11_chain"
		}
	}
		
	immediate = {
		owner = { end_event_chain = "tutorial_11_chain" }
	}
	
	option = {
		name = "OK"
		hidden_effect = {
			owner = {
				country_event = { id = tutorial.26 days = 10 }
				country_event = { id = tutorial.260 days = 10 } #Backup to set flags if cleared early}
			}
		}
	}
}

### TUTORIAL: ESTABLISH COLONY

# Start
country_event = {
	id = tutorial.26
	title = tutorial.26.name
	desc = tutorial.26.desc
	show_sound = tut_establish_colony_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_technology = tech_colonization_1
		NOT = {
			has_event_chain = tutorial_12_chain
			any_owned_planet = {
				is_capital = no
			}
			count_owned_ships = {
				limit = { is_ship_class = shipclass_colonizer }
				count < 1
			}
		}
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_12_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_12_tooltip
	}
}

# cleared early
country_event = {
	id = tutorial.260
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		any_owned_planet = {
			is_capital = no
		}
	}
		
	immediate = {
		country_event = { id = tutorial.28 days = 10 }
	}
}

# Finished
planet_event = {
	id = tutorial.27
	title = tutorial.27.name
	desc = tutorial.27.desc
	show_sound = tut_establish_colony_success
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		exists = owner
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_event_chain = "tutorial_12_chain"
		}
	}
		
	immediate = {
		owner = {
			end_event_chain = "tutorial_12_chain"
		}
	}
	
	option = {
		name = "OK"
		hidden_effect = {
			owner = {
				country_event = { id = tutorial.28 days = 10 }
			}
		}
	}
}

### TUTORIAL: RECRUIT GOVERNOR

# Start
country_event = {
	id = tutorial.28
	title = tutorial.28.name
	desc = tutorial.28.desc
	show_sound = tut_recruit_governor_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		any_owned_planet = {
			is_capital = no
			NOT = { exists = leader }
		}
		NOT = { has_event_chain = tutorial_13_chain }
	}
	
	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_13_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_13_tooltip
	}
}

# Finished
country_event = {
	id = tutorial.29
	title = tutorial.29.name
	desc = tutorial.29.desc
	show_sound = tut_recruit_governor_success
	
	is_advisor_event = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_13_chain"
		any_owned_planet = {
			is_capital = no
			exists = leader
		}
	}
	
	mean_time_to_happen = {
		days = 1
	}
		
	immediate = {
		end_event_chain = "tutorial_13_chain"
	}
	
	option = {
		name = "OK"
		hidden_effect = {
			#country_event = { id = tutorial.30 days = 30 }
		}
	}
}

#### TUTORIAL: ESTABLISH FOUR COLONIES
#
## Start
#country_event = {
#	id = tutorial.30
#	title = tutorial.30.name
#	desc = tutorial.30.desc
#	show_sound = tut_more_colonies_intro
#	
#	is_advisor_event = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		begin_event_chain = {
#			event_chain = "tutorial_14_chain"
#			target = ROOT
#		}
#		add_event_chain_counter = { 
#			event_chain = "tutorial_14_chain" 
#			counter = "colonies_established" 
#			amount = 1 
#		}
#	}
#	
#	option = {
#		name = SITLOG
#		custom_tooltip = tutorial_14_tooltip
#	}
#}
#
## Planet Colonized (HIDDEN)
#planet_event = {
#	id = tutorial.31
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	trigger = {
#		owner = {
#			has_event_chain = "tutorial_14_chain"
#		}
#	}
#	
#	immediate = {
#		owner = {
#			add_event_chain_counter = { 
#				event_chain = "tutorial_14_chain" 
#				counter = "colonies_established" 
#				amount = 1 
#			}
#			country_event = { id = tutorial.32 }
#		}
#	}
#}
#
## Finished
#country_event = {
#	id = tutorial.32
#	title = tutorial.32.name
#	desc = tutorial.32.desc
#	show_sound = tut_more_colonies_success
#	
#	is_triggered_only = yes
#	is_advisor_event = yes
#	
#	trigger = {
#		has_event_chain = "tutorial_14_chain"
#		has_completed_event_chain_counter = {
#			event_chain = "tutorial_14_chain" 
#			counter = "colonies_established" 
#		}
#	}
#		
#	immediate = {
#		end_event_chain = "tutorial_14_chain"
#	}
#	
#	option = {
#		name = "OK"
#		hidden_effect = {
#			country_event = { id = tutorial.44 days = 5 }
#		}
#	}
#}

### TUTORIAL: RESOURCE PRODUCTION

# Start
country_event = {
	id = tutorial.33
	title = tutorial.33.name
	desc = tutorial.33.desc
	show_sound = tut_resources_production_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_event_chain = tutorial_15_chain
			has_monthly_income = { resource = energy value > 9 }
			has_monthly_income = { resource = minerals value > 29 }
		}
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_15_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_15_tooltip
	}
}

# Cleared Early
country_event = {
	id = tutorial.330
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_monthly_income = { resource = energy value > 9 }
		has_monthly_income = { resource = minerals value > 29 }
	}

	#immediate = {
	#	country_event = { id = tutorial.39 days = 25 }
	#}
}

# Mineral Production Achieved (HIDDEN)
country_event = {
	id = tutorial.34
	hide_window = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_15_chain"
		NOT = { has_country_flag = tutorial_15_minerals_achieved }
		OR = {
			has_monthly_income = { resource = minerals value = 30 }
			has_monthly_income = { resource = minerals value > 30 }
		}
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		set_country_flag = tutorial_15_minerals_achieved
		add_event_chain_counter = { 
			event_chain = "tutorial_15_chain" 
			counter = "mineral_income" 
			amount = 1 
		}
		country_event = { id = tutorial.38 }
	}
}

# Mineral Production Lost (HIDDEN)
country_event = {
	id = tutorial.35
	hide_window = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_15_chain"
		has_country_flag = tutorial_15_minerals_achieved
		has_monthly_income = { resource = minerals value < 30 }
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		remove_country_flag = tutorial_15_minerals_achieved
		add_event_chain_counter = { 
			event_chain = "tutorial_15_chain" 
			counter = "mineral_income" 
			amount = -1 
		}
	}
}

# Credit Production Achieved (HIDDEN)
country_event = {
	id = tutorial.36
	hide_window = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_15_chain"
		NOT = { has_country_flag = tutorial_15_credits_achieved }
		OR = {
			has_monthly_income = { resource = energy value = 10 }
			has_monthly_income = { resource = energy value > 10 }
		}
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		set_country_flag = tutorial_15_credits_achieved
		add_event_chain_counter = { 
			event_chain = "tutorial_15_chain" 
			counter = "credit_income" 
			amount = 1 
		}
		country_event = { id = tutorial.38 }
	}
}

# Credit Production Lost (HIDDEN)
country_event = {
	id = tutorial.37
	hide_window = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_15_chain"
		has_country_flag = tutorial_15_credits_achieved
		has_monthly_income = { resource = energy value < 10 }
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		remove_country_flag = tutorial_15_credits_achieved
		add_event_chain_counter = { 
			event_chain = "tutorial_15_chain" 
			counter = "credit_income"
			amount = -1
		}
	}
}

# Finished
country_event = {
	id = tutorial.38
	title = tutorial.38.name
	desc = tutorial.38.desc
	show_sound = tut_resources_production_success
	
	is_triggered_only = yes
	is_advisor_event = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_15_chain"
		has_completed_event_chain_counter = {
			event_chain = "tutorial_15_chain" 
			counter = "mineral_income" 
		}
		has_completed_event_chain_counter = {
			event_chain = "tutorial_15_chain" 
			counter = "credit_income" 
		}
	}
		
	immediate = {
		end_event_chain = "tutorial_15_chain"
	}
	
	option = {
		name = "OK"
		#hidden_effect = {
		#	country_event = { id = tutorial.39 days = 25 }
		#}
	}
}

### TUTORIAL: INCREASING THE FLEET

# Start
country_event = {
	id = tutorial.39
	title = tutorial.39.name
	desc = tutorial.39.desc
	show_sound = tut_increase_fleet_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		count_owned_ships = {
			limit = { is_ship_size = corvette }
			count < 4
		}
		count_owned_ships = {
			limit = { is_ship_size = destroyer }
			count < 1
		}
		NOT = { has_event_chain = tutorial_16_chain }
	}
	
	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_16_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_16_tooltip
	}
}

# Corvette Built (HIDDEN)
ship_event = {
	id = tutorial.40
	hide_window = yes
	
	is_triggered_only = yes
	
	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_event_chain = "tutorial_16_chain" 
			NOT = { has_country_flag = tutorial_16_corvettes_built }
		}
		is_ship_size = corvette
	}
	
	immediate = {
		owner = {
			add_event_chain_counter = { 
				event_chain = "tutorial_16_chain" 
				counter = "corvettes_built" 
				amount = 1 
			}
			country_event = { id = tutorial.41 }
		}
	}
}

# All Corvettes Built (HIDDEN)
country_event = {
	id = tutorial.41
	hide_window = yes
	
	is_triggered_only = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_16_chain"
		NOT = { has_country_flag = tutorial_16_corvettes_built }
		has_completed_event_chain_counter = {
			event_chain = "tutorial_16_chain" 
			counter = "corvettes_built" 
		}
	}
	
	immediate = {
		set_country_flag = tutorial_16_corvettes_built
	}
}

# Admiral Assigned (HIDDEN)
country_event = {
	id = tutorial.42
	hide_window = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_16_chain"
		NOT = { has_country_flag = tutorial_16_admiral_assigned }
		any_owned_ship = {
			fleet = {
				exists = leader
				leader = {
					leader_class = admiral
				}
			}
		}
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		set_country_flag = tutorial_16_admiral_assigned
		add_event_chain_counter = { 
			event_chain = "tutorial_16_chain" 
			counter = "admiral_assigned" 
			amount = 1 
		}
	}
}

# Finished
country_event = {
	id = tutorial.43
	title = tutorial.43.name
	desc = tutorial.43.desc
	show_sound = tut_increase_fleet_success
	
	is_advisor_event = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_16_chain"
		has_completed_event_chain_counter = {
			event_chain = "tutorial_16_chain" 
			counter = "corvettes_built" 
		}
		has_completed_event_chain_counter = {
			event_chain = "tutorial_16_chain" 
			counter = "admiral_assigned" 
		}
	}
	
	mean_time_to_happen = {
		days = 1
	}
		
	immediate = {
		end_event_chain = "tutorial_16_chain"
		remove_country_flag = tutorial_16_admiral_assigned
		remove_country_flag = tutorial_16_corvettes_built
	}
	
	option = {
		name = "OK"
	}
}

### TUTORIAL: ESTABLISH SECTOR

# Planet Colonized Counter (HIDDEN)
planet_event = {
	id = tutorial.444
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		exists = owner
		owner = {
			is_ai = no
			is_tutorial_level = 2
			check_variable = { 
				which = "num_colonies" 
				value < 3
			}
 		}
	}

	immediate = {
		owner = {
			if = {
				limit = {
					check_variable = { 
						which = "num_colonies" 
						value > 0
			 		}
			 	}
				change_variable = {
					which = "num_colonies"
					value = 1
				}
			 	else = {
				 	set_variable = {
				 		which = "num_colonies"
				 		value = 1
				 	}
				}
			}
			if = {
				limit = {
					check_variable = { 
						which = "num_colonies" 
						value > 2
			 		}
			 	}
			 	country_event = { id = tutorial.44 days = 5 }
			}
		}
	}
}

# Start
country_event = {
	id = tutorial.44
	title = tutorial.44.name
	desc = tutorial.44.desc
	show_sound = tut_establish_sector_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		sectors < 1
		check_variable = { 
			which = "num_colonies" 
			value > 2
 		}
 		NOT = { has_event_chain = tutorial_17_chain }
	}
	
	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_17_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_17_tooltip
	}
}

# Finished
country_event = {
	id = tutorial.45
	title = tutorial.45.name
	desc = tutorial.45.desc
	show_sound = tut_establish_sector_success

	is_advisor_event = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_17_chain"
		sectors > 0
	}
	
	mean_time_to_happen = {
		days = 1
	}
		
	immediate = {
		end_event_chain = "tutorial_17_chain"
	}
	
	option = {
		name = "OK"
		hidden_effect = {
			country_event = { id = tutorial.46 days = 5 }
		}
	}
}

### TUTORIAL: SECTOR GOVERNOR

# Start
country_event = {
	id = tutorial.46
	title = tutorial.46.name
	desc = tutorial.46.desc
	show_sound = tut_sector_governor_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		any_sector = {
			NOT = { exists = leader }
		}
		NOT = {
			has_event_chain = tutorial_18_chain
		}
	}
	
	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_18_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_18_tooltip
	}
}

# Finished
country_event = {
	id = tutorial.47
	title = tutorial.47.name
	desc = tutorial.47.desc
	show_sound = tut_sector_governor_success
	
	is_advisor_event = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_18_chain"
		any_sector = { exists = leader }
	}
	
	mean_time_to_happen = {
		days = 1
	}
		
	immediate = {
		end_event_chain = "tutorial_18_chain"
	}
	
	option = {
		name = "OK"
	}
}

### TUTORIAL: SHIP DESIGN

# Start
country_event = {
	id = tutorial.48
	title = tutorial.48.name
	desc = tutorial.48.desc
	show_sound = tut_ship_design_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_event_chain = tutorial_19_chain
			has_country_flag = tutorial_cleared_early_48
		}
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_19_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_19_tooltip
	}
}

# Cleared Early
country_event = {
	id = tutorial.480
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_event_chain = "tutorial_19_chain"
			has_country_flag = tutorial_cleared_early_48
		}
	}
		
	immediate = {
		set_country_flag = tutorial_cleared_early_48
	}
}

# Finished
country_event = {
	id = tutorial.49
	title = tutorial.49.name
	desc = tutorial.49.desc
	show_sound = tut_ship_design_success
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_19_chain"
	}
		
	immediate = {
		end_event_chain = "tutorial_19_chain"
	}
	
	option = {
		name = "OK"
	}
}

### TUTORIAL: OBSERVATION POSTS
# Will not trigger unless player has Observation Station tech
# Add researched_tech on-action event to check for discovered
# primitives and re-trigger this?

# Start
ship_event = {
	id = tutorial.50
	title = tutorial.50.name
	desc = tutorial.50.desc
	show_sound = tut_observation_posts_intro
	
	is_advisor_event = yes
	is_triggered_only = yes

	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			NOT = {
				has_event_chain = tutorial_20_chain
				has_country_flag = finished_tutorial_20
			}
			has_technology = tech_space_construction
		}
		FROM = {
			has_owner = yes
			owner = { is_country_type = primitive }
		}
	}
	
	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_20_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_20_tooltip
	}
}

# Finished
country_event = {
	id = tutorial.51
	title = tutorial.51.name
	desc = tutorial.51.desc
	show_sound = tut_observation_posts_success
	
	is_advisor_event = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = "tutorial_20_chain"
		any_owned_ship = { is_ship_size = observation_station }
	}
	
	mean_time_to_happen = {
		days = 1
	}
		
	immediate = {
		end_event_chain = "tutorial_20_chain"
		set_country_flag = finished_tutorial_20
	}
	
	option = {
		name = "OK"
	}
}

### TUTORIAL: RESEARCH ANOMALY

ship_event = {
	id = tutorial.52
	title = tutorial.52.name
	desc = {
		trigger = {
			hidden:owner = {
				switch = {
					trigger = has_ethic
					ethic_spiritualist = { text = tutorial.52.spirit.desc }
					ethic_fanatic_spiritualist = { text = tutorial.52.spirit.desc }
					default = { text = tutorial.52.desc }
				}
			}
		}
	}
	picture = GFX_evt_star_chart
	show_sound = event_default
	location = from
	is_triggered_only = yes

	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
		}
	}

	option = {
		name = tutorial.52.a
		trigger = {
			owner = {
				NOT = {
					has_ethic = ethic_spiritualist
					has_ethic = ethic_fanatic_spiritualist
				}
			}
		}
	}
	option = {
		name = tutorial.52.spirit.a
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_spiritualist
					has_ethic = ethic_fanatic_spiritualist
				}
			}
		}
	}
}

ship_event = {
#Story5
	id = tutorial.53
	title = tutorial.52.name
	desc = {
		trigger = {
			hidden:owner = {
				switch = {
					trigger = has_ethic
					ethic_xenophobe = { text = tutorial.53.xenophobe.desc }
					ethic_fanatic_xenophobe = { text = tutorial.53.xenophobe.desc }
					ethic_xenophile = { text = tutorial.53.xenophile.desc }
					ethic_fanatic_xenophile = { text = tutorial.53.xenophile.desc }
					default = { text = tutorial.53.desc }
				}
			}
		}
	}
	picture = GFX_evt_star_chart
	show_sound = event_default
	location = from
	is_triggered_only = yes

	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
		}
	}

	immediate = { hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } } }

	option = {
		name = tutorial.53.a
		trigger = {
			owner = {
				NOT = {
					has_ethic = ethic_xenophobe
					has_ethic = ethic_fanatic_xenophobe
					has_ethic = ethic_xenophile
					has_ethic = ethic_fanatic_xenophile
				}
			}
		}
	}
	option = {
		name = tutorial.53.xenophobe.a
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_xenophobe
					has_ethic = ethic_fanatic_xenophobe
				}
			}
		}
	}
	option = {
		name = tutorial.53.xenophile.a
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_xenophile
					has_ethic = ethic_fanatic_xenophile
				}
			}
		}
	}
}

ship_event = {
	id = tutorial.54
	title = tutorial.52.name
	desc = tutorial.54.desc
	picture = GFX_evt_star_chart
	show_sound = event_default
	location = from
	is_triggered_only = yes

	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
		}
	}

	option = {
		name = tutorial.54.a
		trigger = {
			owner = {
				NOT = {
					has_ethic = ethic_spiritualist
					has_ethic = ethic_fanatic_spiritualist
					has_ethic = ethic_materialist
					has_ethic = ethic_fanatic_materialist
				}
			}
		}
	}
	option = {
		name = tutorial.54.spiritualist.a
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_spiritualist
					has_ethic = ethic_fanatic_spiritualist
				}
			}
		}
	}
	option = {
		name = tutorial.54.materialist.a
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_materialist
					has_ethic = ethic_fanatic_materialist
				}
			}
		}
	}
}

### TUTORIAL: STRATEGIC RESOURCES
# Start
ship_event = {
	id = tutorial.55
	title = tutorial.55.name
	desc = tutorial.55.desc
	show_sound = tut_strategic_resources_intro

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			NOT = {
				has_event_chain = tutorial_21_chain
				has_country_flag = finished_tutorial_21
			}
		}
		from = {
			NOT = { has_orbital_station = yes }
		}
		OR = {
			# Strategic resource on this planet
			AND = {
				owner = { has_technology = tech_mine_neutronium }
				from = { has_deposit = d_neutronium_deposit }
			}
			AND = {
				owner = { has_technology = tech_mine_teldar }
				from = { has_deposit = d_teldar_deposit }
			}
			AND = {
				owner = { has_technology = tech_mine_dark_matter }
				from = { has_deposit = d_dark_matter_deposit }
			}
			AND = {
				owner = { has_technology = tech_engos_vapor }
				from = { has_deposit = d_engos_deposit }
			}
			AND = {
				owner = { has_technology = tech_pitharan_dust }
				from = { has_deposit = d_pitharan_deposit }
			}
			AND = {
				owner = { has_technology = tech_mine_living_metal }
				from = { has_deposit = d_living_metal_deposit }
			}
			AND = {
				owner = { has_technology = tech_lythuric_gas }
				from = { has_deposit = d_lythuric_gas_deposit }
			}
			AND = {
				owner = { has_technology = tech_mine_zro }
				from = { has_deposit = d_zro_deposit }
			}
			AND = {
				owner = { has_technology = tech_mine_garanthium }
				from = { has_deposit = d_garanthium_deposit }
			}
			AND = {
				owner = { has_technology = tech_alien_life_studies }
				from = { has_deposit = d_alien_pets_deposit }
			}
			AND = {
				owner = { has_technology = tech_mine_betharian }
				from = { has_deposit = d_betharian_deposit }
			}
			AND = {
				owner = { has_technology = tech_mine_satramene }
				from = { has_deposit = d_satramene_deposit }
			}
		}
	}

	immediate = {
		owner = {
			begin_event_chain = {
				event_chain = "tutorial_21_chain"
				target = ROOT
			}
		}
		create_point_of_interest = {
			id = tutorial.55.poi
			name = "tutorial.55.poi.name"
			desc = "tutorial.55.poi.desc"
			event_chain = tutorial_21_chain
			location = from
		}
	}

	option = {
		name = SITLOG
		custom_tooltip = tutorial_21_tooltip
	}
}

# Start with meantime
country_event = {
	id = tutorial.555
	title = tutorial.55.name
	desc = tutorial.55.desc
	show_sound = tut_strategic_resources_intro

	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_event_chain = tutorial_21_chain
			has_country_flag = finished_tutorial_21
		}
		capital_scope = {
			solar_system = {
				closest_system = {
					max_steps = 15
					limit = {
						any_planet = {
							is_capital = no
							is_surveyed = { who = ROOT status = yes }
							NOT = { has_orbital_station = yes }
							OR ={
								AND = {
									has_deposit = d_neutronium_deposit
									root = { has_technology = tech_mine_neutronium }
								}
								AND = {
									has_deposit = d_teldar_deposit
									root = { has_technology = tech_mine_teldar }
								}
								AND = {
									has_deposit = d_dark_matter_deposit
									root = { has_technology = tech_mine_dark_matter }
								}
								AND = {
									has_deposit = d_engos_deposit
									root = { has_technology = tech_engos_vapor }
								}
								AND = {
									has_deposit = d_pitharan_deposit
									root = { has_technology = tech_pitharan_dust }
								}
								AND = {
									has_deposit = d_living_metal_deposit
									root = { has_technology = tech_mine_living_metal }
								}
								AND = {
									has_deposit = d_lythuric_gas_deposit
									root = { has_technology = tech_lythuric_gas }
								}
								AND = {
									has_deposit = d_garanthium_deposit
									root = { has_technology = tech_mine_garanthium }
								}
								AND = {
									has_deposit = d_alien_pets_deposit
									root = { has_technology = tech_alien_life_studies }
								}
								AND = {
									has_deposit = d_betharian_deposit
									root = { has_technology = tech_mine_betharian }
								}
								AND = {
									has_deposit = d_satramene_deposit
									root = { has_technology = tech_mine_satramene }
								}
							}
						}
					}
				}
			}
		}
	}

	mean_time_to_happen = {
		days = 30
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_21_chain"
			target = ROOT
		}
	}

	option = {
		name = SITLOG
		custom_tooltip = tutorial_21_tooltip
	}
}

# Finished
ship_event = {
	id = tutorial.56
	title = tutorial.56.name
	desc = tutorial.56.desc
	show_sound = tut_strategic_resources_success
	
	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_event_chain = "tutorial_21_chain"
			NOT = { has_country_flag = finished_tutorial_21 }
		}
		from = {
			OR = {
				has_deposit = d_neutronium_deposit
				has_deposit = d_teldar_deposit
				has_deposit = d_dark_matter_deposit
				has_deposit = d_engos_deposit
				has_deposit = d_pitharan_deposit
				has_deposit = d_living_metal_deposit
				has_deposit = d_lythuric_gas_deposit
				has_deposit = d_zro_deposit
				has_deposit = d_garanthium_deposit
				has_deposit = d_alien_pets_deposit
				has_deposit = d_betharian_deposit
				has_deposit = d_satramene_deposit
			}
		}
	}

	immediate = {
		owner = {
			end_event_chain = "tutorial_21_chain"
			set_country_flag = finished_tutorial_21
		}
	}

	option = {
		name = OK
	}
}

# Finished by having a mining station on a resource before researching the required tech
country_event = {
	id = tutorial.560
	title = tutorial.55.name
	desc = tutorial.560.desc
	show_sound = tut_strategic_resources_early
	
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = { has_country_flag = finished_tutorial_21 }
		capital_scope = {
			solar_system = {
				closest_system = {
					max_steps = 15
					limit = {
						any_planet = {
							is_capital = no
							is_surveyed = { who = ROOT status = yes }
							has_orbital_station = yes
							OR ={
								AND = {
									has_deposit = d_neutronium_deposit
									root = { has_technology = tech_mine_neutronium }
								}
								AND = {
									has_deposit = d_teldar_deposit
									root = { has_technology = tech_mine_teldar }
								}
								AND = {
									has_deposit = d_dark_matter_deposit
									root = { has_technology = tech_mine_dark_matter }
								}
								AND = {
									has_deposit = d_engos_deposit
									root = { has_technology = tech_engos_vapor }
								}
								AND = {
									has_deposit = d_pitharan_deposit
									root = { has_technology = tech_pitharan_dust }
								}
								AND = {
									has_deposit = d_living_metal_deposit
									root = { has_technology = tech_mine_living_metal }
								}
								AND = {
									has_deposit = d_lythuric_gas_deposit
									root = { has_technology = tech_lythuric_gas }
								}
								AND = {
									has_deposit = d_garanthium_deposit
									root = { has_technology = tech_mine_garanthium }
								}
								AND = {
									has_deposit = d_alien_pets_deposit
									root = { has_technology = tech_alien_life_studies }
								}
								AND = {
									has_deposit = d_betharian_deposit
									root = { has_technology = tech_mine_betharian }
								}
								AND = {
									has_deposit = d_satramene_deposit
									root = { has_technology = tech_mine_satramene }
								}
							}
						}
					}
				}
			}
		}
	}

	mean_time_to_happen = {
		days = 30
	}

	immediate = {
		capital_scope = {
			solar_system = {
				closest_system = {
					max_steps = 15
					random_planet = {
						limit = {
							is_capital = no
							is_surveyed = { who = ROOT status = yes }
							has_orbital_station = yes
							OR ={
								AND = {
									has_deposit = d_neutronium_deposit
									root = { has_technology = tech_mine_neutronium }
								}
								AND = {
									has_deposit = d_teldar_deposit
									root = { has_technology = tech_mine_teldar }
								}
								AND = {
									has_deposit = d_dark_matter_deposit
									root = { has_technology = tech_mine_dark_matter }
								}
								AND = {
									has_deposit = d_engos_deposit
									root = { has_technology = tech_engos_vapor }
								}
								AND = {
									has_deposit = d_pitharan_deposit
									root = { has_technology = tech_pitharan_dust }
								}
								AND = {
									has_deposit = d_living_metal_deposit
									root = { has_technology = tech_mine_living_metal }
								}
								AND = {
									has_deposit = d_lythuric_gas_deposit
									root = { has_technology = tech_lythuric_gas }
								}
								AND = {
									has_deposit = d_garanthium_deposit
									root = { has_technology = tech_mine_garanthium }
								}
								AND = {
									has_deposit = d_alien_pets_deposit
									root = { has_technology = tech_alien_life_studies }
								}
								AND = {
									has_deposit = d_betharian_deposit
									root = { has_technology = tech_mine_betharian }
								}
								AND = {
									has_deposit = d_satramene_deposit
									root = { has_technology = tech_mine_satramene }
								}
							}
						}
						save_event_target_as = StrategicResourcePlanet
					}
				}
			}
		}
		end_event_chain = "tutorial_21_chain"
		set_country_flag = finished_tutorial_21
		begin_event_chain = {
			event_chain = "tutorial_21b_chain"
			target = ROOT
		}
		create_point_of_interest = {
			id = tutorial.55.poi
			name = "tutorial.55.poi.name"
			desc = "tutorial.56.poi.desc"
			event_chain = tutorial_21b_chain
			location = event_target:StrategicResourcePlanet
		}
		country_event = { id = tutorial.561 days = 90 }
	}

	option = {
		name = OK
	}
}

country_event = {
	id = tutorial.561
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_ai = no
	}

	immediate = {
		end_event_chain = "tutorial_21b_chain"
	}
}

### TUTORIAL: UPLIFTING
# Start
country_event = {
	id = tutorial.57
	title = tutorial.57.name
	desc = {
		trigger = { has_technology = tech_epigenetic_triggers }
		text = tutorial.57.desc.yestech
		show_sound = tut_pre_sapients_intro
	}
	desc = {
		trigger = { NOT = { has_technology = tech_epigenetic_triggers } }
		text = tutorial.57.desc.notech
		show_sound = tut_pre_sapients_intro
	}

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_event_chain = tutorial_22_chain
			has_country_flag = finished_tutorial_22
		}
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_22_chain"
			target = ROOT
		}
	}

	option = {
		name = SITLOG
		custom_tooltip = tutorial_22_tooltip
	}
}

# Finish
country_event = {
	id = tutorial.58
	title = tutorial.58.name
	desc = tutorial.58.desc
	show_sound = tut_pre_sapients_success

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = tutorial_22_chain
	}

	immediate = {
		end_event_chain = tutorial_22_chain
		set_country_flag = finished_tutorial_22
	}

	option = {
		name = OK
	}
}

### TUTORIAL: FIRST CONTACT PROJECT
# Start
country_event = {
	id = tutorial.59
	title = tutorial.59.name
	desc = tutorial.59.desc
	show_sound = tut_new_first_contact_intro

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_event_chain = tutorial_23_chain
			has_country_flag = finished_tutorial_23
		}
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_23_chain"
			target = ROOT
		}
	}

	option = {
		name = SITLOG
		custom_tooltip = tutorial_23_tooltip
	}
}

# Finish
country_event = {
	id = tutorial.60
	title = tutorial.60.name
	desc = tutorial.60.desc
	show_sound = tut_new_first_contact_success

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = tutorial_23_chain
	}

	immediate = {
		end_event_chain = tutorial_23_chain
		set_country_flag = finished_tutorial_23
	}

	option = {
		name = OK
	}
}

# Uchuukaijuu
country_event = {
	id = tutorial.61
	title = tutorial.61.name
	desc = tutorial.61.desc
	show_sound = tut_new_first_contact_monster_success

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = tutorial_23_chain
	}

	immediate = {
		end_event_chain = tutorial_23_chain
		set_country_flag = finished_tutorial_23
	}

	option = {
		name = OK
	}
}

# Other party
country_event = {
	id = tutorial.62
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		is_country_type = default
		from = { is_tutorial_level = 2 }
	}

	immediate = {
		from = {
			country_event = { id = tutorial.63 }
		}
	}
}

# Other party completed project
country_event = {
	id = tutorial.63
	title = tutorial.63.name
	desc = tutorial.63.desc
	show_sound = tut_new_first_contact_other_party

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		is_country_type = default
		has_event_chain = tutorial_23_chain
	}

	immediate = {
		if = {
			limit = {
				any_country = {
					NOT = {
						has_established_contact = root
					}
				}
			}
			else = { end_event_chain = tutorial_23_chain }
		}
	}

	option = {
		name = OK
	}
}

### TUTORIAL: MODIFY SPECIES
# Necessary tech researched
country_event = {
	id = tutorial.64
	title = tutorial.64.name
	desc = tutorial.64.desc
	show_sound = tut_modify_species_intro

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		OR = {
			last_increased_tech = "tech_gene_tailoring"
			last_increased_tech = "tech_gene_expressions"
		}
		NOT = {
			has_country_flag = tutorial_24
			has_event_chain = tutorial_24_chain
		}
	}

	immediate = {
		set_country_flag = tutorial_24
		begin_event_chain = {
			event_chain = tutorial_24_chain
			target = ROOT
		}
	}

	option = {
		name = SITLOG
		custom_tooltip = tutorial_24_tooltip
	}
}

# Modification project completed
country_event = {
	id = tutorial.65
	title = tutorial.65.name
	desc = tutorial.65.desc
	show_sound = tut_modify_species_success

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_event_chain = tutorial_24_chain
	}

	immediate = {
		end_event_chain = tutorial_24_chain
	}

	option = {
		name = OK
	}
}

### TUTORIAL: FTL DESCRIPTION

# Warp Travel
#country_event = {
#	id = tutorial.70
#	title = tutorial.70.name
#	desc = tutorial.70.desc
#	show_sound = tut_ftl_warp_travel
#
#	is_triggered_only = yes
#	is_advisor_event = yes
#
#	trigger = {
#		is_tutorial_level > 0
#	}
#
#	option = {
#		name = OK
#	}
#}

# Hyperspace Travel
country_event = {
	id = tutorial.71
	title = tutorial.71.name
	desc = tutorial.71.desc
	show_sound = tut_ftl_hyperlane_travel

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level > 0
	}

	option = {
		name = OK
	}
}

# Wormhole Travel
#country_event = {
#	id = tutorial.72
#	title = tutorial.72.name
#	desc = tutorial.72.desc
#	show_sound = tut_ftl_wormhole_travel
#
#	is_triggered_only = yes
#	is_advisor_event = yes
#
#	trigger = {
#		is_tutorial_level > 0
#	}
#
#	option = {
#		name = OK
#	}
#}

### TUTORIAL REMINDER: Obtained Uplift tech
country_event = {
	id = tutorial.73
	title = tutorial.73.name
	desc = tutorial.73.desc
	show_sound = tut_uplift_reminder

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		OR = {
			last_increased_tech = tech_epigenetic_triggers
			#has_event_chain = tutorial_22_chain
		}
	}

	option = {
		name = OK
	}
}

# HIDDEN - Set flag for Homesystem surveyed
ship_event = {
	id = tutorial.74
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		owner = {
			is_ai = no
			NOT = { has_country_flag = homesystem_surveyed }
			FROM = {
				solar_system = {
					any_planet = {
						is_capital = yes
						is_owned_by = PREVPREVPREV
					}
				}
			}
		}
	}
	
	immediate = {
		owner = {
			set_country_flag = homesystem_surveyed 
		}
	}
}

### TUTORIAL: STARBASE

# Start
country_event = {
	id = tutorial.75
	title = tutorial.75.name
	desc = tutorial.75.desc
	show_sound = tut_frontier_station_intro
	
	is_advisor_event = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level = 2
		NOT = {
			has_event_chain = tutorial_25_chain
			has_country_flag = tutorial_cleared_early_75
		}
	}

	immediate = {
		begin_event_chain = {
			event_chain = "tutorial_25_chain"
			target = ROOT
		}
	}
	
	option = {
		name = SITLOG
		custom_tooltip = tutorial_25_tooltip
	}
}

# Cleared early
ship_event = {
	id = tutorial.750
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			NOT = { has_country_flag = tutorial_cleared_early_75 }
		}
	}
		
	immediate = {
		owner = { set_country_flag = tutorial_cleared_early_75 }
	}
}

# Finished
ship_event = {
	id = tutorial.76
	title = tutorial.76.name
	desc = tutorial.76.desc
	show_sound = tut_frontier_station_success
	
	is_triggered_only = yes
	is_advisor_event = yes
	
	trigger = {
		owner = {
			is_ai = no
			is_tutorial_level = 2
			has_event_chain = "tutorial_25_chain"
		}
	}
		
	immediate = {
		owner = { end_event_chain = "tutorial_25_chain" }
	}

	option = {
		name = "OK"
	}
}

# Tutorial level set to 0
country_event = {
	id = tutorial.100
	title = tutorial.100.name
	desc = tutorial.100.desc
	show_sound = tut_no_tutorial_settings

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 0
		has_country_flag = tutorial_level_picked
	}

	option = {
		name = OK
		hidden_effect = {
			remove_country_flag = advisor_tips
			set_advisor_active = no
		}
	}
}

# Tutorial level set to 1
country_event = {
	id = tutorial.101
	title = tutorial.101.name
	desc = tutorial.101.desc
	show_sound = tut_limited_tutorial_settings

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 1
		has_country_flag = tutorial_level_picked
		NOT = { has_ethic = ethic_gestalt_consciousness }
	}

	option = {
		name = OK
		hidden_effect = {
			set_country_flag = advisor_tips
			set_advisor_active = yes
		}
	}
}

# Tutorial level set to 2
country_event = {
	id = tutorial.102
	title = tutorial.102.name
	desc = tutorial.102.desc
	show_sound = tut_full_tutorial_settings

	is_triggered_only = yes
	is_advisor_event = yes

	trigger = {
		is_ai = no
		is_tutorial_level = 2
		has_country_flag = tutorial_level_picked
		NOT = { has_ethic = ethic_gestalt_consciousness }
	}

	option = {
		name = OK
		hidden_effect = {
			set_country_flag = advisor_tips
			set_advisor_active = yes
			if = {
				limit = {
					has_country_flag = waiting_tutorial_4
				}
				country_event = { id = tutorial.501 days = 10 }
				else = {
					country_event = { id = tutorial.1 }
				}
			}
		}
	}
}

# Remove Event chains set from tutorial levels
country_event = {
	id = tutorial.103
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		OR = {
			is_tutorial_level = 0
			is_tutorial_level = 1
		}
	}
	
	immediate = {
		remove_country_flag = advisor_tips #Removed to reset the tips whenever you change tutorial level
		#remove_country_flag = tutorial_1 #Might need to add these to make sure stuff doesn't break later
		#remove_country_flag = tutorial_2
		#remove_country_flag = waiting_tutorial_5
		#remove_country_flag = waiting_tutorial_11
		#remove_country_flag = tutorial_cleared_early_14
		#remove_country_flag = tutorial_cleared_early_16
		#remove_country_flag = tutorial_cleared_early_17
		#remove_country_flag = tutorial_cleared_early_48
		#remove_country_flag = tutorial_15_minerals_achieved
		#remove_country_flag = tutorial_15_credits_achieved
		#remove_country_flag = tutorial_16_corvettes_built
		#remove_country_flag = tutorial_16_admiral_assigned
		#remove_country_flag = finished_tutorial_20

		if = {
			limit = {
				has_event_chain = tutorial_1_chain
			}
			end_event_chain = tutorial_1_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_2_chain
			}
			end_event_chain = tutorial_2_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_3_chain
			}
			end_event_chain = tutorial_3_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_4_chain
			}
			end_event_chain = tutorial_4_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_5_chain
			}
			end_event_chain = tutorial_5_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_6_chain
			}
			end_event_chain = tutorial_6_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_7_chain
			}
			end_event_chain = tutorial_7_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_8_chain
			}
			end_event_chain = tutorial_8_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_9_chain
			}
			end_event_chain = tutorial_9_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_10_chain
			}
			end_event_chain = tutorial_10_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_11_chain
			}
			end_event_chain = tutorial_11_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_12_chain
			}
			end_event_chain = tutorial_12_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_13_chain
			}
			end_event_chain = tutorial_13_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_14_chain
			}
			end_event_chain = tutorial_14_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_15_chain
			}
			end_event_chain = tutorial_15_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_16_chain
			}
			end_event_chain = tutorial_16_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_17_chain
			}
			end_event_chain = tutorial_17_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_18_chain
			}
			end_event_chain = tutorial_18_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_19_chain
			}
			end_event_chain = tutorial_19_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_20_chain
			}
			end_event_chain = tutorial_20_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_21_chain
			}
			end_event_chain = tutorial_21_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_22_chain
			}
			end_event_chain = tutorial_22_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_23_chain
			}
			end_event_chain = tutorial_23_chain
		}
		if = {
			limit = {
				has_event_chain = tutorial_24_chain
			}
			end_event_chain = tutorial_24_chain
		}
	}
}

# Tutorial stuff reset at startup in case disabled from start
country_event = {
	id = tutorial.104
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		is_tutorial_level < 1
		NOT = { has_country_flag = tutorial_level_picked }
	}

	immediate = {
		set_country_flag = tutorial_level_picked
	}
}