#########################################
#
# Henrik's Test Events
#
#########################################

namespace = henrik

## Start the test
#country_event = {
#	id = henrik.1
#	title = OK
#	desc = OK
#	
#	hide_window = yes
#	
#	mean_time_to_happen = {
#		days = 1
#	}
#	
#	trigger = {
#		is_ai = no
#	}
#	
#	immediate = {
#		random_country = {
#			limit = {
#				NOT = { is_same_empire = ROOT }
#				is_ai = yes
#			}
#			country_event = {
#				id = henrik.2
#				days = 3
#			}
#		}
#	}
#}
#
## ping
#country_event = {
#	id = henrik.2
#	title = OK
#	desc = OK
#	
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		FROM = {
#			country_event = {
#				id = henrik.3
#				days = 3
#			}
#		}
#	}
#}
#
#country_event = {
#	id = henrik.3
#	title = henrik.3.name
#	desc = henrik.3.desc
#	
#	diplomatic = yes # Show the Diplomacy View
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = henrik.3.a
#		response_text = henrik.3.a.response
#	}
#	option = {
#		name = henrik.3.b
#		response_text = henrik.3.b.response
#	}
#	option = {
#		name = henrik.3.c
#	}
#}
#
#country_event = {
#	id = henrik.4
#	title = OK
#	desc = OK
#	
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		capital_scope = {
#			solar_system = {
#				every_system_planet = {
#					add_minerals = 1
#				}
#			}
#		}
#	}
#}
#
#country_event = 
#{
#	id = henrik.5
#	title = OK
#	desc = OK
#	
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		unlock_next_tech = social_engineering_tech_tree
#	}
#}
#
#country_event = 
#{
#	id = henrik.6
#	title = OK
#	desc = OK
#	
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		capital_scope = {
#			random_pop = {
#				kill_pop = yes
#			}
#		}
#	}
#}
#
#country_event = 
#{
#	id = henrik.7
#	title = "OK"
#	desc = "OK"
#	
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		capital_scope = {
#			space_owner = {
#				capital_scope = {
#					random_pop = {
#						kill_pop = yes
#					}
#				}
#			}
#		}
#	}
#}
#
#country_event = {
#	id = henrik.8
#	title = "OK"
#	desc = "OK"
#	
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		leader = {
#			if = {
#				limit = {
#					NOT = {
#						has_level greater_than 9
#					}
#				}
#				add_experience = 3000
#			}
#		}
#	}
#}
#
#country_event = {
#	id = henrik.9
#	title = "OK"
#	desc = "OK"
#	
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		create_faction = {
#			name = "Holy Order"
#		}
#	}
#}
#
#country_event = {
#	id = henrik.10
#	title = "OK"
#	desc = "OK"
#	
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		capital_scope = {
#			IF = {
#				limit = { num_minerals < 10 }
#				add_minerals = 1
#			}
#			IF = {
#				limit = { num_physics < 10 }
#				add_physics = 1
#			}
#			IF = {
#				limit = { num_society < 10 }
#				add_society = 1
#			}
#			IF = {
#				limit = { num_engineering < 10 }
#				add_engineering = 1
#			}
#		}
#	}
#}
#
#country_event = {
#	id = henrik.11
#	title = "OK"
#	desc = "OK"
#	
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		capital_scope = {
#			IF = {
#				limit = { has_ring = no }
#				set_ring = yes
#			}
#		}
#	}
#}
#
#country_event = {
#	id = henrik.12
#	title = "OK"
#	desc = "OK"
#	
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		capital_scope = {
#			IF = {
#				limit = { has_ring = yes }
#				set_ring = no
#			}
#		}
#	}
#}
#
#country_event = {
#	id = henrik.13
#	title = "OK"
#	desc = "OK"
#	
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		capital_scope = {
#			solar_system = {
#				every_system_planet = {
#					IF = {
#						limit = { 
#							num_minerals > 0
#						}
#						create_mining_station = {
#							owner = ROOT
#						}
#					}
#					IF = {
#						limit = { 
#							OR = { 
#								num_physics > 0
#								num_society > 0
#								num_engineering > 0
#							}
#						}
#						create_research_station = {
#							owner = ROOT
#						}
#					}
#				}
#			}
#		}
#	}
#}
#
#planet_event = {
#	id = henrik.14
#	title = "OK"
#	desc = "OK"
#	
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		create_species = {
#			name = "Xenomorphs"
#			class = random
#			portrait = random
#			traits = random
#		}
#		
#		create_faction = {
#			name = "Xenomorphs"
#			species = last_created
#		}
#		
#		create_army = {
#			name = "Xenomorph Invaders"
#			type = "assault_army"
#			species = last_created
#			owner = last_created
#		}
#		
#		create_army = {
#			name = "Xenomorph Invaders"
#			type = "assault_army"
#			species = last_created
#			owner = last_created
#		}
#		
#		create_army = {
#			name = "Xenomorph Invaders"
#			type = "assault_army"
#			species = last_created
#			owner = last_created
#		}
#	}
#}
#
### Incoming Transmission
#country_event = {
#	id = henrik.15
#	title = "henrik.15.name"
#	desc = "henrik.15.desc"
#	auto_opens = yes
#	diplomatic = yes
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = henrik.15.a
#		response_text = henrik.15.a.response
#		is_dialog_only = yes
#	}
#	option = {
#		name = henrik.15.b
#		response_text = henrik.15.b.response
#		is_dialog_only = yes
#	}
#	option = {
#		name = henrik.15.c
#		response_text = henrik.15.c.response
#		is_dialog_only = yes
#	}
#	option = {
#		name = henrik.15.d
#		response_text = henrik.15.d.response
#		is_dialog_only = yes
#	}
#	option = {
#		name = henrik.15.e
#		response_text = henrik.15.e.response
#	}
#}

#### Special Project Test
#planet_event = {
#	id = henrik.16
#	title = "henrik.16.name"
#	desc = "henrik.16.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = henrik.16.a
#		enable_special_project = {
#			name = "TEST_PROJECT"
#			location = ROOT
#		}
#	}
#}
#
#country_event = {
#	id = henrik.17
#	title = "henrik.17.name"
#	desc = "henrik.17.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		IF = {
#			LIMIT = {
#				tech_tree_completed = "ship_armor_tech_tree"
#			}
#			add_energy = 1000
#		}
#		IF = { 
#			LIMIT = {
#				NOT = {
#					tech_tree_completed = "ship_armor_tech_tree"
#				}
#			}
#			unlock_next_tech = "ship_armor_tech_tree"
#		}
#	}
#}
#
#planet_event = {
#	id = henrik.18
#	title = "henrik.18.name"
#	desc = "henrik.18.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		every_owned_pop = {
#			IF = {
#				LIMIT = {
#					has_pop_flag = "testing_once"
#				}
#				set_pop_flag = "testing_twice"
#			}
#			IF = {
#				LIMIT = {
#					NOT = {
#						has_pop_flag = "testing_once"
#					}
#				}
#				set_pop_flag = "testing_once"
#			}
#		}
#	}
#}
#
#planet_event = {
#	id = henrik.19
#	title = "henrik.19.name"
#	desc = "henrik.19.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		set_name = "Henrik"
#	}
#}
#country_event = {
#	id = henrik.1337
#	title = "henrik.1337.name"
#	desc = "henrik.1337.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		random_controlled_planet = {
#			random_planet = {
#				LIMIT = {
#					distance = {
#						source = prev
#						min_distance = 0
#						max_distance = 50
#					}
#				}
#			}
#		}
#	}
#}

# Spawns Hostile Army
#planet_event = {
#	id = henrik.20
#	title = "henrik.20.name"
#	desc = "henrik.20.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		owner = {
#			set_country_flag = battle_test
#		}
#		create_faction = {
#			name = "Hostile Army"
#		}
#		create_species = {
#			name = "Evil Ones"
#			class = random
#			portrait = random
#			traits = random
#		}
#		create_army = {
#			name = "Hostile Army 1"
#			owner = last_created
#			species = last_created
#			type = "assault_army"
#		}
#		create_army = {
#			name = "Hostile Army 2"
#			owner = last_created
#			species = last_created
#			type = "assault_army"
#		}
#		create_army = {
#			name = "Hostile Army 3"
#			owner = last_created
#			species = last_created
#			type = "assault_army"
#		}
#	}
#}
#
#planet_event = {
#	id = henrik.21
#	title = "henrik.21.name"
#	desc = "henrik.21.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		add_modifier = {
#			modifier = "alien_writing"
#			days = -1
#		}
#	}	
#}
#
#planet_event = {
#	id = henrik.22
#	title = "henrik.22"
#	desc = "henrik.22"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		IF = {
#			LIMIT = {
#				is_occupied_flag = yes
#			}
#			set_name = "Henrik"
#		}
#	}
#}
#
#country_event = {
#	id = henrik.23
#	title = "henrik.23.name"
#	desc = "henrik.23.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		create_leader = {
#			type = 0
#			species = last_created
#			name = "John Doe"
#			skill = 4
#		}
#	}
#}
#
#fleet_event = {
#	id = henrik.24
#	title = "henrik.24.name"
#	desc = "henrik.24.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		set_fleet_flag = flag_test 
#	}
#}
#
#fleet_event = {
#	id = henrik.25
#	title = "henrik.25.name"
#	desc = "henrik.25.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		remove_fleet_flag = flag_test
#	}
#}
#
#fleet_event = {
#	id = henrik.26
#	title = "henrik.26"
#	desc = "henrik.26"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		IF = {
#			LIMIT = {
#				has_fleet_flag = flag_test
#			}
#			set_name = "Henrik"
#		}
#	}
#}
#
#country_event = {
#	id = henrik.27
#	title = "henrik.27.name"
#	desc = "henrik.27.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		unlock_random_tech = 0
#	}
#}
#
#planet_event = {
#	id = henrik.28
#	title = "henrik.28"
#	desc = "henrik.28"
#	picture = TEMP_gasgiant
#	hide_window = yes
#	is_triggered_only = yes
#	
#	IMMEDIATE = {
#		IF = {
#			LIMIT = {
#				can_colonize = {
#					who = FROM
#					status = no
#				}
#			}
#			set_name = "Henrik"
#		}
#	}
#}
#
#
#ship_event = {
#	id = henrik.29
#	title = "henrik.29"
#	desc = "henrik.29"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		IF = {
#			LIMIT = {
#				is_damaged = no
#			}
#			set_name = "Henrik"
#		}
#	}
#}
#
#ship_event = {
#	id = henrik.30
#	title = "henrik.30"
#	desc = "henrik.30"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option {
#		IF = {
#			LIMIT = {
#				has_hp > 0
#			}
#			set_name = "Has HP successfull"
#		}
#	}
#}
#
#ship_event = {
#	id = henrik.31
#	title = "henrik.31.name"
#	desc = "henrik.31.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		reduce_hp = 3
#	}
#}
#
#ship_event = {
#	id = henrik.32
#	title = "henrik.32.name"
#	desc = "henrik.32.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		reduce_hp_percent = 25
#	}
#}
#
#ship_event = {
#	id = henrik.33
#	title = "henrik.33.name"
#	desc = "henrik.33.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		repair_ship = yes
#	}
#}
#
#planet_event = {
#	id = henrik.34
#	title = "henrik.34"
#	desc = "henrik.34"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		IF = {
#			LIMIT = {
#				is_surveyed = yes
#			}
#			set_name = "Henrik"
#		}
#	}
#}
#
#planet_event = {
#	id = henrik.35
#	title = "henrik.35"
#	desc = "henrik.35"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		random_country = {
#			limit = {
#				is_ai = no
#			}
#			ROOT = {
#				surveyed = { 
#					set_surveyed = yes 
#					surveyor = PREV
#				}
#			}
#		}
#	}
#}
#
#country_event = {
#	id = henrik.36
#	title = "henrik.36.name"
#	desc = "henrik.36.desc"
#	picture = GFX_evt_exploding_ship
#	
#	is_triggered_only = yes
#	
#	option = {
#		set_global_flag = flag_test 
#	}
#}
#
#country_event = {
#	id = henrik.37
#	title = "henrik.37.name"
#	desc = "henrik.37.desc"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		remove_global_flag = flag_test
#	}
#}
#
#country_event = {
#	id = henrik.38
#	title = "henrik.38"
#	desc = "henrik.38"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		IF = {
#			LIMIT = {
#				has_global_flag = flag_test
#			}
#			add_energy = 20000
#		}
#	}
#}
#country_event = {
#	id = henrik.39
#	title = "henrik.39"
#	desc = "henrik.39"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		destroy_country = yes
#	}
#}
#
#planet_event = {
#	id = henrik.40
#	title = "henrik.40"
#	desc = "henrik.40"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	hide_window = yes
#	
#	immediate = {
#		IF = {
#			LIMIT = {
#				check_variable = {
#					which = "super_planet"
#					value < 10
#				}
#			}
#			change_variable = {
#				which = "super_planet"
#				value = 1
#			}
#		}
#	}
#}
#
#fleet_event = {
#	id = henrik.41
#	title = "henrik.41"
#	desc = "henrik.41"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		create_ship = {
#			name = "random"
#			design = "TEST_DESIGN"
#		}
#	}
#}

#country_event = {
#	id = henrik.45
#	title = "henrik.45"
#	desc = "henrik.45"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		capital_scope = {
#			ROOT = {
#				enable_special_project = {
#					name = "TEST_PROJECT"
#					location = PREV
#				}
#			}
#		}
#	}
#}
#
#country_event = {
#	id = henrik.55
#	title = "henrik.55"
#	desc = "henrik.55"
#	picture = TEMP_gasgiant
#	is_triggered_only = yes
#	option = {
#		random = {
#			chance = 50 
#			add_energy = 200 
#		}
#	}
#}
#
#
#country_event = {
#	id = henrik.56
#	title = "henrik.56"
#	desc = "henrik.56"
#	picture = TEMP_gasgiant
#	is_triggered_only = yes
#	option = {
#		hyperlanes_visible = yes
#	}
#}
#
#

#planet_event = {
#	id = henrik.57
#	title = "henrik.57"
#	desc = "henrik.57"
#	is_triggered_only = yes
#	option = {
#		name = EXCELLENT
#		add_resource = { 
#			resource = sr_codrasite
#			amount = 1
#		}
#	}
#}

#planet_event = {
#	id = henrik.58
#	title = "OK"
#	desc = "OK"
#	
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		create_faction = {
#			name = "Hostile Army"
#		}
#		create_species = {
#			name = "Evil Ones"
#			class = random
#			portrait = random
#			traits = random
#		}
#		create_army = {
#			name = "Hostile Army 1"
#			owner = last_created
#			species = last_created
#			type = "assault_army"
#		}
#		create_army = {
#			name = "Hostile Army 2"
#			owner = last_created
#			species = last_created
#			type = "assault_army"
#		}
#		create_army = {
#			name = "Hostile Army 3"
#			owner = last_created
#			species = last_created
#			type = "assault_army"
#		}
#	}
#}
#
#planet_event = {
#	id = henrik.59
#	title = "OK"
#	desc = "OK"
#	
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		create_army = {
#			name = "Nice Army 1"
#			owner = owner
#			species = owner
#			type = "assault_army"
#		}
#		create_army = {
#			name = "Nice Army 2"
#			owner = owner
#			species = owner
#			type = "assault_army"
#		}
#		create_army = {
#			name = "Nice Army 3"
#			owner = owner
#			species = owner
#			type = "assault_army"
#		}
#	}
#}


#planet_event = {
#	id = henrik.100
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		create_faction = {
#			name = "Hostile Army"
#		}
#		create_species = {
#			name = "Evil Ones"
#			class = random
#			portrait = random
#			traits = random
#		}
#		create_army = {
#			name = "Hostile Army 1"
#			owner = last_created
#			species = last_created
#			type = "assault_army"
#		}
#		create_army = {
#			name = "Hostile Army 2"
#			owner = last_created
#			species = last_created
#			type = "assault_army"
#		}
#		create_army = {
#			name = "Hostile Army 3"
#			owner = last_created
#			species = last_created
#			type = "assault_army"
#		}
#	}
#}
#
#country_event = {
#	id = henrik.101
#	title = "henrik.101.name"
#	desc = "henrik.101.desc"
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		FROM = {
#			country_event = { id = henrik.102 }
#		}
#	}
#	
#	option = {
#		name = henrik.101.a
#	}
#}
#
#
#country_event = {
#	id = henrik.102
#	title = "henrik.102.name"
#	desc = "henrik.102.desc"
#	
#	diplomatic = yes
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = henrik.102.a
#	}
#}

#planet_event = {
#	id = henrik.110
#	title = "henrik.110.name"
#	desc = "henrik.110.desc"
#	picture = TEMP_primitive2
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = henrik.110.a
#		create_species = {
#			name = random
#			class = random
#			portrait = random
#			traits = random
#		}
#		create_country = {
#			name = random
#			government = primitive_feudalism
#			species = last_created
#			ethos = {
#				ethic = "ethic_xenophile"
#				ethic = "ethic_fanatic_individualist"			
#			}
#			color = random
#			icon = random
#		}
#		last_created_country = {
#			
#			random_list = {
#				20 = { set_country_flag = bronze_age }
#				20 = { set_country_flag = iron_age }
#				20 = { set_country_flag = late_medieval_age }
#				20 = { set_country_flag = renaissance_age }
#				20 = { set_country_flag = steam_age }
#			}
#		}
#		create_colony = {
#			owner = last_created_country
#			species = last_created
#			ethos = { 
#				ethic = "ethic_xenophile" 
#				ethic = "ethic_fanatic_individualist" 
#			}
#		}
#		create_pop = {
#			species = last_created
#			ethos = {
#				ethic = "ethic_xenophile"
#				ethic = "ethic_fanatic_individualist"			
#			}
#		}
#		create_pop = {
#			species = last_created
#			ethos = {
#				ethic = "ethic_xenophile"
#				ethic = "ethic_fanatic_individualist"			
#			}
#		}
#		create_pop = {
#			species = last_created
#			ethos = {
#				ethic = "ethic_xenophile"
#				ethic = "ethic_fanatic_individualist"			
#			}
#		}
#	}
#}

#planet_event = {
#	id = henrik.111
#	title = "henrik.111.name"
#	desc = "henrik.111.desc"
#	picture = TEMP_primitive2
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = henrik.111.a
#		add_modifier = {
#			modifier = "stone_age_civilization"
#			days = -1
#		}
#	}
#}

#country_event = {
#	id = henrik.112
#	title = "henrik.112"
#	desc = "henrik.112"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		IF = {
#			LIMIT = {
#				has_policy_flag = noninterference_directive
#			}
#			add_energy = 1000
#		}
#	}
#}
#
#country_event = {
#	id = henrik.113
#	title = "henrik.113"
#	desc = "henrik.113"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		IF = {
#			LIMIT = {
#				has_country_edict = information_quarantine
#			}
#			add_energy = 1000
#		}
#	}
#}
#
#planet_event = {
#	id = henrik.114
#	title = "henrik.114"
#	desc = "henrik.114"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		IF = {
#			LIMIT = {
#				has_planet_edict = biochemical_suppression
#			}
#			set_name = Merni
#		}
#	}
#}

#planet_event = {
#	id = henrik.130
#	hide_window = yes
#	
#	trigger = {
#		has_observation_outpost = yes
#		observation_outpost_owner = {
#			ai = no
#		}
#	}
#	
#	mean_time_to_happen = {
#		days = 1
#	}
#	
#	immediate = {
#		random_observation_outpost_owner = {
#			limit = { ai = no }
#			country_event = { id = henrik.131 }
#		}
#	}
#}
#
#country_event = {
#	id = henrik.131
#	title = "henrik.131"
#	desc = "henrik.131"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#	}
#}


#planet_event = {
#	id = henrik.132
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		spawn_system = {
#			min_distance = 20
#			max_distance = 50
#			system = "sol_system"
#		}
#	}
#}

#planet_event = {
#	id = henrik.135
#	hide_window = yes
#	
#	trigger = {
#		has_research_station = yes
#		any_research_station = {
#			owner = { is_ai = no }
#		}
#	}
#	
#	mean_time_to_happen = {
#		days = 1
#	}
#	
#	immediate = {
#		random_research_station = {
#			limit = { 
#				owner = {is_ai = no }
#			}
#			
#			owner = { 
#				country_event = { id = henrik.136 } 
#			}
#		}
#	}
#}
#
#country_event = {
#	id = henrik.136
#	title = "henrik.136"
#	desc = "henrik.136"
#	picture = TEMP_gasgiant
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = henrik.136.a
#	}
#}
#
#planet_event = {
#	id = henrik.133
#	title = "henrik.133"
#	desc = "henrik.133"
#	picture = TEMP_gasgiant
#	
#	trigger = {
#		has_research_station = yes
#	}
#	
#	option = {
#		random_research_station = {
#			dismantle = yes
#		}
#	}
#}

#planet_event = {
#	id = henrik.134
#	title = "henrik.134.name"
#	desc = "henrik.134.desc"
#	picture = TEMP_primitive2
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = henrik.134.a 
#		random_owned_pop =  {
#			create_species = {
#				is_mod = yes
#				name = this
#				class = this
#				portrait = this
#				traits = this
#			}
#		}
#		
#		best_tile_for_pop = {
#			create_pop = {
#				species = last_created
#				#name = "Xenomorph Invaders"
#				#type = "assault_army"
#				#species = last_created
#				#owner = last_created
#			}
#		}
#	}
#}

#planet_event = {
#	id = henrik.135
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		IF = {
#			limit = {
#				count_pops = {
#					limit = { has_pop_flag = "SUPER_DUPER_FLAG" }
#					count > 3
#				}
#			}
#			owner = {
#				add_energy = 100
#			}
#		}
#	}
#}

#pop_event = {
#	id = henrik.136
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		set_pop_flag = "SUPER_DUPER_FLAG"
#	}
#}

### Testing on_entering_system
#event = {
#	id = action.6
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		set_name = "Merni"
#		FROM = {
#			set_name = "Merni"
#		}
#		FROMFROM = {
#			set_name = "Merni"
#		}
#	}
#}

#country_event = {
#	id = henrik.137
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		random_owned_planet = {
#			random_pop = {
#				pop_event = { id = henrik.138 }
#			}
#		}
#	}
#}

#pop_event = {
#	id = henrik.138
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		IF = {
#			limit = {
#				FROM = {
#					num_pops < 1000
#				}
#			}
#		}
#		FROM = {
#			add_minerals = 10
#		}
#	}
#}

#ship_event = {
#	id = henrik.140
#	title = "henrik.140.name"
#	desc = "henrik.140.desc"
#	picture = GFX_evt_satellite_in_orbit
#	
#	location = ROOT
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = INTRIGUING
#	}
#}

#planet_event = {
#	id = henrik.141
#	title = "henrik.141.name"
#	desc = "henrik.141.desc"
#	picture = GFX_evt_satellite_in_orbit
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = OK
#		every_owned_pop = {
#			add_modifier = {
#				modifier = "fanatics_vs_wrong"
#				days = 180
#			}
#		}
#	}
#}

#planet_event = {
#	id = henrik.141
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		begin_event_chain = {
#			event_chain = "test_chain"
#			target = root
#		}
#		enable_special_project = {
#			name = "SUPER_DUPER_PROJECT"
#			location = root
#		}
#		enable_special_project = {
#			name = "SUPER_DUPER_PROJECT_2"
#			location = root
#		}
#		begin_event_chain = {
#			event_chain = "test_chain_2"
#			target = root
#		}
#		enable_special_project = {
#			name = "SUPER_DUPER_PROJECT_3"
#			location = root
#		}
#		enable_special_project = {
#			name = "SUPER_DUPER_PROJECT_4"
#			location = root
#		}
#	}
#}

#planet_event = {
#	id = henrik.142
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		owner = {
#			end_event_chain = "test_chain"
#		}
#	}
#}

#planet_event = {
#	id = henrik.143
#	hide_window = yes
#	is_triggered_only = yes
#	
#	immediate = {
#		owner = {
#			add_event_chain_counter = {
#				event_chain = "test_chain"
#				counter = "test_counter"
#				amount = 2
#			}	
#		}
#	}
#}

#planet_event = {
#	id = henrik.144
#	hide_window = yes
#	is_triggered_only = yes	
#
#	trigger = {
#		owner = {
#			has_completed_event_chain_counter = {
#				event_chain = "test_chain"
#				counter = "test_counter"
#			}
#		}
#	}
#}

#country_event = {
#	id = henrik.150
#	title = "henrik.145.name"
#	desc = "henrik.145.desc"
#	picture = GFX_evt_satellite_in_orbit
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = OK
#	}
#}
#}

#planet_event = {
#	id = henrik.1337
#	title = "hej"
#	desc = "hopp"
#	location = ROOT
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		hidden_effect = {
#			create_faction = {
#				name = "Hostile Creatures"
#			}
#			last_created_country = {
#				create_fleet = { name = "Hostile Creatures" }
#				last_created_fleet = {
#					set_owner = PREV
#					create_ship = {
#						name = "Nellie"
#						design = "Dagger"
#					}
#					create_ship = {
#						name = "Old Chomper"
#						design = "Ravager"
#					}
#					set_location = ROOT					
#					
#					queue_actions = {
#					
#						effect = {
#							id = "hej1"
#							create_ambient_object = {
#								type = "test_ambient_object"
#								location = solar_system
#							}
#						}
#						repeat = {
#							move_to = last_created_ambient_object
#							effect = {
#								id = "hej2"
#								destroy_ambient_object = last_created_ambient_object		#not really safe to use last_created_ambient_object here since time will pass while we wait for move_to to complete
#								create_ambient_object = {
#									type = "test_ambient_object"
#									location = solar_system
#								}
#							}
#						}
#						
#						#find_closest_planet
#						
#						#orbit_planet = ROOT
#						#
#						#repeat = {
#						#	max_iterations = 10
#						#	while = {
#						#		id = "henrik.1337.trigger.1"
#						#		owner = {
#						#			num_owned_planets < 5
#						#		}
#						#	}
#						#	
#						#	wait = 1
#						#	orbit_planet = random
#						#	effect = {
#						#		id = "henrik.1337.effect.1"
#						#		orbit = {
#						#			change_pc = pc_ai
#						#		}
#						#	}
#						#}
#						#
#						#orbit_planet = ROOT
#					
#						#repeat = {
#						#	find_closest_planet = {
#						#		trigger = {
#						#			id = "henrik.1337.trigger.1"
#						#			NOT = { 
#						#				OR = { 
#						#					is_planet_class = "pc_barren" 
#						#					is_star = yes
#						#				}
#						#			}
#						#		}
#						#		found_planet = {#sets current scope to a planet scope with the found planet
#						#			move_to = this
#						#			wait = 2
#						#			effect = {
#						#				id = "henrik.1337.effect.1"
#						#				change_pc = "pc_barren"
#						#			}
#						#		}
#						#		failed = {#no scope changes
#						#			effect = {
#						#				id = "henrik.1337.effect.2"
#						#				clear_fleet_actions = this
#						#				destroy_fleet = this
#						#			}
#						#		}
#						#	}
#						#}
#					}
#				}
#			}
#		}
#	}
#}

#country_event = {
#	id = henrik.143
#	title = henrik.143.name
#	message_desc = henrik.143.message
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		FROMFROM = {
#			destroy_fleet = this
#		}
#		FROMFROMFROM = {
#			destroy_fleet = this
#		}
#	}
#	
#	option = {
#	}
#}
#
#ship_event = {
#	id = henrik.144
#	title = henrik.144.name
#	message_desc = henrik.144.message
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		set_name = Merni
#		
#		FROM = {
#			set_name = Henrik
#		}
#	}
#	
#	option = {
#	}
#}
#
#planet_event = {
#	id = henrik.145
#	title = henrik.145.name
#	message_desc = henrik.145.message
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		set_name = Merni
#		
#		FROM = {
#			set_name = Henrik
#		}
#	}
#	
#	option = {
#	}
#}
#
#country_event = {
#	id = henrik.146
#	title = henrik.146.name
#	message_desc = henrik.146.message
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		set_name = Merni
#		
#		FROM = {
#			set_name = Henrik
#		}
#	}
#	
#	option = {
#	}
#}

#planet_event = {
#	id = henrik.155
#	title = henrik.155.name
#	message_desc = henrik.155.message
#	
#	is_triggered_only = yes
#	
#	option = {
#		create_fleet = { name = "Incoming Asteroid" }
#		last_created_fleet = {
#			set_owner = PREV
#			create_ship = {
#				name = "Asteroid"
#				design = "Asteroid"
#			}
#			set_location = ROOT
#		}
#	}
#}

#ship_event = {
#	id = henrik.156
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		solar_system = {
#			owner = {
#				country_event = { id = henrik.157 }
#			}
#		}
#	}
#}
#
#country_event = {
#	id = henrik.157
#	title = henrik.157.name
#	desc = henrik.157.desc
#	picture = GFX_evt_satellite_in_orbit
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = OK
#	}
#}
#
#country_event = {
#	id = henrik.158
#	title = henrik.158.name
#	desc = henrik.158.desc
#	
#	is_triggered_only = yes
#	
#	option = {
#		modify_species = {
#			species = ROOT
#			add_trait = trait_rapid_breeders
#			remove_trait = trait_weak
#		}
#	}
#}

#planet_event = {
#	id = henrik.159
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		save_event_target_as = planet_test
#		random_country = {
#			limit = { is_ai = no }
#			country_event = { id = henrik.160 }
#		}
#	}
#}
#
#country_event = {
#	id = henrik.160
#	title = henrik.160.name
#	desc = henrik.160.desc
#	picture = GFX_evt_ship_in_orbit
#	location = event_target:planet_test
#	
#	is_triggered_only = yes
#	
#	option = {
#		name = henrik.160.a
#		event_target:planet_test = {
#			add_modifier = {
#				modifier = "nuclear_wasteland"
#				days = -1
#			}
#		}
#	}
#}
#
#ship_event = {
#	id = henrik.161
#	title = henrik.161.name
#	desc = henrik.161.desc
#	picture = GFX_evt_ship_in_orbit
#	location = event_target:ship_test
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		save_event_target_as = ship_test
#	}
#	
#	option = {
#		name = henrik.161.a
#	}
#}

#planet_event = {
#	id = henrik.162
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		set_name = "Success"
#	}
#}

#planet_event = {
#	id = henrik.163
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		create_faction = {
#			name = "Disabables"
#			set_hostile = yes
#		}
#		last_created_country = {
#			create_fleet = { name = "The Disabables" }
#			last_created_fleet = {
#				set_owner = prev
#				create_ship = {
#					name = "RX-2324"
#					design = "Ravager"
#				}
#				last_created_ship = { set_disable_at_health = 0.75 }
#				create_ship = {
#					name = "RX-2325"
#					design = "Ravager"
#				}
#				last_created_ship = { set_disable_at_health = 0.25 }
#				set_location = ROOT
#			}
#		}
#	}
#}

#planet_event = {
#	id = henrik.164
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		owner = {
#			create_fleet = { name = "Random Corvette" }
#			last_created_fleet = {
#				set_owner = prev
#				create_ship = {
#					name = "Corvette"
#					random_existing_design = "corvette"
#				}
#				set_location = root
#			}
#		}
#	}
#}
#
#ship_event = {
#	id = henrik.165
#	title = "henrik.165.name"
#	desc = "henrik.165.desc"
#	picture = GFX_evt_satellite_in_orbit
#	location = event_target:space_probe
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		owner = {
#			begin_event_chain = {
#				event_chain = "sublight_probes_chain"
#				target = THIS
#			}
#		}
#		create_ambient_object = {
#			type = "sublight_probe_object"
#			location = solar_system
#		}
#		last_created_ambient_object = {
#			save_event_target_as = space_probe
#		}
#
#		create_point_of_interest = {
#			id 			= space_probe_poi.1
#			name 		= "SPACE_PROBE_POI"
#			desc 		= "SPACE_PROBE_POI_DESC"
#			
#			event_chain = "sublight_probes_chain"
#			location 	= event_target:space_probe	
#		}
#	}
#
#	option = {
#		name = "henrik.165.a"
#		enable_special_project = {
#			name = "SUBLIGHT_PROBE_PROJECT"
#			location = event_target:space_probe
#		}
#	}
#}
#
#country_event = {
#	id = henrik.166
#	title = "henrik.165.name"
#	desc = "henrik.165.desc"
#	picture = GFX_evt_satellite_in_orbit
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		remove_point_of_interest = space_probe_poi.1
#	}
#
#	option = {
#		name = "henrik.165.a"
#	}	
#}

#ship_event = {
#	id = henrik.167
#	title = "henrik.167.name"
#	desc = "henrik.167.desc"
#	picture = GFX_evt_satellite_in_orbit
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		create_ambient_object = {
#			type = "sublight_probe_object"
#			location = solar_system
#		}
#		last_created_ambient_object = { 
#			save_event_target_as = space_probe
#		}
#	}
#
#	option = {
#		name = "henrik.167.a"
#		create_faction = {
#			name = "Space Cloud"
#			set_neutral = yes
#		}
#		last_created_country = {
#			create_fleet = { name = "Space Cloud" }
#			last_created_fleet = {
#				set_owner = PREV
#				create_ship = {
#					name = "Cloud Entity"
#					design = "Space Cloud"
#				}
#				set_location = {
#					target = event_target:space_probe
#					distance = 5
#					angle = random 
#				}
#			}
#		}
#	}	
#}

###########################
#
# Maximilian's test events
#
###########################

#planet_event = {
#	id = henrik.6000
#	title = "anomaly.6000.name"
#	desc = "anomaly.6000.desc"
#	picture = GFX_evt_landing_ship
#	location = root
#
#	is_triggered_only = yes
#
#	trigger = {
#		has_owner = no
#	}
#
#	immediate = {
#		create_species = {
#			name = "Snakeoid"
#			class = "REP"
#			portrait = "rep1"
#				traits = {
#					ideal_planet_class = "pc_desert"
#					trait = random_trait
#					trait = random_trait
#				}
#			traits = random
#			homeworld = root
#			sentient = no
#		}
#		random_tile = {
#			limit = {
#				has_blocker = no
#					has_grown_pop = no
#			}
#			create_pop = { 
#				species = last_created 
#			}
#			
#			last_created_pop = {
#				set_pop_flag = "Snakeoid"
#			}
#		}
#		random_tile = {
#			limit = {
#				has_blocker = no
#					has_grown_pop = no
#			}
#			create_pop = { 
#				species = last_created 
#			}
#			
#			last_created_pop = {
#				set_pop_flag = "Snakeoid"
#			}
#		}
#		random_tile = {
#			limit = {
#				has_blocker = no
#					has_grown_pop = no
#			}
#			create_pop = { 
#				species = last_created 
#			}
#			
#			last_created_pop = {
#				set_pop_flag = "Snakeoid"
#			}
#		}
#	}
#
#	option = {
#		name = "INTERESTING"
#	}
#}

#country_event = {
#	id = henrik.123
#	picture = GFX_evt_mining_station
#	
#	is_triggered_only = yes
#
#	option = {
#		set_timed_global_flag = { flag = timed_flag days = 10 }
#		# Will overwrite timed_flag with days 20
#		set_timed_global_flag = { flag = timed_flag days = 20 }
#		set_timed_global_flag = { flag = timed_flag_long days = 20 }
#		
#		set_timed_country_flag = { flag = timed_flag days = 10 }
#		set_timed_country_flag = { flag = timed_flag_long days = 20 }
#		
#		random_owned_planet = {
#			set_timed_planet_flag = { flag = timed_flag days = 10 }
#			set_timed_planet_flag = { flag = timed_flag_long days = 20 }

#			random_pop = {
#				set_timed_pop_flag = { flag = timed_flag days = 10 }
#				set_timed_pop_flag = { flag = timed_flag_long days = 20 }
#			}
#		}
#		
#		random_owned_ship = {
#			set_timed_ship_flag = { flag = timed_flag days = 10 }
#			set_timed_ship_flag = { flag = timed_flag_long days = 20 }
#
#			fleet = {
#				set_timed_fleet_flag = { flag = timed_flag days = 10 }
#				set_timed_fleet_flag = { flag = timed_flag_long days = 20 }
#			}
#		}
#		
#		random_system = {
#			set_timed_star_flag = { flag = timed_flag days = 10 }
#			set_timed_star_flag = { flag = timed_flag_long days = 20 }
#		}
#		
#		random_country = {
#			set_timed_relation_flag = { who = ROOT flag = timed_flag days = 10 }
#			set_timed_relation_flag = { who = ROOT flag = timed_flag_long days = 20 }
#		}
#	}
#}

#country_event = {
#	id = henrik.1000
#	title = "country.1000.name"
#	desc = "country.1000.desc"
#	picture = GFX_evt_hangar_bay
#	show_sound = event_default
#
#	is_triggered_only = yes
#
#	auto_opens = yes
#
#	immediate = {
#		owner_species = { save_event_target_as = original_species }
#		capital_scope = { save_event_target_as = capital }
#		create_faction = {
#			name = "Wandering Scientist"
#			auto_delete = no
#		}
#		last_created_country = {
#			set_country_flag = wandering_scientist_country
#			create_leader = {
#				type = scientist
#				species = event_target:original_species
#				name = "Eccentric Researcher"
#				skill = 500
#			}
#			create_fleet = { name = "Wandering Scientist" }
#			last_created_fleet = {
#				set_owner = PREV
#				create_ship = {
#					name = "Research Expedition Vessel"
#					design = "Guardian"
#				}
#				assign_leader = last_created_leader
#				last_created_ship = {
#					set_ship_flag = wandering_scientist_ship
#					set_disable_at_health = 1.0
#					save_event_target_as = wandering_ship
#				}
#				set_location = event_target:capital
#			}
#		}
#	}
#
#	option = {
#		name = country.1000.a
#	}
#}

#planet_event = {
#	id = henrik.170
#	title = "henrik.170"
#	desc = "henrik.170"
#	
#	is_triggered_only = yes
#	
#	trigger = {
#		any_tile = {
#			has_blocker = "tb_wandering_forests" 
#		}
#	}
#	
#	option = {
#		name = EXCELLENT
#	}
#}

## event target breaking test
## mtth of 5 days
## saves the capital planet as original_target
#country_event = {
#	id = henrik.2000
#	title = "anomaly.169.a.tooltip"
#	desc = "anomaly.169.a.tooltip"
#	picture = GFX_evt_wormhole
#	show_sound = event_mystic_reveal
#	location = root
#	
#	auto_opens = yes
#	
#	trigger = {
#		is_ai = no
#		NOT = { has_country_flag = event_test }
#	}
#	
#	immediate = { set_country_flag = event_test }
#	
#	mean_time_to_happen = { days = 5 }
#	
#	option = {
#		name = OK
#		capital_scope = { save_event_target_as = original_target }
#		country_event = { id = henrik.2001 days = 10 }
#	}
#}

## sets event_test_2 flag so henrik.2002 is triggered upon survey
## mtth of 20 days
#country_event = {
#	id = henrik.2001
#	title = "anomaly.169.a.tooltip"
#	desc = "anomaly.169.a.tooltip"
#	picture = GFX_evt_wormhole
#	show_sound = event_mystic_reveal
#	location = root
#	
#	auto_opens = yes
#	
#	mean_time_to_happen = { days = 20 }
#	
#	trigger = { has_country_flag = event_test NOT = { has_country_flag = event_test_2 } }
#	
#	option = {
#		name = OK
#		set_country_flag = event_test_2
#	}
#}

## IMPORTANT: add henrik.2002 to "on_survey = { events = {" in 00_on_actions
## triggers on planet survey
## saves ship as new_target
## SAVE AFTER THIS and check gamestate
## triggers henrik.2003 after 10 days
#ship_event = {
#	id = henrik.2002
#	title = "anomaly.169.a.tooltip"
#	desc = "anomaly.169.a.tooltip"
#	picture = GFX_evt_wormhole
#	show_sound = event_mystic_reveal
#	location = root
#	
#	auto_opens = yes
#	
#	is_triggered_only = yes
#	
#	trigger = { owner = { is_ai = no has_country_flag = event_test_2 } }
#
#	immediate = {
#		save_event_target_as = new_target
#	}
#	
#	option = {
#		name = OK
#		owner = { country_event = { id = henrik.2003 days = 10 } }
#	}
#}
# ORIGINAL_TARGET HAS BEEN LOST

## re-saves original_target, then saves another_target
## the final event's special project remains broken - only one target saved at a time?
## then why name them?
#country_event = {
#	id = henrik.2003
#	title = "anomaly.169.a.tooltip"
#	desc = "anomaly.169.a.tooltip"
#	picture = GFX_evt_wormhole
#	show_sound = event_mystic_reveal
#	location = root
#
#	auto_opens = yes
#
#	is_triggered_only = yes
#
#	trigger = { is_ai = no has_country_flag = event_test_2 }
#
#	option = {
#		name = OK
#		capital_scope = { save_event_target_as = original_target }
#		capital_scope = { solar_system = { save_event_target_as = another_target } }
#		country_event = { id = henrik.2004 }
#	}
#}

# final event, enables special project on the capital using original event target
# this will break if the player has saved/loaded
#country_event = {
#	id = henrik.2004
#	title = "anomaly.169.a.tooltip"
#	desc = "anomaly.169.a.tooltip"
#	picture = GFX_evt_wormhole
#	show_sound = event_mystic_reveal
#	location = root
#
#	auto_opens = yes
#
#	is_triggered_only = yes
#
#	trigger = { is_ai = no has_country_flag = event_test_2 }
#
#	option = {
#		name = OK
#		enable_special_project = {
#			name = "ABANDONED_TERRAFORMING_PROJECT"
#			location = event_target:original_target
#		}
#	}
#}

#planet_event = {
#	id = henrik.222
#	hide_window = yes
#	location = ROOT
#
#	is_triggered_only = yes
#
#	immediate = {
#		create_faction = {
#			name = "Scrap Probes"
#			set_hostile = yes
#		}
#		last_created_country = {
#			create_fleet = { name = "Scrap Probes" }
#			last_created_fleet = {
#				set_owner = prev
#				create_ship = {
#					name = "Junk Probe Alpha"
#					design = "DS47"
#				}
#				create_ship = {
#					name = "Junk Probe Beta"
#					design = "DS47"
#				}
#				set_location = root
#			}
#		}	
#	}
#}

#planet_event = {
#	id = henrik.223
#	hide_window = yes
#	location = ROOT
#	
#	trigger = {
#		always = no
#	}
#	
#	immediate = {
#		create_species = {
#			name = "test species"
#			class = random
#			portrait = random
#			traits = random
#		}
#		create_country = {
#			name = "test hostiles"
#			type = faction
#			species = last_created
#		}
#		last_created_country = {
#			create_leader = {
#				type = general
#				species = last_created
#				name = "test leader"
#				skill = 3500
#			}
#		}
#		create_army = {
#			name = "Invading Horde"
#			owner = last_created
#			species = last_created
#			type = "assault_army"
#			leader = last_created_leader
#		}
#		create_army = {
#			name = "Invading Horde"
#			owner = last_created
#			species = last_created
#			type = "assault_army"
#		}
#		create_army = {
#			name = "Invading Horde"
#			owner = last_created
#			species = last_created
#			type = "assault_army"
#		}
#	}		
#}
#
#planet_event = {
#	id = henrik.224
#	hide_window = yes
#	location = ROOT
#	
#	trigger = {
#		always = no
#	}
#
#	immediate = {
#		if = { limit = { is_preventing_anomaly = yes } prevent_anomaly = no break = yes }
#		if = { limit = { is_preventing_anomaly = no } prevent_anomaly = yes break = yes }
#	}
#}

#planet_event = {
#	id = henrik.225
#	hide_window = yes
#	location = ROOT
#
#	is_triggered_only = yes
#
#	immediate = {
#		create_faction = {
#			name = "Scrap Probes"
#			set_hostile = yes
#		}
#		last_created_country = {
#			create_fleet = { name = "Scrap Probes" }
#			create_species = {
#				name = random
#				class = random
#				portrait = random
#				traits = random
#			}
#			create_leader = {
#				type = admiral
#				species = last_created
#				name = "Mehrnaz"
#				skill = 3400
#			}
#			last_created_fleet = {
#				set_owner = prev
#				create_ship = {
#					name = "Junk Probe Alpha"
#					design = "DS47"
#				}
#				assign_leader = last_created_leader
#				create_ship = {
#					name = "Junk Probe Beta"
#					design = "DS47"
#				}
#				set_location = root
#			}
#		}	
#	}
#}
#planet_event = {
#	id = henrik.225
#	hide_window = yes
#	location = ROOT
#
#	is_triggered_only = yes
#
#	immediate = {
#		create_faction = {
#			name = "Scrap Probes"
#			set_hostile = yes
#		}
#		last_created_country = {
#			create_fleet = { name = "Scrap Probes" }
#			create_species = {
#				name = random
#				class = random
#				portrait = random
#				traits = random
#			}
#			create_leader = {
#				type = admiral
#				species = last_created
#				name = "Mehrnaz"
#				skill = 3400
#			}
#			last_created_fleet = {
#				set_owner = prev
#				create_ship = {
#					name = "Junk Probe Alpha"
#					design = "DS47"
#				}
#				assign_leader = last_created_leader
#				create_ship = {
#					name = "Junk Probe Beta"
#					design = "DS47"
#				}
#				set_location = root
#			}
#		}	
#	}
#}

#planet_event = {
#	id = henrik.226
#	hide_window = yes
#	
#	trigger = {
#		always = no
#	}
#	
#	immediate = {
#		set_planet_max_health = 100
#		set_planet_health = 50
#	}
#}
#
#planet_event = {
#	id = henrik.227
#	hide_window = yes
#	
#	trigger = {
#		always = no
#	}
#	
#	immediate = {
#		change_pc = pc_barren
#		owner = { country_event = { id = henrik.228 } country_event = { id = henrik.229 } }
#	}
#}
#
## Swarm spawn test
#country_event = {
#	id = henrik.228
#	hide_window = yes
#	
#	is_triggered_only = yes
#	
#	trigger = {
#		is_ai = no
#	}
#	
#	immediate = {
#		capital_scope = {
#			solar_system = {
#				random_system_planet = {
#					limit = { is_capital = no }
#					save_event_target_as = target_ast
#				}
#			}
#		}
#		create_country = {
#			name = "Prethoryn Scourge"
#			type = "swarm"
#		}
#		last_created_country = {
#			
#			### FIRST FLEET
#			create_fleet = { name = "Prethoryn Vanguard" }
#			create_species = {
#				name = random
#				class = random
#				portrait = random
#				traits = random
#			}
#			create_leader = {
#				type = admiral
#				species = last_created
#				name = "Brood Mind Karz"
#				skill = 3400
#			}
#			last_created_fleet = {
#				set_owner = PREV
#				create_ship = {
#					name = "Prethoryn Warrior"
#					design = "Swarm Large"
#					graphical_culture = "swarm_01"
#				}
#				assign_leader = last_created_leader
#				create_ship = {
#					name = "Prethoryn Warrior"
#					design = "Swarm Large"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Warrior"
#					design = "Swarm Large"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Warrior"
#					design = "Swarm Large"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Warrior"
#					design = "Swarm Large"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Warrior"
#					design = "Swarm Large"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Warrior"
#					design = "Swarm Large"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Warrior"
#					design = "Swarm Large"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Warrior"
#					design = "Swarm Large"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Warrior"
#					design = "Swarm Large"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				create_ship = {
#					name = "Prethoryn Swarmling"
#					design = "Swarm Small"
#					graphical_culture = "swarm_01"
#				}
#				#set_location = PREVPREV
#				set_location = event_target:target_ast
#			}
#			create_fleet = { name = "Prethoryn Vanguard" }
#			last_created_fleet = {
#				set_owner = PREV
#				create_army_transport = {
#					ship_name = "Prethoryn TROOP TRANSPORT"
#					graphical_culture = "swarm_01"
#					army_name = random
#					army_type = "assault_army"
#					species = last_created
#				}
#				set_location = event_target:target_ast
#			}
#		}
#	}
#}
#
## Swarm colonizer test
#country_event = {
#	id = henrik.229
#	hide_window = yes
#
#	is_triggered_only = yes
#
#	immediate = {
#		capital_scope = { 
#			solar_system = { 
#				random_system_planet = { 
#					limit = { 
#						is_star = no
#						is_capital = no
#					}
#					save_event_target_as = the_planet
#				} 
#			}
#		}
#		create_species = {
#			name = "Prethoryn"
#			class = SWARM
#			portrait = random
#			traits = random
#		}
#		create_country = {
#			name = "Prethoryn Scourge"
#			type = "swarm"
#			species = last_created
#		}
#		
#		last_created_country = {
#			# Give them a transport fleet design with warp
#			create_ship_design = {
#				design = "Swarm Transport"
#				ftl = warp
#			}
#			add_ship_design = last_created_design
#
#			create_ship_design = {
#				design = "Swarm Constructor"
#			}
#			add_ship_design = last_created_design
#
#			create_ship_design = {
#				design = "Swarm Colonizer"
#			}
#			add_ship_design = last_created_design
#
#			save_event_target_as = colonizer_owner
#		}
#		
#		create_fleet = { name = "Prethoryn Infestor" }
#		last_created_fleet = {
#			set_owner = last_created_country
#			create_ship = {
#				name = "Prethoryn Infestor"
#				design = "Swarm Colonizer"
#				graphical_culture = "swarm_01"
#			}
#			set_location = event_target:the_planet
#			queue_actions = {
#				repeat = {
#					find_closest_planet = {
#						trigger = {
#							id = "test.trigger.2"
#							has_owner = no
#							OR = { 
#								is_planet_class = "pc_desert"
#								is_planet_class = "pc_tropical"
#								is_planet_class = "pc_arid"
#								is_planet_class = "pc_continental"
#								is_planet_class = "pc_ocean"
#								is_planet_class = "pc_tundra"
#								is_planet_class = "pc_arctic"
#							}
#						}
#						found_planet = {
#							orbit_planet = THIS
#							effect = {
#								id = "test.effect.1"
#								change_pc = pc_infested
#								set_planet_max_health = 8000
#								set_planet_health = 8000
#								PREV = {
#									owner = {
#										prevprev = {
#											set_owner = prev
#										}
#									}
#								}
#								destroy_fleet = PREV
#							}
#						}
#					}
#					find_random_system = {
#						trigger = {
#							id = "test.trigger.3"
#							OR = { 
#								has_planet_class = "pc_desert"
#								has_planet_class = "pc_tropical"
#								has_planet_class = "pc_arid"
#								has_planet_class = "pc_continental"
#								has_planet_class = "pc_ocean"
#								has_planet_class = "pc_tundra"
#								has_planet_class = "pc_arctic"
#							}
#							distance = {
#								source = PREV
#								max_distance = 50
#								min_distance = 5
#							}
#						}
#						found_system = {
#							move_to = THIS
#						}
#					}
#				}
#			}
#		}			
#	}
#}

## Swarm planet test
#planet_event = {
#	id = henrik.230
#	hide_window = yes
#
#	is_triggered_only = yes
#
#	immediate = {
#		change_pc = pc_infested
#		create_country = {
#			name = "Prethoryn Scourge"
#			type = "swarm"
#			species = random
#		}
#		last_created_country = { save_event_target_as = prethoryn_scourge }
#		set_owner = event_target:prethoryn_scourge
#	}
#}

# Ambient object destruction test 1
#country_event = {
#	id = henrik.231
#	hide_window = yes
#
#	is_triggered_only = yes
#
#	immediate = {
#		capital_scope = {
#			#save_event_target_as = home_test
#			#create_ambient_object = {
#			#	type = "shrine_object"
#			#	location = this
#			#}
#			enable_special_project = {
#				name = "TEST_AMBIENT_PROJECT"
#				location = this
#				#owner = root
#			}
#		}
#		
#		#last_created_ambient_object = {
#		#	enable_special_project = {
#		#		name = "TEST_AMBIENT_PROJECT"
#		#		location = this
#		#		owner = root
#		#	}
#		#}
#	}
#}
#
# Ambient object destruction test 2
#ship_event = {
#	id = henrik.232
#	title = "OK"
#	desc = "OK"
#	picture = GFX_evt_big_landing_ship
#
#	is_triggered_only = yes
#
#	immediate = { leader = { add_experience = 100 } }
#
#	option = {
#		name = OK
#		fromfrom = { change_pc = pc_tundra }
#	}
#
#	option = {
#		name = OK
#		fromfrom = { destroy_ambient_object = this }
#	}
#
#	option = {
#		name = OK
#		fromfrom = { from = { destroy_ambient_object = this } }
#	}
#
#	option = {
#		name = OK
#		destroy_ambient_object = event_target:test_object
#	}
#}

# Spawned ship FTL test
#country_event = {
#	id = henrik.233
#	hide_window = yes
#
#	is_triggered_only = yes
#
#	immediate = {
#		save_event_target_as = owner_country
#		capital_scope = {
#			save_event_target_as = homeworld
#		}
#		create_fleet = { name = "Greased Lightning" }
#		last_created_fleet = {
#			set_owner = root
#			create_ship_design = {
#				design = "Pirate Corvette 1"
#				ftl = event_target:owner_country
#			}
#			create_ship = {
#				graphical_culture = "pirate_01"
#				name = "Abandoned Alien Vessel"
#				design = last_created_design
#			}
#			set_location = event_target:homeworld
#		}
#	}
#}

## Ship Test
#planet_event = {
#	id = henrik.231
#	hide_window = yes
#
#	is_triggered_only = yes
#
#	immediate = {
#		owner = {
#			create_fleet = { name = "Test" }
#			last_created_fleet = {
#				set_owner = PREV
#				#create_ship = {
#				#	name = "Test"
#				#	design = "Sword"
#				#}
#				#create_ship = {
#				#	name = "Test"
#				#	design = "Seeker"
#				#}
#				#create_ship = {
#				#	name = "Test"
#				#	design = "Judgment"
#				#}
#				#create_ship = {
#				#	name = "Test"
#				#	design = "ES4 Blue"
#				#}
#				#create_ship = {
#				#	name = "Test"
#				#	design = "Voidstalker"
#				#}
#				#create_ship = {
#				#	name = "Test"
#				#	design = "Starfang"
#				#}
#				create_ship = {
#					name = "Test"
#					design = "Diaspora"
#				}
#				create_ship = {
#					name = "Test"
#					design = "Splendor"
#				}
#				set_location = ROOT
#			}
#		}
#	}
#}
#
## Ship Test
#planet_event = {
#	id = henrik.232
#	hide_window = yes
#
#	is_triggered_only = yes
#
#	immediate = {
#		create_country = {
#			name = "Pirates"
#			type = pirate
#			species = event_target:owner_species
#			name_list = "PRT1"
#			flag = {
#				icon = {
#					category = "pirate"
#					file = "flag_pirate_7.dds"
#				}
#				background = {
#					category = "backgrounds"
#					file = "00_solid.dds"
#				}
#				colors ={
#					"red"
#					"red"
#					"null"
#					"null"
#				}
#			}
#		}
#		last_created_country = {
#			set_name = random
#			create_fleet = { name = "Pirate Fleet" }
#			last_created_fleet = {
#				set_owner = PREV
#				#create_ship = {
#				#	name = "Test"
#				#	design = "Sword"
#				#}
#				#create_ship = {
#				#	name = "Test"
#				#	design = "Seeker"
#				#}
#				#create_ship = {
#				#	name = "Test"
#				#	design = "Judgment"
#				#}
#				#create_ship = {
#				#	name = "Test"
#				#	design = "ES4 Blue"
#				#}
#				#create_ship = {
#				#	name = "Test"
#				#	design = "Voidstalker"
#				#}
#				#create_ship = {
#				#	name = "Test"
#				#	design = "Starfang"
#				#}
#				#create_ship = {
#				#	name = "Test"
#				#	design = "Persistent"
#				#}
#				create_ship = {
#					name = "Test"
#					design = "Sword"
#				}
#				create_ship = {
#					name = "Test"
#					design = "Sword"
#				}
#				create_ship = {
#					name = "Test"
#					design = "Sword"
#				}
#				create_ship = {
#					name = "Test"
#					design = "Sword"
#				}
#				set_location = ROOT
#			}
#		}		
#	}
#}

#planet_event = {
#	id = henrik.235
#	hide_window = yes
#
#	trigger = {
#		has_observation_outpost = yes
#		observation_outpost = {
#			has_mission = passive_observation
#		}
#	}
#	
#	mean_time_to_happen = {
#		months = 1
#	}
#
#	immediate = {
#		observation_outpost_owner = { 
#			country_event = { id = henrik.236 }
#		}
#		observation_outpost = {
#			add_mission_progress = 0.5
#		}
#	}
#}
#
#country_event = {
#	id = henrik.236
#	title = "OK"
#	desc = "OK"
#	picture = GFX_evt_alien_cavemen
#
#	is_triggered_only = yes
#
#	option = {
#		name = OK
#	}
#}

## Ship random names
#planet_event = {
#	id = henrik.237
#	hide_window = yes
#
#	is_triggered_only = yes
#
#	immediate = {
#		create_species = {
#			name = "Prethoryn"
#			class = SWARM
#			portrait = random
#			traits = random
#		}
#		create_country = {
#			name = "Prethoryn Scourge"
#			type = "swarm"
#			species = last_created
#			name_list = "MAM1" 
#		}
#		last_created_country = {
#			create_fleet = { name = "Prethoryn Vanguard" }
#			create_leader = {
#				type = admiral
#				species = last_created
#				name = random
#				skill = 3400
#			}
#			last_created_fleet = {
#				set_owner = PREV
#				create_ship = {
#					name = random
#					design = "Ravager"
#				}
#				assign_leader = last_created_leader
#				set_location = ROOT
#			}
#		}
#	}
#}

#country_event = {
#	id = henrik.238
#	hide_window = yes
#
#	is_triggered_only = yes
#
#	immediate = {
#		owner_species = { save_event_target_as = owner_species }
#		capital_scope = { save_event_target_as = capital }
#		create_country = {
#			name = "Radical Cult"
#			species = event_target:owner_species
#			type = faction
#			auto_delete = no
#		}
#		last_created_country = {
#			create_fleet = { name = "Test Fleet" }
#			create_leader = {
#				type = admiral
#				species = event_target:owner_species
#				name = random
#				skill = 0
#				traits = {
#					trait = leader_trait_carefree
#					#trait = random
#				}
#			}
#			last_created_fleet = {
#				set_owner = PREV
#				create_ship = {
#					name = "Unyielding Faith"
#					random_existing_design = "corvette"
#					prefix = no
#				}
#				assign_leader = last_created_leader
#				set_location = {
#					target = event_target:capital
#					distance = 75
#					angle = random 
#				}
#			}
#		}
#	}
#}

planet_event = {
	id = henrik.239
	hide_window = yes
	
	trigger = {
		always = no
	}
	
	immediate = {
		destroy_fleet = spaceport
		create_spaceport = {
			owner = root
			initial_module = "laser_weapon"
		}
		spaceport = {
			set_spaceport_level = 6
			
			set_spaceport_module = {
				slot = 1
				module = "destroyer_assembly_yards"
			}
		}
	}
}

planet_event = {
	id = henrik.240
	hide_window = yes
	
	trigger = {
		always = no
	}
	
	immediate = {
		switch = {
			trigger = is_capital
			yes = { owner = { add_energy = 1 } }
			no = { owner = { add_energy = 2 } }
		}
		
		owner = {
			switch = {
				trigger = energy
				1337 = { add_energy = 1337 }
				100 < { add_energy = 100 }
				50 > { add_energy = 50 }
			}
		}
	}
}

#planet_event = {
#	id = henrik.241
#	hide_window = yes
#	
#	fire_only_once = yes
#	
#	trigger = {
#		has_observation_outpost = yes
#		observation_outpost = { has_mission = passive_observation }
#		observation_outpost_owner = { is_ai = no }
#	}
#	
#	mean_time_to_happen = {
#		months = 1
#	}
#	
#	immediate = {
#		observation_outpost_owner = {
#			country_event = { id = henrik.242 }
#		}
#	}
#}
#
#country_event = {
#	id = henrik.242
#	title = "OK"
#	desc = "OK"
#	picture = GFX_evt_alien_cavemen
#
#	is_triggered_only = yes
#
#	option = {
#		name = OK
#	}
#}

# Primitive Civilization Industrial Test Event
planet_event = {
	id = henrik.245
	hide_window = yes
	
	trigger = {
		always = no
	}
	
	immediate = {
		change_pc = pc_continental
		if = {
			limit = { is_planet_class = pc_desert }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_desert"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		if = {
			limit = { is_planet_class = pc_tropical }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_tropical"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		if = {
			limit = { is_planet_class = pc_arid }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_arid"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		if = {
			limit = { is_planet_class = pc_continental }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_continental"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		if = {
			limit = { is_planet_class = pc_ocean }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_ocean"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		if = {
			limit = { is_planet_class = pc_tundra }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_tundra"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		if = {
			limit = { is_planet_class = pc_arctic }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_arctic"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		create_country = {
			name = random
			government = fragmented_nations
			species = last_created
			ethos = {
				ethic = random
				ethic = random		
			}
			flag = random
			type = primitive
		}
		last_created_country = {
			
			random_list = {
				25 = { 
					set_country_flag = industrial_age 
					set_primitive_age = industrial_age
				}
				25 = { 
					set_country_flag = machine_age
					set_primitive_age = machine_age
				}
				25 = { 
					set_country_flag = atomic_age 
					set_primitive_age = atomic_age
				}
				25 = { 
					set_country_flag = early_space_age 
					set_primitive_age = early_space_age
				}
			}
		}
		create_colony = {
			owner = last_created_country
			species = last_created
			ethos = owner
		}
		random_tile = {
			limit = {
				has_blocker = no
				has_grown_pop = no
				has_growing_pop = no
			}
			create_pop = {
				species = last_created
				ethos = owner
			}
		}
		random_tile = {
			limit = {
				has_blocker = no
				has_grown_pop = no
				has_growing_pop = no
			}
			create_pop = {
				species = last_created
				ethos = owner
			}
		}
		random_tile = {
			limit = {
				has_blocker = no
				has_grown_pop = no
				has_growing_pop = no
			}
			create_pop = {
				species = last_created
				ethos = owner
			}
		}
		random_tile = {
			limit = {
				has_blocker = no
				has_grown_pop = no
				has_growing_pop = no
			}
			create_pop = {
				species = last_created
				ethos = owner
			}
		}
		random_tile = {
			limit = {
				has_blocker = no
				has_grown_pop = no
				has_growing_pop = no
			}
			create_pop = {
				species = last_created
				ethos = owner
			}
		}
		random_tile = {
			limit = {
				has_blocker = no
				has_grown_pop = no
				has_growing_pop = no
			}
			create_pop = {
				species = last_created
				ethos = owner
			}
		}
		
		last_created_country = {
			if = {
				limit = { has_country_flag = industrial_age }
				ROOT = {
					create_army = {
						name = "Industrial Army"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
					create_army = {
						name = "Industrial Army"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
				}
				break = yes
			}
			if = {
				limit = { has_country_flag = machine_age }
				ROOT = {
					create_army = {
						name = "Industrial Army"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
					create_army = {
						name = "Industrial Army"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
					create_army = {
						name = "Industrial Army"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
					create_army = {
						name = "Industrial Army"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
				}
				break = yes
			}
			if = {
				limit = { has_country_flag = atomic_age }
				ROOT = {
					create_army = {
						name = "Post-Atomic Army"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
					create_army = {
						name = "Post-Atomic Army"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
					create_army = {
						name = "Post-Atomic Army"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
					create_army = {
						name = "Post-Atomic Army"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
				}
				break = yes
			}
			if = {
				limit = { has_country_flag = early_space_age }
				ROOT = {
					create_army = {
						name = "Post-Atomic Army"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
					create_army = {
						name = "Post-Atomic Army"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
					create_army = {
						name = "Post-Atomic Army"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
					create_army = {
						name = "Post-Atomic Army"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
					create_army = {
						name = "Post-Atomic Army"
						owner = last_created
						species = last_created
						type = "postatomic_army"
					}
				}
				break = yes
			}
		}
		
		random_country = {
			limit = { is_ai = no }
			create_fleet = { name = "New Ships" }
			last_created_fleet = {
				set_owner = PREV
				create_ship = {
					name = "Constructor"
					design = "Constructor"
				}
				set_location = {
					target = ROOT
					distance = 25
					angle = random 
				}
			}
		}	
	}
}

# Primitive Civilization Medieval Test Event
planet_event = {
	id = henrik.246
	hide_window = yes
	
	trigger = {
		always = no
	}
	
	immediate = {
		change_pc = pc_continental
		if = {
			limit = { is_planet_class = pc_desert }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_desert"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		if = {
			limit = { is_planet_class = pc_tropical }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_tropical"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		if = {
			limit = { is_planet_class = pc_arid }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_arid"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		if = {
			limit = { is_planet_class = pc_continental }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_continental"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		if = {
			limit = { is_planet_class = pc_ocean }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_ocean"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		if = {
			limit = { is_planet_class = pc_tundra }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_tundra"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		if = {
			limit = { is_planet_class = pc_arctic }
			create_species = {
				name = random
				class = random
				portrait = random
				traits = {
					ideal_planet_class = "pc_arctic"
					trait = random_trait
					trait = random_trait
				}
			}
		}
		create_country = {
			name = random
			government = primitive_feudalism
			species = last_created
			ethos = {
				ethic = random
				ethic = random		
			}
			flag = random
			type = primitive
		}
		last_created_country = {
			
			random_list = {
				20 = { 
					set_country_flag = bronze_age 
					set_primitive_age = bronze_age
				}
				20 = { 
					set_country_flag = iron_age 
					set_primitive_age = iron_age
				}
				20 = { 
					set_country_flag = late_medieval_age 
					set_primitive_age = late_medieval_age
				}
				20 = { 
					set_country_flag = renaissance_age 
					set_primitive_age = renaissance_age
				}
				20 = { 
					set_country_flag = steam_age 
					set_primitive_age = steam_age
				}
			}
		}
		create_colony = {
			owner = last_created_country
			species = last_created
			ethos = owner
		}
		random_tile = {
			limit = {
				has_blocker = no
				has_grown_pop = no
				has_growing_pop = no
			}
			create_pop = {
				species = last_created
				ethos = owner
			}
		}
		random_tile = {
			limit = {
				has_blocker = no
				has_grown_pop = no
				has_growing_pop = no
			}
			create_pop = {
				species = last_created
				ethos = owner
			}
		}
		random_tile = {
			limit = {
				has_blocker = no
				has_grown_pop = no
				has_growing_pop = no
			}
			create_pop = {
				species = last_created
				ethos = owner
			}
		}
		
		last_created_country = {
			if = {
				limit = { has_country_flag = bronze_age }
				ROOT = {
					create_army = {
						name = "Primitive Army"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
				}
				break = yes
			}
			if = {
				limit = { has_country_flag = iron_age }
				ROOT = {
					create_army = {
						name = "Primitive Army"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
					create_army = {
						name = "Primitive Army"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
				}
				break = yes
			}
			if = {
				limit = { has_country_flag = late_medieval_age }
				ROOT = {
					create_army = {
						name = "Primitive Army"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
					create_army = {
						name = "Primitive Army"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
					create_army = {
						name = "Primitive Army"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
				}
				break = yes
			}
			if = {
				limit = { has_country_flag = renaissance_age }
				ROOT = {
					create_army = {
						name = "Primitive Army"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
					create_army = {
						name = "Primitive Army"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
					create_army = {
						name = "Primitive Army"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
					create_army = {
						name = "Primitive Army"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
				}
				break = yes
			}
			if = {
				limit = { has_country_flag = steam_age }
				ROOT = {
					create_army = {
						name = "Primitive Army"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
					create_army = {
						name = "Primitive Army"
						owner = last_created
						species = last_created
						type = "primitive_army"
					}
					create_army = {
						name = "Industrial Army"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
					create_army = {
						name = "Industrial Army"
						owner = last_created
						species = last_created
						type = "industrial_army"
					}
				}
				break = yes
			}
		}
		
		random_country = {
			limit = { is_ai = no }
			create_fleet = { name = "New Ships" }
			last_created_fleet = {
				set_owner = PREV
				create_ship = {
					name = "Constructor"
					design = "Constructor"
				}
				set_location = {
					target = ROOT
					distance = 25
					angle = random 
				}
			}
		}	
	}
}

planet_event = {
	id = henrik.250
	hide_window = yes

	trigger = {
		always = no
	}
	
	immediate = {
		owner = {
			country_event = { id = henrik.251 }
		}
	}
}

country_event = {
	id = henrik.251
	title = "henrik.251.name"
	desc = "henrik.251.desc"
	picture = GFX_evt_exploding_ship
	location = FROM
	
	is_triggered_only = yes
	
	option = {
		name = "henrik.251.a"
		capital_scope = {
			ROOT = {
				enable_special_project = {
					name = "TEST_PROJECT"
					location = PREV
				}
			}
		}
	}
}

# Project Succeeds
ship_event = {
	id = henrik.252
	title = "henrik.252.name"
	desc = "henrik.252.desc"
	picture = GFX_evt_outpost
	location = FROM
	
	is_triggered_only = yes
	
	option = {
		name = "henrik.252.a"
	}
}

# Project Fails
country_event = {
	id = henrik.253
	title = "henrik.253.name"
	desc = "henrik.253.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	
	is_triggered_only = yes
	
	option = {
		name = "henrik.253.a"
	}
}

ship_event = {
	id = henrik.254
	hide_window = yes
	
	trigger = {
		always = no
	}
	
	immediate = {
		leader = {
			set_age = 20
		}
	}
}

# Multi-option diplomacy
country_event = {
	id = henrik.255
	title = OK
	desc = OK
	diplomatic = yes

	trigger = {
		always = no
	}

	option = {
		name = OK
	}
	option = {
		name = OK
	}
	option = {
		name = OK
	}
	option = {
		name = OK
	}
	option = {
		name = OK
	}
}

# Event-spawned science ship
country_event = {
	id = henrik.260
	hide_window = yes

	trigger = {
		always = no
	}

	immediate = {
		capital_scope = { save_event_target_as = capital }
		save_event_target_as = owner_country
		create_fleet = { name = "Event Science Ship" }
		last_created_fleet = {
			set_owner = root
			create_ship_design = {
				design = "Prototype"
				ftl = event_target:owner_country
			}
			create_ship = {
				name = "Not Good At Surveying"
				design = last_created_design
				graphical_culture = "extra_dimensional_01"
				prefix = no
			}
			set_location = event_target:capital
		}
	}
}

#country_event = {
#	id = henrik.261
#	hide_window = yes
#
#	immediate = {
#		change_government = random
#	}
#}

#pop_event = {
#	id = henrik.270
#	is_triggered_only = yes
#	hide_window = yes
#	
#	immediate = {
#		owner = { enable_faction_of_type = slaves }
#		force_faction_evaluation = this
#		random_system = {
#			random_system = {
#				limit = { NOT = { is_same_value = PREV } }
#				PREVPREV = {
#					owner = {
#						clear_uncharted_space = {
#							from = PREVPREV
#							to = PREVPREVPREV
#							radius = 10
#						}
#					}
#				}
#			}
#		}
#	}
#}

## first contact
#country_event = {
#	id = henrik.666
#	title = "henrik.666.name"
#	desc = "henrik.666.desc"
#	picture = GFX_evt_exploding_ship
#	show_sound = event_ancient_drone
#	location = FROM
#	is_triggered_only = yes
#	
#	option = {
#		name = henrik.666.a
#		capital_scope = {
#			enable_special_project = {
#				name = "ESTABLISH_COMMUNICATIONS"
#				location = THIS
#				owner = ROOT
#			}
#		}
#	}
#}
#
## first contact special project research complete -> establish communication
#country_event = {
#	id = henrik.667
#	title = "henrik.667.name"
#	desc = "henrik.667.desc"
#	picture = GFX_evt_exploding_ship
#	show_sound = event_ancient_drone
#	is_triggered_only = yes
#
#	immediate = {
#		establish_communications = FROMFROMFROM
#		# TODO should also cancel the other countrys research!
#	}
#
#	option = {
#		name = OK
#	}
#}
#
#country_event = {
#	id = henrik.668
#	title = "henrik.668.name"
#	desc = "henrik.668.desc"
#	picture = GFX_evt_exploding_ship
#	is_triggered_only = yes
#	option = {
#		add_monthly_resource_mult = {
#			resource = minerals
#			value = 10.0
#		}
#	}
#}
#country_event = {
#	id = henrik.669
#	title = "henrik.669.name"
#	desc = "henrik.669.desc"
#	picture = GFX_evt_exploding_ship
#	is_triggered_only = yes
#	option = {
#		add_research_option = "tech_assault_armies"
#	}
#}


	#	country_event = {
	#		id = henrik.669
	#		title = "henrik.669.name"
	#		desc = "henrik.669.desc"
	#		picture = GFX_evt_exploding_ship
	#		is_triggered_only = yes
	#		option = {
	#			add_research_option = "tech_assault_armies"
	#		}
	#	}
	
country_event = {
	id = henrik.670
	title = "henrik.670.name"
	desc = "henrik.670.desc"
	picture = GFX_evt_exploding_ship
	
	trigger = {
		always = no
	}
	
	option = {
		create_leader = {
			type = governor
			species = owner_main_species
			name = random
			skill = 0
			traits = {}
		}
		last_created_leader = {
			save_event_target_as = pretender 
		}
		create_pop_faction = {
			type = pretender
			pop = unhappiest_pop
			parameter:pretender = event_target:pretender
		}
		last_created_pop_faction = {
			leader = {
				kill_leader = {
					type = governor
					show_notification = no
				}
			}
			assign_leader = event_target:pretender
		}
	}
}

planet_event = {
	id = henrik.671
	title = "TEST TITLE"
	desc = "TEST DESC"
	picture = GFX_evt_exploding_ship

	trigger = {
		always = no
	}

	immediate = {
		random_pop = {
			random_country = {
				limit = {
					opposing_ethics_divergence = {
						steps = 2
						who = prev
					}
				}
				save_event_target_as = divergent_country
			}
		}
	}

	option = {
		name = "CHECK TOOLTIP FOR DIVERGENT COUNTRY"
		event_target:divergent_country = {
			add_energy = 100
		}
	}
}

# country_event = {
# 	id = henrik.672
# 	title = "TEST TITLE"
# 	desc = "COUNT POP FACTIONS TEST, CHECK WHAT OPTIONS YOU HAVE"
# 	picture = GFX_evt_exploding_ship
# 
# 	trigger = {
# 		always = no
# 	}
# 
# 	option = {
# 		name = "NO SEPARATISTS IN EMPIRE"
# 		trigger = {
# 			count_pop_factions = {
# 				limit = { is_pop_faction_type = separatist }
# 				count < 1
# 			}
# 		}
# 	}
# 	option = {
# 		name = "1 SEPARATIST IN EMPIRE"
# 		trigger = {
# 			count_pop_factions = {
# 				limit = { is_pop_faction_type = separatist }
# 				count = 1
# 			}
# 		}
# 	}
# 	option = {
# 		name = "AT LEAST 2 SEPARATISTS IN EMPIRE"
# 		trigger = {
# 			count_pop_factions = {
# 				limit = { is_pop_faction_type = separatist }
# 				count > 2
# 			}
# 		}
# 	}
# }

planet_event = {
	id = henrik.673
	title =  "PIRATE BLITZ"
	desc = "PIRACY PAYS"
	picture = GFX_evt_exploding_ship

	trigger = {
		always = no
	}

	option = {
		name = "TEST1"
		custom_tooltip = mockup
	}

	option = {
		name = "TEST2"
		custom_tooltip = mockup2
	}

	option = {
		name = "HERE WE GO"
		create_country = {
			name = "Kriminals"
			type = faction
			name_list = "PRT2"
			auto_delete = yes
		}
		last_created_country = {
			create_leader = {
				type = admiral
				species = event_target:owner_species
				name = random
				skill = 100
			}
			create_fleet = { name = "Karim's Kurmudgeons" }
			last_created_fleet = {
				set_owner = PREV
				create_ship_design = {
					design = "Reaver"
				}
				create_ship = {
					name = random
					design = last_created_design
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = random
					design = last_created_design
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = random
					design = last_created_design
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = random
					design = last_created_design
					graphical_culture = "pirate_01"
				}
				create_ship = {
					name = random
					design = last_created_design
					graphical_culture = "pirate_01"
				}
				assign_leader = last_created_leader
				set_location = root
			}
		}
	}
}

ship_event = {
	id = henrik.674
	title =  "OTHER SPECIES LEADER TEST"
	desc = "PIRACY PAYS"
	picture = GFX_evt_exploding_ship

	trigger = { always = no }

	immediate = {
		owner = { save_event_target_as = empire set_timed_country_flag = { flag = day_0 days = 1 } }

		random_planet ={
			limit = {
				is_planet_class = pc_continental
				is_capital = no
				has_owner = no
			}
			save_event_target_as = WarriorHomePlanet
			create_species = {
				name = random
				class = ART
				portrait = random
				traits = random
	#			traits = {
	#				ideal_planet_class = this
	#				trait = random_trait
	#				trait = random_trait
	#			}
				homeworld = event_target:WarriorHomePlanet
			}
			create_country = {
				name = "Old Warriors"
				type = default
				government = despotic_empire
				species = last_created
				day_zero_contact = no
				ethos = {
					ethic = "ethic_xenophile"
					ethic = "ethic_militarist"
				}

				flag = random
	      	}
			last_created_country = {
				save_event_target_as = AlienWarriorSpecies
				set_timed_country_flag = { flag = day_0 days = 1 }
				establish_communications = root
			}
		}

	}

	option = {
		name = OK
		owner = { country_event = { id = henrik.675 } }
	}
}

country_event = {
	id = henrik.675
	title =  "OTHER SPECIES LEADER TEST"
	desc = "PIRACY PAYS"

	is_triggered_only = yes

	diplomatic = yes

	picture_event_data = {
		portrait = event_target:AlienWarriorSpecies
		planet_background = event_target:empire
		graphical_culture = event_target:empire
		city_level = event_target:empire
		room = event_target:empire
	}

	option = {
		name = anomaly.4157.a
#		response_text = anomaly.5013.a.response
#		is_dialog_only = yes

		country_event = {id = henrik.676 }
	}
}
#Dialogue 2
country_event = {
	id = henrik.676
	title = "anomaly.4155.name"
	desc = "anomaly.4158.desc"
	location = event_target:HomePlanet
	
	is_triggered_only = yes
	diplomatic = yes

	picture_event_data = {
		portrait = event_target:AlienWarriorSpecies
		planet_background = event_target:HomePlanet
		graphical_culture = event_target:HomePlanet
		city_level = event_target:HomePlanet
		room = event_target:HomeCountry
	}

	option = {
		name = OK
		#custom_tooltip = anomaly.4157.tooltip
		create_leader = {
			type = general
			species = event_target:AlienWarriorSpecies
			name = "General Mojito"
			skill = 1000
			traits = {
				trait = leader_trait_defender
				trait = leader_trait_charismatic
			}
		}
	}
	option = {
		name = NO
		#custom_tooltip = anomaly.4157.tooltip
	}
}

planet_event = {
	id = henrik.700
	title = ""
	desc = ""
	trigger = { always = no }
	hide_window = yes
	
	immediate = {
		closest_system = {
			min_steps = 0 #if <= 0 then the current system is also a potential match
			set_star_flag = closest_rank_0
		}
		closest_system = {
			limit = { always = yes }
			min_steps = 1
			max_steps = 1337
			set_star_flag = closest_rank_1
		}
		closest_system = {
			min_steps = 2
			set_star_flag = closest_rank_2
		}
		closest_system = {
			min_steps = 3
			set_star_flag = closest_rank_3
		}
		closest_system = {
			min_steps = 4
			set_star_flag = closest_rank_4
		}
		closest_system = {
			min_steps = 5
			set_star_flag = closest_rank_5
		}
		closest_system = {
			min_steps = 6
			set_star_flag = closest_rank_6
		}
		closest_system = {
			min_steps = 7
			set_star_flag = closest_rank_7
		}
		closest_system = {
			min_steps = 8
			set_star_flag = closest_rank_8
		}
		closest_system = {
			min_steps = 9
			set_star_flag = closest_rank_9
		}
		closest_system = {
			min_steps = 10
			set_star_flag = closest_rank_10
		}
	}
}

country_event = {
	id = henrik.701
	title = "test"
	desc = maxitest
	picture = GFX_evt_exploding_ship

	trigger = { always = no }

	option = {
		name = OK
	}
}


planet_event = {
	id = henrik.702
	title = "test"
	picture = "GFX_evt_exploding_ship"
	
	trigger = { always = no }
	
	desc = {
		trigger = {
			hidden:owner = {
				switch = {
					trigger = energy
					100 < { text = "energy_low" }
					100 = { text = "energy_stable" }
					default = { text = "energy_default" }
				}
			}
		}
	}
	
	option = {
		name = "OK"
	}
}

country_event = {
	id = henrik.703
	title = "RARE TECH"
	desc = "U GOT IT"
	picture = GFX_evt_exploding_ship

	trigger = { always = no }

	option = {
		name = OK
		add_research_option = tech_sentient_ai
	}
}

planet_event = {
	id = henrik.704
	title = "test"
	desc = "test"
	picture = GFX_evt_exploding_ship

	trigger = { always = no }
	
	immediate = {
		create_species = {
			name = "ROBOT_POP_SPECIES_2"
			class = "ROBOT"
			portrait = "robot1"
			traits = {
				trait = "trait_mechanical"
				trait = "trait_robotic_2"
			}
			
			pops_can_be_colonizers = yes
			pops_can_migrate = no
			pops_can_reproduce = no
			pops_can_join_factions = no
			pop_maintenance = 2.0     #remember to update localization :)
			can_generate_leaders = no
			pops_can_be_slaves = no
			can_be_modified = no
			pops_have_happiness = no
			pop_ethics = no
		}
	}

	option = {
		name = OK
		create_pop = {
			species = "ROBOT_POP_SPECIES_2"
			ethos = owner 
		}
	}
}

country_event = {
	id = henrik.1337
	title = "LOL WIN"
	desc = "YOU WANT?"
	picture = GFX_evt_exploding_ship

	trigger = { always = no }

	option = {
		name = DOMINATION
		hidden_effect = {
			every_planet = {
				limit = {
					is_colonizable = yes
				}
				set_owner = PREV
			}
		}
	}
	option = {
		name = CONQUEST
		hidden_effect = {
			every_country = {
				limit = { NOT = { is_same_empire = PREV } is_country_type = default }
				set_subject_of = {
					who = PREV
					subject_type = vassal
				}
			}
		}
	}
}

planet_event = {
	id = henrik.705
	hide_window = yes

	trigger = { always = no }

	immediate = {
		every_tile = {
			remove_blocker = yes
			kill_pop = yes
			create_species = {
				name = random
				class = random
				portrait = random
				traits = random
			}
			create_pop = {
				species = last_created_species
			}
		}
	}
}

planet_event = {
	id = henrik.706
	hide_window = yes

	trigger = { always = no }

	immediate = {
		every_tile = {
			planet = {
				owner = {
					every_owned_leader = {
						kill_leader = { show_notification = no }
					}
					create_species = {
						name = random
						class = random
						portrait = random
						traits = random
					}
					create_leader = {
						type = scientist
						species = last_created_species
						name = random
						skill = 0
					}
					create_leader = {
						type = admiral
						species = last_created_species
						name = random
						skill = 0
					}
					create_leader = {
						type = general
						species = last_created_species
						name = random
						skill = 0
					}
					create_leader = {
						type = governor
						species = last_created_species
						name = random
						skill = 0
					}
				}
			}
		}
	}
}

country_event = {
	id = henrik.707
	title = "LOL WIN"
	desc = "YOU WANT?"
	picture = GFX_evt_exploding_ship

	trigger = { always = no }

	option = {
		name = OK
		trigger = {
			count_tech_options = { area = physics count = 0 }
		}
	}
	
	option = {
		name = CONQUEST
		trigger = {
			count_tech_options = { area = physics count > 0 }
		}
	}
}

#country_event = {
#	id = henrik.708
#	title = "WHAT DAY IS IT"
#	desc = "WHAT YEAR"
#	picture = GFX_evt_exploding_ship
#
#	mean_time_to_happen = { days = 1 }
#
#	trigger = {
#		capital_scope = {
#			colony_age > 2
#			colony_age < 6
#		}
#		NOT = { has_country_flag = delay }
#	}
#
#	option = {
#		name = OK
#		set_timed_country_flag = { flag = delay days = 30 }
#	}
#}

#country_event = {
#	id = henrik.708
#	title = "LOL WIN"
#	desc = "YOU WANT?"
#	picture = GFX_evt_exploding_ship
#
#	is_triggered_only = yes
#	
#	trigger = {
#		last_increased_tech = "tech_space_construction"
#		last_increased_tech = {
#			tech = "tech_space_construction"
#			level > 0
#		}
#	}
#
#	option = {
#		name = OK
#	}
#}

country_event = {
	id = henrik.709
	title = "trigger icons"
	desc = "there should be an icon on each option"
	picture = GFX_evt_exploding_ship
diplomatic = yes
	trigger = { always = no }

	option = {	
		name = "ethics1"	
		trigger = {
			has_ethic = "ethic_fanatic_collectivist"
		}
	}
	option = {	
		name = "ethics2"	
		trigger = {
			has_ethic = "ethic_collectivist"
		}
	}
	option = {	
		name = "ethics3"	
		trigger = {
			has_ethic = "ethic_fanatic_individualist"
		}
	}
	option = {	
		name = "ethics4"	
		trigger = {
			has_ethic = "ethic_individualist"
		}
	}
	option = {	
		name = "ethics5"	
		trigger = {
			has_ethic = "ethic_fanatic_xenophobe"
		}
	}
	option = {	
		name = "ethics6"	
		trigger = {
			has_ethic = "ethic_xenophobe"
		}
	}
	option = {	
		name = "ethics7"	
		trigger = {
			has_ethic = "ethic_fanatic_xenophile"
		}
	}
	option = {	
		name = "ethics8"	
		trigger = {
			has_ethic = "ethic_xenophile"
		}
	}
	option = {	
		name = "ethics9"	
		trigger = {
			has_ethic = "ethic_fanatic_militarist"
		}
	}
	option = {	
		name = "ethics10"	
		trigger = {
			has_ethic = "ethic_militarist"
		}
	}
	option = {	
		name = "ethics11"	
		trigger = {
			has_ethic = "ethic_fanatic_pacifist"
		}
	}
	option = {	
		name = "ethics12"	
		trigger = {
			has_ethic = "ethic_pacifist"
		}
	}
	option = {	
		name = "ethics13"	
		trigger = {
			has_ethic = "ethic_fanatic_spiritualist"
		}
	}
	option = {	
		name = "ethics14"	
		trigger = {
			has_ethic = "ethic_spiritualist"
		}
	}
	option = {	
		name = "ethics15"	
		trigger = {
			has_ethic = "ethic_materialist"
		}
	}
	option = {	
		name = "ethics16"	
		trigger = {
			has_ethic = "ethic_fanatic_materialist"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government = "military_dictatorship"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government = "martial_empire"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government = "divine_mandate"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government = "despotic_hegemony"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government = "ai_overlordship"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government = "enlightened_monarchy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government = "irenic_monarchy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government = "despotic_empire"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government = "star_empire"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government = "military_junta"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="ordered_stratocracy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="theocratic_oligarchy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="transcendent_oligarchy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="science_directorate"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="illuminated_technocracy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="peaceful_bureaucracy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="irenic_protectorate"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="plutocratic_oligarchy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="mega_corporation"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="military_republic"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="martial_demarchy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="theocratic_republic"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="transcendent_republic"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="direct_democracy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="subconscious_consensus"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="moral_democracy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="irenic_democracy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="indirect_democracy"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="democratic_utopia"
		}
	}
	option = {
		name = "gov"
		trigger = {
			has_government ="primitive_feudalism"
		}
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_rapid_breeders" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_slow_breeders" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_charismatic" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_repugnant" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_talented" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_strong" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_weak" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_communal" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_solitary" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_adaptive" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_nonadaptive" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_nomadic" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_sedentary" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_quick_learners" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_slow_learners" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_thrifty" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_industrious" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_natural_engineers" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_natural_physicists" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_natural_sociologists" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_uplifted" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_conformists" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_enduring" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_decadent" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_intelligent" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_agrarian" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_resilient" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_mechanical" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_robotic_1" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_robotic_2" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_robotic_3" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_presentient_starborn" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_presentient_earthbound" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_presentient_natural_intellectuals" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_presentient_proles" }
	}
	option = {
		name = "trait"
		trigger = { has_trait = "trait_presentient_conservative" }
	}
}

# SOUND TEST
country_event = {
	id = henrik.750
	title = "Sound Test"
	desc = "TESTING. 1... 2... 3..."
	picture = GFX_evt_psionics
	show_sound = event_activating_unknown_technology
	
	trigger = { 
		always = no 
	}

	option = {
		name = "Is this thing on?"
	}
}

# TEST
country_event = {
	id = henrik.760
	title = "Test"
	desc = "TESTING. 1... 2... 3..."
	picture = GFX_evt_psionics
	show_sound = event_activating_unknown_technology
	
	trigger = { 
		always = no 
	}

	option = {
		name = "OK"
		capital_scope = {
			solar_system = {
				create_ambient_object = {
					type = "injured_queen_object"
					location = solar_system
				}
				last_created_ambient_object = { save_event_target_as = injured_queen }
				create_ambient_object = {
					type = "dead_swarm_small_object"
				}
				last_created_ambient_object = { 
					set_location = {
						target = event_target:injured_queen
						distance = 5
						angle = 40
					}
				}
				create_ambient_object = {
					type = "dead_swarm_large_object"
				}
				last_created_ambient_object = { 
					set_location = {
						target = event_target:injured_queen
						distance = 5
						angle = 240
					}
					set_ambient_object_flag = manufactory
				}
				
				random_system_ambient_object = {
					limit = { has_ambient_object_flag = manufactory }
					destroy_ambient_object = this
				}
			}
		}
	}
}

country_event = {
	id = henrik.710
	title = "BIG BOOL"
	desc = "NOT = { X Y } means one false or more || AND={NOT={X} NOT={Y}} means both need to be false"
	picture = GFX_evt_psionics
	show_sound = event_activating_unknown_technology

	trigger = { always = no }

	option = {
		name = "OR = { not = {bool1} not = {bool2} }"
	}

	option = {
		name = "NOT = { bool1 bool2 } triggered"
		trigger = {
			NOT = {
				has_country_flag = bool1
				has_country_flag = bool2
			}
		}
	}

	option = {
		name = "NOT = { OR = { bool 1 bool 2 } }"
		trigger = {
			NOT = {
				OR = {
					has_country_flag = bool1
					has_country_flag = bool2
				}
			}
		}
	}

	option = {
		name = "NOT={AND={bool1 bool2}} triggered"
		trigger = {
			NOT = {
				AND = { has_country_flag = bool1 has_country_flag = bool2 }
			}
		}
	}

	option = {
		name = "AND={NOT={bool1}NOT={bool2}} triggered"
		trigger = {
			AND = {
				NOT = { has_country_flag = bool1 }
				NOT = { has_country_flag = bool1 }
			}
		}
	}

	option = {
		name = "you have one flag set"
		trigger = {
			OR = { has_country_flag = bool1 has_country_flag = bool2 }
		}
	}

	option = {
		name = "you have two flags set"
		trigger = {
			AND = { has_country_flag = bool1 has_country_flag = bool2 }
		}
	}
}

# enable/disable bool1
country_event = {
	id = henrik.711
	title = "BIG BOOL FLAGS"
	desc = "set flags checked in henrik.710"
	picture = GFX_evt_psionics
	show_sound = event_activating_unknown_technology

	trigger = { always = no }

	option = {
		name = "set bool1"
		set_country_flag = bool1
	}

	option = {
		name = "set bool2"
		set_country_flag = bool2
	}

	option = {
		name = "remove bool1"
		remove_country_flag = bool1
	}

	option = {
		name = "remove bool2"
		remove_country_flag = bool2
	}
}

#country_event = {
#	id = henrik.712
#	title = "IS YOUR COLONY 5 YEARS OLD HUH"
#	desc = "WELL IS IT"
#	picture = GFX_evt_psionics
#	show_sound = event_activating_unknown_technology
#
#	trigger = {
#		capital_scope = { colony_age > 60 }
#	}
#
#	mean_time_to_happen = { days = 1 }
#
#	fire_only_once = yes
#
#	option = {
#		name = "maybe"
#	}
#}

ship_event = {
	id = henrik.713
	hide_window = yes

	trigger = { always = no }

	immediate = {
		owner = {
			capital_scope = {
				enable_special_project = {
					name = "MANUFACTORY_PROJECT"
					location = this
					owner = root
				}
			}
		}
	}
}

country_event = {
	id = henrik.714
	title = "ambient objects"
	desc = "create and destroy ambient objects in your capital system to test random_system_ambient_object, limits and flags"
	picture = GFX_evt_psionics
	show_sound = event_activating_unknown_technology

	trigger = { always = no }

	option = {
		name = "create two objects, one flagged one not"
		capital_scope = {
			solar_system = {
				create_ambient_object = {
				type = "crystal_manufactory_object"
				location = this
				}
				last_created_ambient_object = {
					set_ambient_object_flag = manufactory
				}
				create_ambient_object = {
					type = "crystal_manufactory_object"
					location = this
				}
			}
		}
	}

	option = {
		name = "destroy flagged object"
		capital_scope = {
			solar_system = {
				random_system_ambient_object = {
					limit = { has_ambient_object_flag = manufactory }
					destroy_ambient_object = this
				}
			}
		}
	}

	option = {
		name = "destroy unflagged object"
		capital_scope = {
			solar_system = {
				random_system_ambient_object = {
					limit = { NOT = { has_ambient_object_flag = manufactory } }
					destroy_ambient_object = this
				}
			}
		}
	}
}

country_event = {
	id = henrik.810
	title = "korv"
	desc = "mums"
	picture = GFX_evt_psionics
	trigger = { always = no }
	
	option = {
		name = "magamaga"
		capital_scope = {
			save_event_target_as = caplol
		}
		random_country = {
			limit = { is_hostile = prev }
			set_aggro_range = 20
			create_fleet = { name = "aggro def(20)" }
			last_created_fleet = {
				set_owner = PREV				
				set_fleet_stance = aggressive	
				set_aggro_range_measure_from = self			
				create_ship = {	name = "putte"	design = "Swarm Large"	}
				set_location = {
					target = event_target:caplol
					distance = 100
					angle = random 
				}
			}
			create_fleet = { name = "aggro 40" }
			last_created_fleet = {
				set_owner = PREV				
				set_aggro_range = 40
				set_fleet_stance = aggressive
				set_aggro_range_measure_from = self
				create_ship = {	name = "putte"	design = "Swarm Large"	}
				set_location = {
					target = event_target:caplol
					distance = 100
					angle = random 
				}
			}
			create_fleet = { name = "aggro 60" }
			last_created_fleet = {
				set_owner = PREV				
				set_aggro_range = 60
				set_fleet_stance = aggressive
				set_aggro_range_measure_from = return_point	
				create_ship = {	name = "putte"	design = "Swarm Large"	}
				set_location = {
					target = event_target:caplol
					distance = 100
					angle = random 
				}
			}
			create_fleet = { name = "aggro 80" }
			last_created_fleet = {
				set_owner = PREV				
				set_aggro_range = 80
				set_fleet_stance = aggressive	
				set_aggro_range_measure_from = return_point				
				create_ship = {	name = "putte"	design = "Swarm Large"	}
				set_location = {
					target = event_target:caplol
					distance = 100
					angle = random 
				}
			}
		}
	}
}

country_event = {
	id = henrik.811
	hide_window = yes
	picture = GFX_evt_psionics
	trigger = { always = no }
	
	immediate = {
		capital_scope = {
			solar_system = {
				random_system_planet = {
					limit = { is_capital = no }
					save_event_target_as = spawnpoint
					create_country = {
						name = "Test"
						type = crystal
					}
					last_created_country = {
						create_fleet = { name = "test fleet"}
						last_created_fleet = {
							set_fleet_stance = aggressive
							set_aggro_range_measure_from = self
							set_aggro_range = 800
							set_owner = PREV
							create_ship = {
								name = "Delta"
								design = "Large Crystal Entity Blue"
							}
							set_location = event_target:spawnpoint
							queue_actions = {
								repeat = {
									wait = {
										duration = 999
										random = 10
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

country_event = {
	id = henrik.812
	hide_window = yes

	trigger = { always = no }

	immediate = {
		random_country = {
			limit = {
				is_country_type = default
				is_ai = yes
			}
			save_event_target_as = other_party
		}
		country_event = { id = henrik.813 }
	}
}

country_event = {
	id = henrik.813
	title = "DIPLOMACY DIALOGUE WINDOW"
	desc = "SCRIPTED EVENT WITH DIALOGUE OPTIONS"

	is_triggered_only = yes

	diplomatic = yes

	picture_event_data = {
		portrait = event_target:other_party
		planet_background = event_target:other_party
		graphical_culture = event_target:other_party
		city_level = event_target:other_party
		room = event_target:other_party
	}

	option = {
		name = "OPTION 1"
	}
	option = {
		name = "OPTION 2"
	}
	option = {
		name = "OPTION 3"
	}
}

planet_event = {
	id = henrik.814
	hide_window = yes

	trigger = {
		always = no
	}
	
	immediate = {
		random_tile = {
			limit = {
				has_building = yes
				is_ruined = yes
			}
			set_ruined = no
		}
		random_tile = {
			limit = {
				has_building = yes
				is_ruined = no
			}
			set_ruined = yes
		}
	}
}

ship_event = {
	id = henrik.815
	title = "UNASSIGNING SHIP LEADER"
	desc = "UNASSIGNING SHIP LEADER"
	picture = GFX_evt_psionics

	trigger = { always = no }

	option = {
		name = "FROM SHIP"
		leader = {
			unassign_leader = this
		}
	}

	option = {
		name = "FROM FLEET"
		fleet = { leader = { unassign_leader = this } }
	}
}

country_event = {
	id = henrik.816
	title = "POINT OF INTEREST TEST"
	desc = "CAN I HAZ 'LAST KNOWN LOCATION' POINT OF INTEREST?"
	picture = GFX_evt_psionics

	trigger = { always = no }

	option = {
		trigger = {
			any_system = {
				has_point_of_interest = {
					id = scientist_poi.1
					event_chain = rogue_scientist_1_chain
					owner = root
				}
			}
		}
		name = YEP
	}

	option = {
		trigger = {
			NOT = {
				any_system = {
					has_point_of_interest = {
						id = scientist_poi.1
						event_chain = rogue_scientist_1_chain
						owner = root
					}
				}
			}
		}
		name = NOPE
	}
}

country_event = {
	id = henrik.817
	hide_window = yes
	
	is_triggered_only = yes
	
	abort_trigger = {
		always = yes
	}
	
	abort_effect = {
		add_energy = 50
	}
	
	immediate = {
		add_energy = 100
	}
}

country_event = {
	id = henrik.818
	hide_window = yes
	
	trigger = {
		always = no
	}
	
	immediate = {
		country_event = { id = henrik.817 days = 10 }
	}
}

country_event = {
	id = henrik.819
	title = "TUTORIAL LEVEL"
	desc = "VILKEN HAR JAG?"
	picture = GFX_evt_psionics

	trigger = {
		always = no
	}

	option = {
		name = LEVEL0
		trigger = {
			is_tutorial_level = 0
		}
	}
	option = {
		name = LEVEL1
		trigger = {
			is_tutorial_level = 1
		}
	}
	option = {
		name = LEVEL2
		trigger = {
			is_tutorial_level = 2
		}
	}
	option = {
		name = BORKEN
		trigger = {
			NOT = {
				is_tutorial_level = 2
				is_tutorial_level = 1
				is_tutorial_level = 0
			}
		}
	}
}

country_event = {
	id = henrik.820
	hide_window = yes
	
	trigger = {
		always = no
	}
	
	immediate = {
		change_country_flag = {
			icon = {
				category = "spherical"
				file = "flag_spherical_22.dds"
			}
			background= {
				category = "backgrounds"
				file = "new_dawn.dds"
			}
			colors={
				"turquoise"
				"green"
				"null"
				"null"
			}
		}
	}
}

country_event = {
	id = henrik.821
	hide_window = yes
	
	trigger = {
		always = no
	}
	
	immediate = {
		change_country_flag = random
	}
}

# fleet actions test
#country_event = {
#	id = henrik.822
#	hide_window = yes
#
#	trigger = { always = no }
#
#	immediate = {
#		capital_scope = {
#			solar_system = {
#				save_event_target_as = cap_sys
#				random_system_planet = {
#					limit = { is_asteroid = yes }
#					save_event_target_as = pirate_home
#					create_country = {
#						name = "Pirates"
#						type = neutral_faction
#						species = event_target:owner_species
#						name_list = "PRT1"
#						flag = {
#							icon = {
#								category = "pirate"
#								file = "flag_pirate_7.dds"
#							}
#							background = {
#								category = "backgrounds"
#								file = "00_solid.dds"
#							}
#							colors ={
#								"red"
#								"red"
#								"null"
#								"null"
#							}
#						}
#					}
#					last_created_country = {
#						set_name = random
#						save_event_target_as = pirate_band
#						set_relation_flag = {
#							who = ROOT
#							flag = pirate_relation
#						}
#						establish_communications = ROOT
#						
#						create_fleet = { name = "Pirate Station" #}
#						last_created_fleet = {
#							set_owner = PREV
#							create_ship = {
#								name = random
#								design = "Pirate Lair"
#								graphical_culture = "pirate_01"
#							}
#							set_location = PREVPREV
#						}
#						create_leader = {
#							type = admiral
#							species = owner_main_species
#							name = random
#							skill = 100
#						}
#						create_fleet = { name = "Pirate Fleet" }
#						last_created_fleet = {
#							set_fleet_stance = passive
#							set_aggro_range_measure_from = self
#							set_aggro_range = 0
#							set_owner = PREV
#							create_ship_design = {
#								design = "Reaver"
#								ftl = ROOT
#							}
#							create_ship = {
#								name = random
#								design = last_created_design
#								graphical_culture = "pirate_01"
#							}
#							create_ship = {
#								name = random
#								design = last_created_design
#								graphical_culture = "pirate_01"
#							}
#							create_ship = {
#								name = random
#								design = last_created_design
#								graphical_culture = "pirate_01"
#							}
#							assign_leader = last_created_leader
#							set_location = PREVPREV
#							
#							queue_actions = {
#								repeat = {
#									find_random_system = {
#										trigger = {
#											id = "pirate.test.#trigger.1"
#											NOT = { 
#												has_star_flag = #hostile_system 
#												is_same_value = e#vent_target:cap_s#ys
#											}
#											#any_planet = {
#											#	OR = {
#											#		#has_mining_station = #yes
#											#		#has_research_station #= yes
#											#	}
#											#	exists = #controller
#											#	controller = { #is_same_value = event#_target:pirate_target# }
#											#}
#											distance = {
#												source = PREV
#												max_distance = 50
#												min_distance = 5
#											}
#										}
#										found_system = {
#											move_to = THIS
#										}	
#									}
#									find_closest_planet = {
#										trigger = {
#											id = "pirate.test.#trigger.2"
#											is_star = yes
#										}
#										found_planet = {
#											orbit_planet = THIS
#											wait = {
#												duration = 20
#											}
#										}
#									}
#									find_random_system = {
#										trigger = {
#											id = "pirate.test.#trigger.3"
#											is_same_value = #event_target:cap_sys
#										}
#										found_system = {
#											move_to = THIS
#										}	
#									}
#									find_closest_planet = {
#										trigger = {
#											id = "pirate.test.#trigger.4"
#											is_star = yes
#										}
#										found_planet = {
#											orbit_planet = THIS
#											wait = {
#												duration = 200
#												random = 150
#											}
#										}
#									}
#								}
#							}
#						}
#					}
#				}
#			}
#		}
#	}
#}

# EXD Diplo test
#country_event = {
#	id = henrik.823
#	title = "crisis.1010.name"
#	desc = "crisis.1010.desc"
#	
#	diplomatic = yes
#	
#	picture_event_data = {
#		portrait = exd1
#		room = "extradimensional_room"
#	}
#	
#	trigger = { always = no }
#	
#	option = {
#		name = crisis.1010.a
#	}
#}
#
#planet_event = {
#	id = henrik.824
#	hide_window = yes
#
#	trigger = { always = no }
#
#	immediate = {
#		owner = {
#			switch = {
#				trigger = has_ethic
#
#				ethic_fanatic_xenophile = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = #"ethic_fanatic_xenophobe"
#								ethic = "ethic_militarist"
#							}
#							flag = random
#						}
#					}
#				}
#
#				ethic_fanatic_xenophobe = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = #"ethic_fanatic_xenophile"
#								ethic = "ethic_militarist"
#							}
#							flag = random
#						}
#					}
#				}
#
#				ethic_fanatic_pacifist = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = #"ethic_fanatic_militarist"
#								ethic = #"ethic_materialist"
#							}
#							flag = random
#						}
#					}
#				}
##
#				ethic_fanatic_militarist = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = #"ethic_fanatic_pacifist"
#								ethic = #"ethic_spiritualist"
#							}
#							flag = random
#						}
#					}
#				}
##
#				ethic_fanatic_materialist = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = "ethic_fanatic_spi#ritualist"
#								ethic = "ethic_militarist"
#							}
#							flag = random
#						}
#					}
#				}
##
#				ethic_fanatic_spiritualist = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = "ethic_fanatic_mat#erialist"
#								ethic = "ethic_militarist"
#							}
#							flag = random
#						}
#					}
#				}
##
#				ethic_fanatic_individualist = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = "ethic_fanatic_col#lectivist"
#								ethic = "ethic_militarist"
#							}
#							flag = random
#						}
#					}
#				}
##
#				ethic_fanatic_collectivist = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = "ethic_fanatic_ind#ividualist"
#								ethic = "ethic_militarist"
#							}
#							flag = random
#						}
#					}
#				}
#
#				ethic_collectivist = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = random
#								ethic = random
#							}
#							flag = random
#						}
#					}
#				}
#				ethic_individualist = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = random
#								ethic = random
#							}
#							flag = random
#						}
#					}
#				}
#				ethic_materialist = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = random
#								ethic = random
#							}
#							flag = random
#						}
#					}
#				}
#				ethic_spiritualist = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = random
#								ethic = random
#							}
#							flag = random
#						}
#					}
#				}
#				ethic_xenophile = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = random
#								ethic = random
#							}
#							flag = random
#						}
#					}
#				}
#				ethic_xenophobe = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = random
#								ethic = random
#							}
#							flag = random
#						}
#					}
#				}
#				ethic_pacifist = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = random
#								ethic = random
#							}
#							flag = random
#						}
#					}
#				}
#				ethic_militarist = {
#					root = {
#						create_rebels = {
#							name = random
#							government = random
#							species = prev
#							ethos = {
#								ethic = random
#								ethic = random
#							}
#							flag = random
#						}
#					}
#				}
#			}
#		}
#		last_created_country = {
#			add_war_demand = {
#				type = "liberate_country"
#				parameter:country = this
#				warscore_cost = 50
#				target = this
#			}
#		}
#		every_owned_pop = {
#			root = {
#				create_army = {
#					owner = last_created
#					species = prev
#					type = "defense_army"
#				}
#			}
#		}
#	}
#}
#
#planet_event = {
#	id = henrik.825
#	hide_window = yes
#
#	trigger = { always = no }
#
#	immediate = {
#		random_pop = {
#			limit = { planet = { is_same_value = root } }
#			pop_event = { id = pop.1 }
#		}
#	}
#}

#planet_event = {
#	id = henrik.826
#	hide_window = yes
#
#	trigger = { always = no }
#
#	immediate = {
#		every_tile = {
#			create_pop = {
#				species = owner_main_species
#				ethos = owner_main_species
#			}
#		}
#	}
#}

country_event = {
	id = henrik.827
	hide_window = yes

	trigger = { always = no }

	immediate = {
		change_country_flag = random
	}
}

country_event = {
	id = henrik.828
	title = "UNASSIGNING SHIP LEADER"
	desc = "UNASSIGNING SHIP LEADER"
	picture = GFX_evt_psionics
	show_sound = advisor_notification_alien_vessel_encountered

	trigger = { always = no }

	option = {
		name = OK
	}
}

planet_event = {
	id = henrik.829
	title = "REBEL"
	desc = "RABBLE"
	picture = GFX_evt_psionics
	show_sound = advisor_notification_alien_vessel_encountered

	trigger = { always = no }

	immediate = {
		create_rebels = {
			name = random
			government = random
			species = random
			ethos = random
			flag = random
		}
		last_created_country = {
			save_event_target_as = rebel_country
			add_war_demand = {
				type = "liberate_country"
				parameter:country = this
				warscore_cost = 50
				target = this
			}
		}
		every_owned_pop = {
			planet = {
				create_army = {
					owner = last_created
					species = prev
					type = "defense_army"
				}
			}
		}
	}

	option = {
		name = ok
	}
}

# Blorg Colony Event Killer
country_event = {
	id = henrik.999
	hide_window = yes

	trigger = { always = no }

	immediate = {
		every_owned_planet = { set_planet_flag = colony_event }
		if = {
			limit = {
				any_owned_planet = {
					has_planet_flag = pheromone_planet
				}
			}
			random_owned_planet = {
				limit = {
					has_planet_flag = pheromone_planet
				}
				remove_planet_flag = pheromone_planet
			}
		}
	}
}

#country_event = {
#	id = henrik.830
#	title = "TEN SHIPS"
#	desc = "TEN WHOLE SHIPS"
#	picture = GFX_evt_psionics
#	show_sound = advisor_notification_alien_vessel_encountered
#
#	trigger = {
#		num_ships > 9
#	}
#
#	fire_only_once = yes
#
#	mean_time_to_happen = { days = 1 }
#
#	option = {
#		name = OK
#	}
#}

country_event = {
	id = henrik.831
	hide_window = yes

	trigger = { always = no }

	immediate = {
		every_planet = {
			limit = {
				has_planet_flag = stone_age_primitives
			}
			planet_event = { id = primitive.30 }
		}
	}
}

planet_event = {
	id = henrik.832
	hide_window = yes

	trigger = { always = no }

	immediate = {
		create_species = {
			name = "Prethoryn"
			class = SWARM
			portrait = random
			traits = random
			immortal = yes
		}
		create_country = {
			name = "Prethoryn Scourge"
			type = "swarm"
			species = last_created
			name_list = "Prethoryn"
			flag = {
				icon= {
					category = "special"
					file = "the_swarm.dds"
				}
				background= {
					category = "backgrounds"
					file = "new_dawn.dds"
				}
				colors={
					"orange"
					"grey"
					"null"
					"null"
				}
			}
		}
		every_country = {
			limit = { is_country_type = default }
			establish_communications_no_message = last_created_country
			add_opinion_modifier = {
				who = last_created_country
				modifier = opinion_swarm
			}
			last_created_country = {
				add_opinion_modifier = {
					who = PREV
					modifier = opinion_prey
				}
			}
		}
		last_created_country = {
			save_event_target_as = prethoryn
			owner_species = { save_event_target_as = prethoryn_species }
		}
		# Army Transports
		create_fleet = { name = "Prethoryn Armies" }
		last_created_fleet = {
			set_owner = event_target:prethoryn
			create_army_transport = {
				ship_name = "Prethoryn Transport"
				graphical_culture = "swarm_01"
				army_name = "Prethoryn Invaders"
				army_type = "swarm_army"
				species = event_target:prethoryn_species
			}
			create_army_transport = {
				ship_name = "Prethoryn Transport"
				graphical_culture = "swarm_01"
				army_name = "Prethoryn Invaders"
				army_type = "swarm_army"
				species = event_target:prethoryn_species
			}
			create_army_transport = {
				ship_name = "Prethoryn Transport"
				graphical_culture = "swarm_01"
				army_name = "Prethoryn Invaders"
				army_type = "swarm_army"
				species = event_target:prethoryn_species
			}
			set_location = {
				target = root
				distance = 35
				angle = random 
			}
		}
	}
}

planet_event = {
	id = henrik.833
	hide_window = yes

	trigger = { always = no }

	immediate = {
		create_crystal_country = yes
		event_target:crystal_country = {
			create_fleet = { name = "Crystalline Entity" }
			last_created_fleet = {
				set_fleet_stance = aggressive
				set_aggro_range_measure_from = self
				set_aggro_range = 150
				set_owner = event_target:crystal_country
				create_ship = {
					name = "Delta"
					design = "Large Crystal Entity Blue"
				}
				create_ship = {
					name = "Epsilon"
					design = "Medium Crystal Entity Blue"
				}
				create_ship = {
					name = "Omega"
					design = "Small Crystal Entity Blue"
				}
				set_location = root
			}
		}
	}
}

country_event = {
	id = henrik.834
	hide_window = yes

	trigger = { always = no }

	immediate = {
		every_country = {
			limit = {
				is_country_type = swarm
			}
			add_modifier = {
				modifier = swarm_border
				days = -1
			}
		}
	}
}

country_event = {
	id = henrik.835
	hide_window = yes

	trigger = { always = no }

	immediate = {
		every_owned_pop = {
			limit = {
				exists = pop_faction
			}
			pop_faction = {
				add_support = 100
			}
		}
	}
}

planet_event = {
	id = henrik.836
	hide_window = yes

	trigger = {
		always = no
	}

	immediate = {
		random_country = {
			limit = {
				is_country_type = default
			}
			establish_communications_no_message = root.owner
			establish_contact = { who = root.owner location = root }
			save_event_target_as = other_country
		}
		change_pc = pc_infested
		set_planet_max_health = 800
		set_planet_health = 800
		set_owner = event_target:other_country
	}
}