namespace = EADI

narrative_event = {#Have your heard about High Elves?
	id = EADI.1
	title = "EVTNAME_EADI_002"
	desc = "EVTDESC_EADI_002"
	picture = GFX_evt_elven_ships
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	show_root = no
	hide_from = yes
	
	trigger = {
		OR = {
			AND = {
				has_game_rule = {
					name = fantasy_invasion
					value = random
				}
				total_years_played = 50
			}
			AND = {
				has_game_rule = {
					name = fantasy_invasion
					value = delayed_random
				}
				total_years_played = 100
			}
			AND = {
				has_game_rule = {
					name = fantasy_invasion
					value = immediatly
				}
			}
		}
		NOR = { 
			year = 3000
			has_game_rule = {
				name = fantasy_invasion
				value = off
			}
		}
		controls_religion = yes # Let it happen for the Pope. He's always around.
		NOR = {
			has_global_flag = elves_britain
			has_global_flag = elves_france
			has_global_flag = elves_german
#			has_global_flag = elves_russia
		}
	}
	weight_multiplier = {
		days = 1
		modifier = {
			factor = 1.5
			year = 1100
		}
		modifier = {
			factor = 5
			year = 1115
		}
		modifier = {
			factor = 100 #If game has historical rule, ensure that the Mongol Invasion WILL happen when the time comes.
			has_game_rule = {
				name = fantasy_invasion
				value = historical
			}
		}
		modifier = {
			factor = 0.5
			has_game_rule = {
				name = fantasy_invasion
				value = random
			}
			NOT = { total_years_played = 100 }
		}
		modifier = {
			factor = 0.5
			has_game_rule = {
				name = fantasy_invasion
				value = random
			}
		}
		modifier = {
			factor = 0.6
			has_game_rule = {
				name = fantasy_invasion
				value = delayed_random
			}
		}
	}
	
	immediate = {
		random_list = {
			33 = {
				set_global_flag = elves_britain
			}
			33 = {
				set_global_flag = elves_france
			}
			33 = {
				set_global_flag = elves_german
			}
#			25 = {
#				set_global_flag = elves_russia
#			}
		}
		activate_title = { title = e_elven_empire status = yes }			
		create_character = {
			dynasty = 1256001 # Fenorion
			name = Fenor
			culture = high_elven
			religion = elven
			age = 30
		    attributes = {
	    	    martial = 15
		        diplomacy = 17
	    	    stewardship = 10
		        intrigue = 10
		        learning = 10
	        }
			health = 10
		    fertility = 0.8
			trait = brilliant_strategist
			trait = brave
			trait = proud
			trait = ambitious
			trait = stubborn
			trait = diligent
			trait = adventurer
			trait = inspiring_leader
			trait = rough_terrain_leader
		}
		#give him a random boost
		new_character = {
		    wealth = 12000
			prestige = 5000
			
			save_global_event_target_as = invasion_leader
			e_elven_empire = {
				grant_title = PREV
			}
			set_government_type = feudal_government
			e_elven_empire = {
				add_law = succ_primogeniture
				add_law = true_cognatic_succession
				if = {
					limit = {
						has_dlc = "Zeus"
					}
					add_law = revoke_title_law_2
				}
				if = {
					limit = {
						NOT = { has_dlc = "Zeus" }
					}
					add_law = crown_authority_1
	    		}
			}
			set_defacto_liege = THIS
			set_character_flag = otherworlden_migrator
			character_event = {	id = EADSSUE.1	}
		}
		#Activate titles
		character_event = {	id = EADI.68	}
		character_event = {	id = EADI.74	}
		character_event = {	id = EADTITLE.1	}
		character_event = {	id = EADTITLE.5	}
	}
	
	option = {
		name = "EVTOPTA_EADI_002"
	}
}

narrative_event = {#Notification that the elves has landed in Britain
	id = EADI.2
	title = "EVTNAME_EADI_004"
	desc = "EVTDESCA_EADI_004"
	picture = GFX_evt_battle_elven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = elves_britain
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = britain_invaded
			has_global_flag = elves_france
			has_global_flag = elves_german
			has_global_flag = elves_russia
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = britain_invaded }
			}
			set_global_flag = britain_invaded
            set_global_flag = dwarfs_ready			
				32 = { # 
					kingdom = {
						e_elven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_elven_empire = {
				holder_scope = {
					character_event = { id = EADI.6 } # Spawn courtiers
    				character_event = { id = EADI.7 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = "EVTOPTA_EADI_003"
	}
}

narrative_event = {#Notification that the elves has landed in France
	id = EADI.3
	title = "EVTNAME_EADI_004"
	desc = "EVTDESCB_EADI_004"
	picture = GFX_evt_battle_elven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = elves_france
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = france_invaded
			has_global_flag = elves_britain
			has_global_flag = elves_german
			has_global_flag = elves_russia
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = france_invaded }
			}
			set_global_flag = france_invaded
            set_global_flag = dwarfs_ready			
				103 = { # 
					kingdom = {
						e_elven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_elven_empire = {
				holder_scope = {
					character_event = { id = EADI.6 } # Spawn courtiers
    				character_event = { id = EADI.7 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = "EVTOPTA_EADI_003"
	}
}

narrative_event = {#Notification that the elves has landed in Germany
	id = EADI.4
	title = "EVTNAME_EADI_004"
	desc = "EVTDESCC_EADI_004"
	picture = GFX_evt_battle_elven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = elves_german
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = german_invaded
			has_global_flag = elves_france
			has_global_flag = elves_britain
			has_global_flag = elves_russia
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = german_invaded }
			}
			set_global_flag = german_invaded	
			set_global_flag = dwarfs_ready	
				85 = { # 
					kingdom = {
						e_elven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_elven_empire = {
				holder_scope = {
					character_event = { id = EADI.6 } # Spawn courtiers
    				character_event = { id = EADI.7 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = "EVTOPTA_EADI_003"
	}
}

narrative_event = {#Notification that the elves has landed in Russia
	id = EADI.5
	title = "EVTNAME_EADI_004"
	desc = "EVTDESC_EADI_004"
	picture = GFX_evt_battle_elven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = elves_russia
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = russia_invaded
			has_global_flag = elves_france
			has_global_flag = elves_german
			has_global_flag = elves_britain
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = russia_invaded }
			}
			set_global_flag = russia_invaded	
			set_global_flag = dwarfs_ready	
				409 = { # 
					kingdom = {
						e_elven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_elven_empire = {
				holder_scope = {
					character_event = { id = EADI.6 } # Spawn courtiers
    				character_event = { id = EADI.7 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = "EVTOPTA_EADI_003"
	}
}

character_event = {
	id = EADI.6
	title = "EVTNAMEINVADERS3"
	desc = "EVTDESCINVADERS3"
	picture = GFX_evt_battle_elven
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_elven_empire }
	}	
	immediate = {
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = no
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = no
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = no
			age = 25
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = no
			age = 26
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = no
			age = 28
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = yes
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = yes
			age = 17
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = yes
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = no
			age = 27
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = no
			age = 51
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = no
			age = 44
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven
			culture = high_elven
			female = no
			age = 24
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
	}
	option = {
		name = "EVTOPTA_INVADERS3"
	}
}
	
character_event = {#Invader gets their troops
	id = EADI.7
	title = "EVTNAMEINVADERS4"
	desc = "EVTDESCINVADERS4"
	picture = GFX_evt_battle_elven
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_elven_empire }
	}
	
	immediate = {
		if = {
			limit = {
				has_global_flag = britain_invaded
			}
			spawn_unit = {
				province = 32 # 
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
			spawn_unit = {
				province = 32 # 
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 32 # 
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 32 # 
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 32 # 
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_fleet = {
				province = closest # closest sea zone
				disband_on_peace = yes
				troops =
				{
					galleys = { 600 600 }
				}
			}			
		}
		else_if = {
			limit = {
				has_global_flag = france_invaded
			}
			spawn_unit = {
				province = 103 # Mortain
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 103 # Mortain
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_unit = {
				province = 103 # Mortain
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 103 # Mortain
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_unit = {
				province = 103 # Mortain
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_fleet = {
				province = closest # closest sea zone
				disband_on_peace = yes
				troops =
				{
					galleys = { 600 600 }
				}
			}			
		}
        else_if = {
			limit = {
				has_global_flag = german_invaded
			}
			spawn_unit = {
				province = 85 # Rostock
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 85 # Rostock
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}	
			spawn_unit = {
				province = 85 # Rostock
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
			spawn_unit = {
				province = 85 # Rostock
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
			spawn_unit = {
				province = 85 # Rostock
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_fleet = {
				province = closest # closest sea zone
				disband_on_peace = yes
				troops =
				{
					galleys = { 600 600 }
				}
			}			
		}
        else_if = {
			limit = {
				has_global_flag = russia_invaded
			}
			spawn_unit = {
				province = 409 # Ilmen
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 409 # Ilmen
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 409 # Ilmen
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 409 # Ilmen
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 409 # Ilmen
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_fleet = {
				province = closest # closest sea zone
				disband_on_peace = yes
				troops =
				{
					galleys = { 600 600 }
				}
			}			
		}		
	}
	option = {
		name = "EVTOPTA_INVADERS4"
	}	
}

########
#DWARFS#
########

narrative_event = {#Here comes the dwarfs!
	id = EADI.8
	title = "EVTNAME_EADI_006"
	desc = "EVTDESC_EADI_006"
	picture = GFX_evt_dwarven_gates
	border = "GFX_event_narrative_frame_war"
	major = yes
	has_global_flag = dwarfs_ready
	
	only_playable = yes
	religion = catholic
	min_age = 16
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes # Let it happen for the Pope. He's always around.
		NOR = {
			has_global_flag = dwarfs_hungary
			has_global_flag = dwarfs_switzerland
			has_global_flag = dwarfs_balkans
			has_global_flag = dwarfs_ural
		}
	}
	
	mean_time_to_happen = {
	    months = 1
	}
	
	immediate = {
		random_list = {
#			25 = {
#				set_global_flag = dwarfs_hungary
#			}
			50 = {
				set_global_flag = dwarfs_switzerland
			}
			25 = {
				set_global_flag = dwarfs_balkans
			}
			25 = {
				set_global_flag = dwarfs_ural
			}
		}
		activate_title = { title = e_dwarven_empire status = yes }			
		create_character = {
					dynasty = 1256100 # Longbrod
					name = Darin
					culture = dwarven_dawi
					religion = dwarven
					attributes = {
				        martial = 15
				        diplomacy = 10
				        stewardship = 15
				        intrigue = 7
				        learning = 10
			        }
                    health = 7
			        fertility = 0.8
					trait = midas_touched
                    trait = greedy
                    trait = just
                    trait = patient
                    trait = strong
                    trait = adventurer
                    trait = robust			
					trait = inspiring_leader
					trait = mountain_terrain_leader
		}
		#give him a random boost
		new_character = {
		    wealth = 12000
			prestige = 5000
			
			save_global_event_target_as = invasion_leader
			e_dwarven_empire = {
				grant_title = PREV
			}
			set_government_type = feudal_government
			e_dwarven_empire = {
				add_law = succ_primogeniture
				add_law = true_cognatic_succession
				if = {
					limit = {
						has_dlc = "Zeus"
					}
					add_law = revoke_title_law_2
				}
				if = {
					limit = {
						NOT = { has_dlc = "Zeus" }
					}
					add_law = crown_authority_1
	    		}
			}
			set_defacto_liege = THIS
			set_character_flag = otherworlden_migrator
			character_event = {	id = EADSSUE.3	}
		}
		#Activate titles
		character_event = {	id = EADI.76	}
		character_event = {	id = EADI.71	}
		character_event = {	id = EADTITLE.4 }
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_006
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_006_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the dwarfs attacked Hungary
	id = EADI.9
	title = "EVTNAME_EADI_004"
	desc = "EVTDESC_EADI_008"
	picture = GFX_evt_battle_dwarven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = dwarfs_hungary
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = hungary_invaded
			has_global_flag = dwarfs_switzerland
			has_global_flag = dwarfs_balkans
			has_global_flag = dwarfs_ural
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = hungary_invaded }
			}
			set_global_flag = hungary_invaded
            set_global_flag = dunmer_ready			
				537 = { # 
					kingdom = {
						e_dwarven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_dwarven_empire = {
				holder_scope = {
					character_event = { id = EADI.13 } # Spawn courtiers
    				character_event = { id = EADI.14 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_008
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_008_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the dwarfs attacked Switzerland (Actually Tirol, Switzerland is the remnants of early code)
	id = EADI.10
	title = "EVTNAME_EADI_004"
	desc = "EVTDESCA_EADI_008"
	picture = GFX_evt_battle_dwarven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = dwarfs_switzerland
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = switzery_invaded
			has_global_flag = dwarfs_hungary
			has_global_flag = dwarfs_balkans
			has_global_flag = dwarfs_ural
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = switzery_invaded }
			}
			set_global_flag = switzery_invaded
            set_global_flag = dunmer_ready			
				359 = { # 
					kingdom = {
						e_dwarven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_dwarven_empire = {
				holder_scope = {
					character_event = { id = EADI.13 } # Spawn courtiers
    				character_event = { id = EADI.14 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_008
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_008_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the dwarfs attacked Balkans
	id = EADI.11
	title = "EVTNAME_EADI_004"
	desc = "EVTDESCB_EADI_008"
	picture = GFX_evt_battle_dwarven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = dwarfs_balkans
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = balkans_invaded
			has_global_flag = dwarfs_switzerland
			has_global_flag = dwarfs_hungary
			has_global_flag = dwarfs_ural
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = balkans_invaded }
			}
			set_global_flag = balkans_invaded
            set_global_flag = dunmer_ready			
				1645 = { # 
					kingdom = {
						e_dwarven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_dwarven_empire = {
				holder_scope = {
					character_event = { id = EADI.13 } # Spawn courtiers
    				character_event = { id = EADI.14 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_008
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_008_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the dwarfs attacked Ural
	id = EADI.12
	title = "EVTNAME_EADI_004"
	desc = "EVTDESCC_EADI_008"
	picture = GFX_evt_battle_dwarven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = dwarfs_ural
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = ural_invaded
			has_global_flag = dwarfs_switzerland
			has_global_flag = dwarfs_balkans
			has_global_flag = dwarfs_hungary
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = ural_invaded }
			}
			set_global_flag = ural_invaded
            set_global_flag = dunmer_ready			
				889 = { # 
					kingdom = {
						e_dwarven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_dwarven_empire = {
				holder_scope = {
					character_event = { id = EADI.13 } # Spawn courtiers
    				character_event = { id = EADI.14 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_008
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_008_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

character_event = {
	id = EADI.13
	title = "EVTNAMEINVADERS3"
	desc = "EVTDESCINVADERS3"
	picture = GFX_evt_battle_dwarven
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_dwarven_empire }
	}	
	immediate = {
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = no
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = no
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = no
			age = 25
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = no
			age = 26
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = no
			age = 28
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = yes
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = yes
			age = 17
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = yes
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = no
			age = 27
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = no
			age = 51
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven
			culture = dwarven_dawi
			female = no
			age = 44
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = 1256061 #Awemedinade
			religion = dwarven
			culture = dwarven_dawi
			race = high_elven
			female = no
			age = 24
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
			set_character_flag = descedant_of_cacame
		}
		new_character = {
		    create_bloodline = {
				type = bloodline_cacame
			}
		remove_trait = weak
		remove_trait = slow
		remove_trait = imbecile
		remove_trait = dull
		remove_trait = dwarf
		remove_trait = giant
		remove_trait = hunchback
		remove_trait = clubfooted
		remove_trait = craven
		remove_trait = paranoid
		
		remove_trait = mystic
		remove_trait = socializer
		remove_trait = gamer
		remove_trait = hedonist
		remove_trait = duelist
		remove_trait = hunter
		remove_trait = strategist
		remove_trait = administrator
		remove_trait = architect
		remove_trait = gardener
		remove_trait = schemer
		remove_trait = impaler
		remove_trait = seducer
		remove_trait = seductress
		remove_trait = theologian
		remove_trait = scholar
		
		remove_trait = misguided_warrior
		remove_trait = tough_soldier
		remove_trait = skilled_tactician
		
		add_trait = brilliant_strategist
		
		random_list = {
			20 = {
				add_trait = robust
			}
			10 = {
				add_trait = strong
			}
			5 = {
				health = 1
			}
		}
		
		random_list = {
			10 = {
				add_trait = narrow_flank_leader
			}
			10 = {
				add_trait = defensive_leader
			}
			10 = {
				add_trait = experimenter
			}
			10 = {
				add_trait = flanker
			}
			10 = {
				add_trait = heavy_infantry_leader
			}
			10 = {
				add_trait = inspiring_leader
			}
			10 = {
				add_trait = organizer
			}
			10 = {
				add_trait = siege_leader
			}
			10 = {
				add_trait = trickster
			}
			10 = {
				add_trait = aggressive_leader
			}
		}
		}
	}
	option = {
		name = "EVTOPTA_INVADERS3"
	}
}
	
character_event = {#Invader gets their troops
	id = EADI.14
	title = "EVTNAMEINVADERS4"
	desc = "EVTDESCINVADERS4"
	picture = GFX_evt_battle_dwarven
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_dwarven_empire }
	}
	
	immediate = {
		if = {
			limit = {
				has_global_flag = hungary_invaded
			}
			spawn_unit = {
				province = 537 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
			spawn_unit = {
				province = 537 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 537 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 537 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 537 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}			
		}
		else_if = {
			limit = {
				has_global_flag = switzery_invaded
			}
			spawn_unit = {
				province = 359 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 359 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_unit = {
				province = 359 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 359 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_unit = {
				province = 359 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}				
		}
        else_if = {
			limit = {
				has_global_flag = balkans_invaded
			}
			spawn_unit = {
				province = 1645 # Balcans
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 1645 # Balcans
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}	
			spawn_unit = {
				province = 1645 # Balcans
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
			spawn_unit = {
				province = 1645 # Balcans
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
			spawn_unit = {
				province = 1645 # Balcans
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}						
		}
        else_if = {
			limit = {
				has_global_flag = ural_invaded
			}
			spawn_unit = {
				province = 889 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 889 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 889 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 889 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 889 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
		}		
	}
	option = {
		name = "EVTOPTA_INVADERS4"
	}	
}

############
#Dark Elves#
############

narrative_event = {#Here comes the dark elves! You n'wah
	id = EADI.15
	title = "EVTNAME_EADI_009"
	desc = "EVTDESC_EADI_009"
	picture = GFX_evt_elven_ships
	border = "GFX_event_narrative_frame_war"
	major = yes
	has_global_flag = dunmer_ready
	
	only_playable = yes
	religion = catholic
	min_age = 16
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes # Let it happen for the Pope. He's always around.
		NOR = {
			has_global_flag = dunmer_araby
			has_global_flag = dunmer_iraq
			has_global_flag = dunmer_persia
			has_global_flag = dunmer_hejaz
		}
	}
	
	mean_time_to_happen = {
	    months = 1
	}
	
	immediate = {
		random_list = {
			25 = {
				set_global_flag = dunmer_araby
			}
			25 = {
				set_global_flag = dunmer_iraq
			}
			25 = {
				set_global_flag = dunmer_persia
			}
			25 = {
				set_global_flag = dunmer_hejaz
			}
		}
		activate_title = { title = e_dark_elven_empire status = yes }			
		create_character = {
					dynasty = 1256040 # Invaril
					name = Heseth
					culture = dark_elven
					religion = elven_tribunal
					attributes = {
				        martial = 15
				        diplomacy = 12
				        stewardship = 10
				        intrigue = 12
				        learning = 10
			        }
                    health = 7
			        fertility = 0.8
					trait = elusive_shadow
                    trait = zealous
                    trait = just
                    trait = patient
                    trait = shrewd
                    trait = adventurer
                    trait = quick			
					trait = inspiring_leader
					trait = desert_terrain_leader
		}
		#give him a random boost
		new_character = {
		    wealth = 12000
			prestige = 5000
			
			save_global_event_target_as = invasion_leader
			e_dark_elven_empire = {
				grant_title = PREV
			}
			set_government_type = feudal_government
			e_dark_elven_empire = {
				add_law = succ_primogeniture
				add_law = true_cognatic_succession
				if = {
					limit = {
						has_dlc = "Zeus"
					}
					add_law = revoke_title_law_2
				}
				if = {
					limit = {
						NOT = { has_dlc = "Zeus" }
					}
					add_law = crown_authority_1
	    		}
			}
			set_defacto_liege = THIS
			set_character_flag = otherworlden_migrator
			character_event = {	id = EADSSUE.2	}
		}
		#Activate titles
		character_event = {	id = EADI.69	}
		character_event = {	id = EADI.70	}
		character_event = {	id = EADI.72	}
		character_event = {	id = EADI.73	}
		character_event = {	id = EADTITLE.3	}
	}

	option = {
		name = {
			text = EVTOPTA_EADI_009
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_009_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the dunmers invaded Araby
	id = EADI.16
	title = "EVTNAME_EADI_011"
	desc = "EVTDESC_EADI_011"
	picture = GFX_evt_battle_dark_elven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = dunmer_araby
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = araby_invaded
			has_global_flag = dunmer_iraq
			has_global_flag = dunmer_persia
			has_global_flag = dunmer_hejaz
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = araby_invaded }
			}
			set_global_flag = araby_invaded	
			set_global_flag = dwemer_ready
				716 = { # 
					kingdom = {
						e_dark_elven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_dark_elven_empire = {
				holder_scope = {
					character_event = { id = EADI.20 } # Spawn courtiers
    				character_event = { id = EADI.21 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_011
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_011_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {##Notification that the dunmers invaded Iraq
	id = EADI.17
	title = "EVTNAME_EADI_011"
	desc = "EVTDESC_EADI_011"
	picture = GFX_evt_battle_dark_elven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = dunmer_iraq
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = iraq_invaded
			has_global_flag = dunmer_araby
			has_global_flag = dunmer_persia
			has_global_flag = dunmer_hejaz
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = iraq_invaded }
			}
			set_global_flag = iraq_invaded
            set_global_flag = dwemer_ready			
				649 = { # 
					kingdom = {
						e_dark_elven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_dark_elven_empire = {
				holder_scope = {
					character_event = { id = EADI.20 } # Spawn courtiers
    				character_event = { id = EADI.21 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_011
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_011_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {##Notification that the dunmers invaded Persia
	id = EADI.18
	title = "EVTNAME_EADI_011"
	desc = "EVTDESC_EADI_011"
	picture = GFX_evt_battle_dark_elven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = dunmer_persia
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = persia_invaded
			has_global_flag = dunmer_iraq
			has_global_flag = dunmer_araby
			has_global_flag = dunmer_hejaz
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = persia_invaded }
			}
			set_global_flag = persia_invaded
            set_global_flag = dwemer_ready			
				641 = { # 
					kingdom = {
						e_dark_elven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_dark_elven_empire = {
				holder_scope = {
					character_event = { id = EADI.20 } # Spawn courtiers
    				character_event = { id = EADI.21 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_011
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_011_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the dunmers invaded Hejaz
	id = EADI.19
	title = "EVTNAME_EADI_011"
	desc = "EVTDESC_EADI_011"
	picture = GFX_evt_battle_dark_elven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = dunmer_hejaz
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = hejaz_invaded
			has_global_flag = dunmer_iraq
			has_global_flag = dunmer_persia
			has_global_flag = dunmer_araby
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = hejaz_invaded }
			}
			set_global_flag = hejaz_invaded	
			set_global_flag = dwemer_ready
				867 = { # 
					kingdom = {
						e_dark_elven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_dark_elven_empire = {
				holder_scope = {
					character_event = { id = EADI.20 } # Spawn courtiers
    				character_event = { id = EADI.21 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_011
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_011_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

character_event = {
	id = EADI.20
	title = "EVTNAMEINVADERS3"
	desc = "EVTDESCINVADERS3"
	picture = GFX_evt_battle_dark_elven
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_dark_elven_empire }
	}	
	immediate = {
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = no
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = no
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = no
			age = 25
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = no
			age = 26
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = no
			age = 28
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = yes
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = yes
			age = 17
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = yes
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = no
			age = 27
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = no
			age = 51
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = no
			age = 44
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal
			culture = dark_elven
			female = no
			age = 24
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
	}
	option = {
		name = "EVTOPTA_INVADERS3"
	}
}
	
character_event = {#Invader gets their troops
	id = EADI.21
	title = "EVTNAMEINVADERS4"
	desc = "EVTDESCINVADERS4"
	picture = GFX_evt_battle_dark_elven
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_dark_elven_empire }
	}
	
	immediate = {
		if = {
			limit = {
				has_global_flag = araby_invaded
			}
			spawn_unit = {
				province = 716 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
			spawn_unit = {
				province = 716 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 716 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 716 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 716 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_fleet = {
				province = closest # closest sea zone
				disband_on_peace = yes
				troops =
				{
					galleys = { 600 600 }
				}
			}			
		}
		else_if = {
			limit = {
				has_global_flag = iraq_invaded
			}
			spawn_unit = {
				province = 649 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 649 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_unit = {
				province = 649 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 649 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_unit = {
				province = 649 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_fleet = {
				province = closest # closest sea zone
				disband_on_peace = yes
				troops =
				{
					galleys = { 600 600 }
				}
			}			
		}
        else_if = {
			limit = {
				has_global_flag = persia_invaded
			}
			spawn_unit = {
				province = 641 # Hormuz
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 641 # Hormuz
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}	
			spawn_unit = {
				province = 641 # Hormuz
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
			spawn_unit = {
				province = 641 # Hormuz
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
			spawn_unit = {
				province = 641 # Hormuz
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_fleet = {
				province = closest # closest sea zone
				disband_on_peace = yes
				troops =
				{
					galleys = { 600 600 }
				}
			}			
		}
        else_if = {
			limit = {
				has_global_flag = hejaz_invaded
			}
			spawn_unit = {
				province = 867 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 867 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 867 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 867 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 867 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_fleet = {
				province = closest # closest sea zone
				disband_on_peace = yes
				troops =
				{
					galleys = { 600 600 }
				}
			}			
		}		
	}
	option = {
		name = "EVTOPTA_INVADERS4"
	}	
}

##############
#Dark Dwarves#
##############

narrative_event = {#Here comes the dark dwarves! Huge dwemer vibe.
	id = EADI.22
	title = "EVTNAME_EADI_013"
	desc = "EVTDESC_EADI_013"
	picture = GFX_evt_dwarven_gates
	border = "GFX_event_narrative_frame_war"
	major = yes
	has_global_flag = dwemer_ready
	
	only_playable = yes
	religion = catholic
	min_age = 16
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes # Let it happen for the Pope. He's always around.
		NOR = {
			has_global_flag = dwemer_gilan
			has_global_flag = dwemer_georgia
			has_global_flag = dwemer_afgan
			#has_global_flag = dwemer_tibet
		}
	}
	
	mean_time_to_happen = {
	    months = 1
	}
	
	immediate = {
		random_list = {
			25 = {
				set_global_flag = dwemer_gilan
			}
			25 = {
				set_global_flag = dwemer_georgia
			}
			25 = {
				set_global_flag = dwemer_afgan
			}
			#25 = {
			#	set_global_flag = dwemer_tibet
			#}
		}
		activate_title = { title = e_dark_dwarven_empire status = yes }			
		create_character = {
					dynasty = 1256056 # Druvarn
					name = Kagrum
					culture = dark_dwarven
					religion = dwarven_dwemer
					attributes = {
				        martial = 12
				        diplomacy = 10
				        stewardship = 15
				        intrigue = 7
				        learning = 15
			        }
                    health = 7
			        fertility = 0.8
					trait = mastermind_theologian
                    trait = erudite
                    trait = just
                    trait = patient
                    trait = scholar
                    trait = adventurer
                    trait = genius			
					trait = inspiring_leader
					trait = mountain_terrain_leader
		}
		#give him a random boost
		new_character = {
		    wealth = 12000
			prestige = 5000
			
			save_global_event_target_as = invasion_leader
			e_dark_dwarven_empire = {
				grant_title = PREV
			}
			set_government_type = feudal_government
			e_dark_dwarven_empire = {
				add_law = succ_primogeniture
				add_law = true_cognatic_succession
				if = {
					limit = {
						has_dlc = "Zeus"
					}
					add_law = revoke_title_law_2
				}
				if = {
					limit = {
						NOT = { has_dlc = "Zeus" }
					}
					add_law = crown_authority_1
	    		}
			}
			set_defacto_liege = THIS
			set_character_flag = otherworlden_migrator
		}
		#Activate titles
		character_event = {	id = EADI.75	}
		character_event = {	id = EADI.80	}
		character_event = {	id = EADI.81	}
		character_event = {	id = EADTITLE.2	}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_013
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_013_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the dwemer invade Gilan
	id = EADI.23
	title = "EVTNAME_EADI_015"
	desc = "EVTDESC_EADI_015"
	picture = GFX_evt_battle_dwarven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = dwemer_gilan
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = gilan_invaded
			has_global_flag = dwemer_georgia
			has_global_flag = dwemer_afgan
			has_global_flag = dwemer_tibet
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = gilan_invaded }
			}
			set_global_flag = gilan_invaded
            set_global_flag = cathrians_ready			
				662 = { # 
					kingdom = {
						e_dark_dwarven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_dark_dwarven_empire = {
				holder_scope = {
					character_event = { id = EADI.27 } # Spawn courtiers
    				character_event = { id = EADI.28 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_015
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_015_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {##Notification that the dwemer invaded Georgia
	id = EADI.24
	title = "EVTNAME_EADI_015"
	desc = "EVTDESC_EADI_015"
	picture = GFX_evt_battle_dwarven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = dwemer_georgia
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = georgia_invaded
			has_global_flag = dwemer_gilan
			has_global_flag = dwemer_afgan
			has_global_flag = dwemer_tibet
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = georgia_invaded }
			}
			set_global_flag = georgia_invaded
            set_global_flag = cathrians_ready			
				1013 = { # 
					kingdom = {
						e_dark_dwarven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_dark_dwarven_empire = {
				holder_scope = {
					character_event = { id = EADI.27 } # Spawn courtiers
    				character_event = { id = EADI.28 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_015
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_015_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {##Notification that the dwemer invade Afganistan
	id = EADI.25
	title = "EVTNAME_EADI_015"
	desc = "EVTDESC_EADI_015"
	picture = GFX_evt_battle_dwarven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = dwemer_afgan
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = afgan_invaded
			has_global_flag = dwemer_georgia
			has_global_flag = dwemer_gilan
			has_global_flag = dwemer_tibet
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = afgan_invaded }
			}
			set_global_flag = afgan_invaded
            set_global_flag = cathrians_ready			
				1182 = { # 
					kingdom = {
						e_dark_dwarven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_dark_dwarven_empire = {
				holder_scope = {
					character_event = { id = EADI.27 } # Spawn courtiers
    				character_event = { id = EADI.28 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_015
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_015_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the dwemer invade 
	id = EADI.26
	title = "EVTNAME_EADI_015"
	desc = "EVTDESC_EADI_015"
	picture = GFX_evt_battle_dwarven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = dwemer_tibet
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = tibet_invaded
			has_global_flag = dwemer_georgia
			has_global_flag = dwemer_afgan
			has_global_flag = dwemer_gilan
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = tibet_invaded }
			}
			set_global_flag = tibet_invaded
            set_global_flag = cathrians_ready			
				1467 = { # 
					kingdom = {
						e_dark_dwarven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_dark_dwarven_empire = {
				holder_scope = {
					character_event = { id = EADI.27 } # Spawn courtiers
    				character_event = { id = EADI.28 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_015
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_015_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

character_event = {
	id = EADI.27
	title = "EVTNAMEINVADERS3"
	desc = "EVTDESCINVADERS3"
	picture = GFX_evt_battle_dwarven
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_dark_dwarven_empire }
	}	
	immediate = {
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = no
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = no
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = no
			age = 25
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = no
			age = 26
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = no
			age = 28
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = yes
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = yes
			age = 17
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = yes
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = no
			age = 27
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = no
			age = 51
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = no
			age = 44
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = dwarven_dwemer
			culture = dark_dwarven
			female = no
			age = 24
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
	}
	option = {
		name = "EVTOPTA_INVADERS3"
	}
}
	
character_event = {#Invader gets their troops
	id = EADI.28
	title = "EVTNAMEINVADERS4"
	desc = "EVTDESCINVADERS4"
	picture = GFX_evt_battle_dwarven
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_dark_dwarven_empire }
	}
	
	immediate = {
		if = {
			limit = {
				has_global_flag = gilan_invaded
			}
			spawn_unit = {
				province = 662 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
			spawn_unit = {
				province = 662 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 662 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 662 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 662 # Berek - Carpathians mountains
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}			
		}
		else_if = {
			limit = {
				has_global_flag = georgia_invaded
			}
			spawn_unit = {
				province = 1013 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 1013 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_unit = {
				province = 1013 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 1013 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_unit = {
				province = 1013 # Schwyz - Apls
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}				
		}
        else_if = {
			limit = {
				has_global_flag = afgan_invaded
			}
			spawn_unit = {
				province = 1182 # Balcans
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 1182 # Balcans
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}	
			spawn_unit = {
				province = 1182 # Balcans
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
			spawn_unit = {
				province = 1182 # Balcans
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
			spawn_unit = {
				province = 1182 # Balcans
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}						
		}
        else_if = {
			limit = {
				has_global_flag = tibet_invaded
			}
			spawn_unit = {
				province = 1467 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 1467 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 1467 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 1467 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 1467 # Ural mountains
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
		}		
	}
	option = {
		name = "EVTOPTA_INVADERS4"
	}	
}

##########
#Cat Folk#
##########

narrative_event = {#The Khajiit have wares, if you have coins!
	id = EADI.29
	title = "EVTNAME_EADI_016"
	desc = "EVTDESC_EADI_016"
	picture = GFX_evt_battle_byzantine
	border = "GFX_event_narrative_frame_war"
	major = yes
	has_global_flag = cathrians_ready
	
	only_playable = yes
	religion = catholic
	min_age = 16
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes # Let it happen for the Pope. He's always around.
		NOR = {
			has_global_flag = cat_folk_egypt
			has_global_flag = cat_folk_tunis
			has_global_flag = cat_folk_magreeb
			has_global_flag = cat_folk_lybia
		}
	}
	
	mean_time_to_happen = {
	    months = 1
	}
	
	immediate = {
		random_list = {
#			25 = {
#				set_global_flag = cat_folk_egypt
#			}
			33 = {
				set_global_flag = cat_folk_tunis
			}
			33 = {
				set_global_flag = cat_folk_magreeb
			}
			33 = {
				set_global_flag = cat_folk_lybia
			}
		}
		activate_title = { title = e_cat_folk_empire status = yes }			
		create_character = {
					dynasty = 1256063 # Avandi
					name = Rishima
					culture = cat_folk
					female = yes
					religion = cat_folk_religion
					attributes = {
				        martial = 14
				        diplomacy = 16
				        stewardship = 7
				        intrigue = 10
				        learning = 8
			        }
                    health = 7
			        fertility = 0.8
					trait = grey_eminence
					trait = groomed
                    trait = zealous
                    trait = just
                    trait = patient
                    trait = lustful
                    trait = adventurer
                    trait = fair			
					trait = inspiring_leader
					trait = desert_terrain_leader
		}
		#give him a random boost
		new_character = {
		    wealth = 12000
			prestige = 5000
			
			save_global_event_target_as = invasion_leader
			e_cat_folk_empire = {
				grant_title = PREV
			}
			set_government_type = feudal_government
			e_cat_folk_empire = {
				add_law = succ_primogeniture
				add_law = true_cognatic_succession
				if = {
					limit = {
						has_dlc = "Zeus"
					}
					add_law = revoke_title_law_2
				}
				if = {
					limit = {
						NOT = { has_dlc = "Zeus" }
					}
					add_law = crown_authority_1
	    		}
			}
			set_defacto_liege = THIS
			set_character_flag = otherworlden_migrator
		}
		#Activate titles
		character_event = {	id = EADI.78	}
		character_event = {	id = EADI.77	}
		character_event = {	id = EADTITLE.6	}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_016
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_016_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}

}

narrative_event = {#Notification that the cathrians invade Egypt
	id = EADI.30
	title = "EVTNAME_EADI_017"
	desc = "EVTDESC_EADI_017"
	picture = GFX_evt_battle_byzantine
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = cat_folk_egypt
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = egypt_invaded
			has_global_flag = cat_folk_tunis
			has_global_flag = cat_folk_magreeb
			has_global_flag = cat_folk_lybia
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = egypt_invaded }
			}
			set_global_flag = egypt_invaded	
				796 = { # 
					kingdom = {
						e_cat_folk_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_cat_folk_empire = {
				holder_scope = {
					character_event = { id = EADI.34 } # Spawn courtiers
    				character_event = { id = EADI.35 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
		set_global_flag = orcs_ready
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_017
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_017_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {##Notification that the cathrians invade Tunis
	id = EADI.31
	title = "EVTNAME_EADI_017"
	desc = "EVTDESC_EADI_017"
	picture = GFX_evt_battle_byzantine
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = cat_folk_tunis
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = tunis_invaded
			has_global_flag = cat_folk_egypt
			has_global_flag = cat_folk_magreeb
			has_global_flag = cat_folk_lybia
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = tunis_invaded }
			}
			set_global_flag = tunis_invaded	
				817 = { # 
					kingdom = {
						e_cat_folk_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_cat_folk_empire = {
				holder_scope = {
					character_event = { id = EADI.34 } # Spawn courtiers
    				character_event = { id = EADI.35 } # Spawn troops		
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
		set_global_flag = orcs_ready
	}
	option = {
		name = {
			text = EVTOPTA_EADI_017
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_017_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {##Notification that the cathrians invade Magreeb
	id = EADI.32
	title = "EVTNAME_EADI_017"
	desc = "EVTDESC_EADI_017"
	picture = GFX_evt_battle_byzantine
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = cat_folk_magreeb
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = magreeb_invaded
			has_global_flag = cat_folk_tunis
			has_global_flag = cat_folk_egypt
			has_global_flag = cat_folk_lybia
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = magreeb_invaded }
			}
			set_global_flag = magreeb_invaded	
				817 = { # 
					kingdom = {
						e_cat_folk_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_cat_folk_empire = {
				holder_scope = {
					character_event = { id = EADI.34 } # Spawn courtiers
    				character_event = { id = EADI.35 } # Spawn troops		
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
		set_global_flag = orcs_ready
	}
	option = {
		name = {
			text = EVTOPTA_EADI_017
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_017_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the cathrians invade lybia
	id = EADI.33
	title = "EVTNAME_EADI_017"
	desc = "EVTDESC_EADI_017"
	picture = GFX_evt_battle_byzantine
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = cat_folk_lybia
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = lybia_invaded
			has_global_flag = cat_folk_tunis
			has_global_flag = cat_folk_magreeb
			has_global_flag = cat_folk_egypt
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = lybia_invaded }
			}
			set_global_flag = lybia_invaded	
				810 = { # 
					kingdom = {
						e_cat_folk_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_cat_folk_empire = {
				holder_scope = {
					character_event = { id = EADI.34 } # Spawn courtiers
    				character_event = { id = EADI.35 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
		set_global_flag = orcs_ready
	}
	option = {
		name = {
			text = EVTOPTA_EADI_017
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_017_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

character_event = {
	id = EADI.34
	title = "EVTNAMEINVADERS3"
	desc = "EVTDESCINVADERS3"
	picture = GFX_evt_battle_byzantine
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_cat_folk_empire }
	}	
	immediate = {
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = no
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = no
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = no
			age = 25
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = no
			age = 26
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = no
			age = 28
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = yes
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = yes
			age = 17
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = yes
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = no
			age = 27
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = no
			age = 51
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = no
			age = 44
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = cat_folk_religion
			culture = cat_folk
			female = no
			age = 24
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
	}
	option = {
		name = "EVTOPTA_INVADERS3"
	}
}
	
character_event = {#Invader gets their troops
	id = EADI.35
	title = "EVTNAMEINVADERS4"
	desc = "EVTDESCINVADERS4"
	picture = GFX_evt_battle_byzantine
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_cat_folk_empire }
	}
	
	immediate = {
		if = {
			limit = {
				has_global_flag = egypt_invaded
			}
			spawn_unit = {
				province = 796 # Cairo - Egypt
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
			spawn_unit = {
				province = 796 # Cairo - Egypt
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 796 # Cairo - Egypt
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 662 # Cairo - Egypt
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}
            spawn_unit = {
				province = 662 # Cairo - Egypt
				troops =
				{
					light_cavalry = { 1500 1500 }
					light_infantry = { 4000 4000 }
					heavy_infantry = { 5000 5000 }
					archers = { 2000 2000 }
					knights = { 1000 1000 }
				}
			}			
		}
		else_if = {
			limit = {
				has_global_flag = tunis_invaded
			}
			spawn_unit = {
				province = 817 # Tunis
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 817 # Tunis
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_unit = {
				province = 817 # Tunis
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 817 # Tunis
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
            spawn_unit = {
				province = 817 # Tunis
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}				
		}
        else_if = {
			limit = {
				has_global_flag = magreeb_invaded
			}
			spawn_unit = {
				province = 817 # Marrakesh
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 817 # Marrakesh
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}	
			spawn_unit = {
				province = 817 # Marrakesh
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
			spawn_unit = {
				province = 817 # Marrakesh
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
			spawn_unit = {
				province = 817 # Marrakesh
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}						
		}
        else_if = {
			limit = {
				has_global_flag = lybia_invaded
			}
			spawn_unit = {
				province = 810 # Leptis Magna
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 810 # Leptis Magna
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 810 # Leptis Magna
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 810 # Leptis Magna
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}
			spawn_unit = {
				province = 810 # Leptis Magna
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 2500 2500 }
					heavy_infantry = { 1500 1500 }
					pikemen = { 1500 1500 }
					archers = { 3000 3000 }
				}
			}			
		}		
	}
	option = {
		name = "EVTOPTA_INVADERS4"
	}	
}

narrative_event = {#Notification that the elves achieve victory
    id = EADI.36
	title = "EADITITLE36"
	desc = "EADIDESC36"
	picture = GFX_evt_battle_elven
	major = yes

	is_triggered_only = yes
	
	trigger = {
		primary_title = { title = e_elven_empire }
		is_landed = yes
		NOT = { has_global_flag = elven_empire_landed }
	}
	
	major_trigger = {
		ai = no
	}
	
	immediate = {
	    ROOT = { 
            save_event_target_as = leader_of_elven_invasion
			primary_title = { 
			    set_title_landless = { title = THIS status = no }
		    }
        }
	    set_global_flag = elven_empire_landed
	}
	
	option = {
		name = "EVTOPTA_EADI_36_A"
	}
	
	option = {
	    name = EVTOPTA_EADI_36_B
		tooltip_info = yes
        if = {
            limit = {
                event_target:leader_of_elven_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_elven_invasion
            }
		}	
	}
}

narrative_event = {#Notification that the dwarfs achieve victory
    id = EADI.37
	title = "EADITITLE37"
	desc = "EADIDESC37"
	picture = GFX_evt_battle_dwarven
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_dwarven_empire }
		is_landed = yes
		NOT = { has_global_flag = dwarven_empire_landed }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
	    ROOT = { 
            save_event_target_as = leader_of_dwarven_invasion
            primary_title = { 
			    set_title_landless = { title = THIS status = no }
		    }			
        }
	    set_global_flag = dwarven_empire_landed
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_37_A
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_37_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
	
	option = {
	    name = EVTOPTA_EADI_37_B
		tooltip_info = yes
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
        if = {
            limit = {
                event_target:leader_of_dwarven_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_dwarven_invasion
            }
		}	
	}
	
	option = {
	    name = EVTOPTA_EADI_37_B_F
		tooltip_info = yes
		trigger = {
			is_fantasy_culture = yes
		}
        if = {
            limit = {
                event_target:leader_of_dwarven_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_dwarven_invasion
            }
		}	
	}
}

narrative_event = {#Notification that the dark elves achieve victory
    id = EADI.38
	title = "EADITITLE38"
	desc = "EADIDESC38"
	picture = GFX_evt_battle_dark_elven
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_dark_elven_empire }
		is_landed = yes
		NOT = { has_global_flag = dark_elven_empire_landed }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
	    ROOT = { 
            save_event_target_as = leader_of_dark_elven_invasion
            primary_title = { 
			    set_title_landless = { title = THIS status = no }
		    }				
        }
		set_global_flag = dark_elven_empire_landed		
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_38_A
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_38_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
	
	option = {
	    name = EVTOPTA_EADI_38_B
		tooltip_info = yes
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
        if = {
            limit = {
                event_target:leader_of_dark_elven_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_dark_elven_invasion
            }
		}	
	}
	
	option = {
	    name = EVTOPTA_EADI_38_B_F
		tooltip_info = yes
		trigger = {
			is_fantasy_culture = yes
		}
        if = {
            limit = {
                event_target:leader_of_dark_elven_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_dark_elven_invasion
            }
		}	
	}
}

narrative_event = {#Notification that the dark dwarfs achieve victory
    id = EADI.39
	title = "EADITITLE39"
	desc = "EADIDESC39"
	picture = GFX_evt_battle_dwarven
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_dark_dwarven_empire }
		is_landed = yes
		NOT = { has_global_flag = dark_dwarven_empire_landed }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
	    ROOT = { 
            save_event_target_as = leader_of_dark_dwarven_invasion
            primary_title = { 
			    set_title_landless = { title = THIS status = no }
		    }				
        }
		set_global_flag = dark_dwarven_empire_landed
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_39_A
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_39_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
	
	option = {
	    name = EVTOPTA_EADI_39_B
		tooltip_info = yes
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
        if = {
            limit = {
                event_target:leader_of_dark_dwarven_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_dark_dwarven_invasion
            }
		}	
	}
	
	option = {
	    name = EVTOPTA_EADI_39_B_F
		tooltip_info = yes
		trigger = {
			is_fantasy_culture = yes
		}
        if = {
            limit = {
                event_target:leader_of_dark_dwarven_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_dark_dwarven_invasion
            }
		}	
	}
}

narrative_event = {#Notification that the cathrians achieve victory
    id = EADI.40
	title = "EADITITLE40"
	desc = "EADIDESC40"
	picture = GFX_evt_battle_byzantine
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_cat_folk_empire }
		is_landed = yes
		NOT = { has_global_flag = cat_folk_empire_landed }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
	    ROOT = { 
            save_event_target_as = leader_of_cathrian_invasion
            primary_title = { 
			    set_title_landless = { title = THIS status = no }
		    }				
        }
	    set_global_flag = cat_folk_empire_landed
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_40_A
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_40_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
	
	option = {
	    name = EVTOPTA_EADI_40_B
		tooltip_info = yes
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
        if = {
            limit = {
                event_target:leader_of_cathrian_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_cathrian_invasion
            }
		}	
	}
	
	option = {
	    name = EVTOPTA_EADI_40_B_F
		tooltip_info = yes
		trigger = {
			is_fantasy_culture = yes
		}
        if = {
            limit = {
                event_target:leader_of_cathrian_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_cathrian_invasion
            }
		}	
	}
}
	
character_event = {
    id = EADI.45
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		OR = { 
		    primary_title = { title = e_cat_folk_empire } 
		    primary_title = { title = e_dark_dwarven_empire }
			primary_title = { title = e_dark_elven_empire }
			primary_title = { title = e_elven_empire }
			primary_title = { title = e_dwarven_empire }
			primary_title = { title = e_orcish_horde }
		}
	}
	
	immediate = {
	    religion_authority = {
			modifier = loyalty_to_traditions
			years = 40
		}
	}

}

narrative_event = {#Notification that the elves was defeated
    id = EADI.46
	title = "EADITITLE46"
	desc = "EADIDESC46"
	picture = GFX_evt_elven_defeat
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_elven_empire }
		NOT = { has_global_flag = elven_empire_defeated }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
	    set_global_flag = elven_empire_defeated
		primary_title = {
			activate_title = { title = e_elven_empire status = no }
			destroy_landed_title = e_elven_empire
		}
	}
	
	option = {
		name = "EVTOPTA_EADI_46_A"
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = "EVTOPTA_EADI_46_F"
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the dwarfs was defeated
    id = EADI.47
	title = "EADITITLE47"
	desc = "EADIDESC47"
	picture = GFX_evt_dwarven_defeat
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_dwarven_empire }
		NOT = { has_global_flag = dwarven_empire_defeated }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
	    set_global_flag = dwarven_empire_defeated
		primary_title = {
			activate_title = { title = e_dwarven_empire status = no }
			destroy_landed_title = e_dwarven_empire
		}
	}
	
	option = {
		name = "EVTOPTA_EADI_46_A"
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = "EVTOPTA_EADI_46_F"
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the dark elves was defeated
    id = EADI.48
	title = "EADITITLE48"
	desc = "EADIDESC48"
	picture = GFX_evt_dark_elven_defeat
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_dark_elven_empire }
		NOT = { has_global_flag = dark_elven_empire_defeated }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
		set_global_flag = dark_elven_empire_defeated
        primary_title = {
			activate_title = { title = e_dark_elven_empire status = no }
			destroy_landed_title = e_dark_elven_empire
		}		
	}
	
	option = {
		name = "EVTOPTA_EADI_46_A"
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = "EVTOPTA_EADI_46_F"
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the dark dwarfs was defeated
    id = EADI.49
	title = "EADITITLE49"
	desc = "EADIDESC49"
	picture = GFX_evt_battle_dwarven
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_dark_dwarven_empire }
		NOT = { has_global_flag = dark_dwarven_empire_defeated }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
		set_global_flag = dark_dwarven_empire_defeated
        primary_title = {
			activate_title = { title = e_dark_dwarven_empire status = no }
			destroy_landed_title = e_dark_dwarven_empire
		}		
	}
	
	option = {
		name = "EVTOPTA_EADI_46_A"
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = "EVTOPTA_EADI_46_F"
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the cathrians was defeated
    id = EADI.50
	title = "EADITITLE50"
	desc = "EADIDESC50"
	picture = GFX_evt_battle_byzantine
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_cat_folk_empire }
		NOT = { has_global_flag = cat_folk_empire_defeated }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
		set_global_flag = cat_folk_empire_defeated
        primary_title = {
			activate_title = { title = e_cat_folk_empire status = no }
			destroy_landed_title = e_cat_folk_empire
		}		
	}
	
	option = {
		name = "EVTOPTA_EADI_46_A"
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = "EVTOPTA_EADI_46_F"
		trigger = {
			is_fantasy_culture = yes
		}
	}
}


############
#Ashlanders#
############

narrative_event = {#Dark elves but nomads
	id = EADI.51
	title = "EVTNAME_EADI_051"
	desc = "EVTDESC_EADI_051"
	picture = GFX_evt_battle_dark_elven_nomad
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	min_age = 16
	show_root = no
	hide_from = yes
	
	trigger = { #Only will start if there is a powerfull dark elven emperor
		
		has_global_flag = everyone_invaded
		has_global_flag = dark_elven_empire_landed
	    OR = {
    		AND = { 
			    e_dark_elven_empire = { has_holder = yes } 
			    is_landed = yes
				realm_size >= 100
			}
			OR = {
			    any_independent_ruler = {
				    is_dark_elven_culture = yes
					is_landed = yes
					tier = EMPEROR
					realm_size >= 100
				}
				ROOT = {
			        is_dark_elven_culture = yes
					independent = yes
					tier = EMPEROR
					realm_size >= 100
			    }
			}
		}
		NOR = {
			has_global_flag = ashlander_alania #604
			has_global_flag = ashlander_aral #622
			has_global_flag = ashlander_cumania #1797
			has_global_flag = ashlander_khazaria #1813
		}
	}
	
	mean_time_to_happen = {
	    years = 5
	}
	
	immediate = {
		random_list = {
			25 = {
				set_global_flag = ashlander_alania
			}
			25 = {
				set_global_flag = ashlander_aral
			}
			25 = {
				set_global_flag = ashlander_cumania
			}
			25 = {
				set_global_flag = ashlander_khazaria
			}
		}
	}

	option = {
		name = {
			text = EVTOPTA_EADI_051
		}
		trigger = {
			NOT = { religion = elven_tribunal }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_051_F
		}
		trigger = {
			religion = elven_tribunal
		}
	}
}

narrative_event = {#Notification that the ashlanders invade Alania
	id = EADI.52
	title = "EVTNAME_EADI_052"
	desc = "EVTDESC_EADI_052"
	picture = GFX_evt_battle_dark_elven_nomad
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = ashlander_alania
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = alania_invaded
			has_global_flag = ashlander_aral
			has_global_flag = ashlander_cumania
			has_global_flag = ashlander_khazaria
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
	    activate_title = { title = e_ashlander_empire status = yes }			
		create_character = { #Generic ashlander ashkhan
			age = 27
			random_traits = yes
				female = no
				religion = elven_tribunal_heresy
				culture = dark_elven_nomad
				dynasty = actually_culture
				trait = brilliant_strategist
				martial = 10
			}
		#give him a random boost
		new_character = {
		    save_global_event_target_as = invasion_leader
		    wealth = 12000
			prestige = 5000
			change_martial = 7
	    	add_trait = ambitious
	    	add_trait = brave
			add_trait = adventurer
			
			e_ashlander_empire = {
				grant_title = PREV
			}
			if = {
				limit = {
					has_dlc = "Horse Lords"
				}
					set_government_type = nomadic_government
				}
			else_if = {
				limit = {
					NOT = { has_dlc = "Horse Lords" }
				}
					set_government_type = tribal_government
			}
			set_defacto_liege = THIS
			set_character_flag = horde_invader
			character_event = { id = 60515 days = 1 } # Spawn population
		}
		if = {
			limit = {
				NOT = { has_global_flag = alania_invaded }
			}
			set_global_flag = alania_invaded	
				604 = { # 
					kingdom = {
						e_ashlander_empire = {
							holder_scope = {
							    war = {
									casus_belli = ashlander_invasion
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}
			e_ashlander_empire = {
				holder_scope = {
					character_event = { id = EADI.56 } # Spawn courtiers
    				character_event = { id = EADI.57 } # Spawn troops						
			    }
	   	    }
	    }
	}

	option = {
		name = {
			text = EVTOPTA_EADI_052
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_052_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {##Notification that the dunmers invaded Aral sea region
	id = EADI.53
	title = "EVTNAME_EADI_053"
	desc = "EVTDESC_EADI_053"
	picture = GFX_evt_battle_dark_elven_nomad
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = ashlander_aral #622
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = aral_invaded
			has_global_flag = ashlander_alania
			has_global_flag = ashlander_cumania
			has_global_flag = ashlander_khazaria
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		activate_title = { title = e_ashlander_empire status = yes }			
		create_character = { #Generic ashlander ashkhan
			age = 27
			random_traits = yes
				female = no
				religion = elven_tribunal_heresy
				culture = dark_elven_nomad
				dynasty = actually_culture
				trait = brilliant_strategist
				martial = 10
			}
		#give him a random boost
		new_character = {
		    save_global_event_target_as = invasion_leader
		    wealth = 12000
			prestige = 5000
			change_martial = 7
	    	add_trait = ambitious
	    	add_trait = brave
			add_trait = adventurer
			
			e_ashlander_empire = {
				grant_title = PREV
			}
			if = {
				limit = {
					has_dlc = "Horse Lords"
				}
					set_government_type = nomadic_government
				}
			else_if = {
				limit = {
					NOT = { has_dlc = "Horse Lords" }
				}
					set_government_type = tribal_government
			}
			set_defacto_liege = THIS
			set_character_flag = horde_invader
			character_event = { id = 60515 days = 1 } # Spawn population
		}
		if = {
			limit = {
				NOT = { has_global_flag = aral_invaded }
			}
			set_global_flag = aral_invaded	
				622 = { # 
					kingdom = {
						e_ashlander_empire = {
							holder_scope = {
							    war = {
									casus_belli = ashlander_invasion
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}
			e_ashlander_empire = {
				holder_scope = {
					character_event = { id = EADI.56 } # Spawn courtiers
    				character_event = { id = EADI.57 } # Spawn troops						
			    }
	   	    }
	    }
	}
	option = {
		name = {
			text = EVTOPTA_EADI_052
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_052_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {##Notification that the dunmers invaded Cumania
	id = EADI.54
	title = "EVTNAME_EADI_054"
	desc = "EVTDESC_EADI_054"
	picture = GFX_evt_battle_dark_elven_nomad
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = ashlander_cumania #1797
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = cumania_invaded
			has_global_flag = ashlander_aral
			has_global_flag = ashlander_alania
			has_global_flag = ashlander_khazaria
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		activate_title = { title = e_ashlander_empire status = yes }			
		create_character = { #Generic ashlander ashkhan
			age = 27
			random_traits = yes
				female = no
				religion = elven_tribunal_heresy
				culture = dark_elven_nomad
				dynasty = actually_culture
				trait = brilliant_strategist
				martial = 10
			}
		#give him a random boost
		new_character = {
		    save_global_event_target_as = invasion_leader
		    wealth = 12000
			prestige = 5000
			change_martial = 7
	    	add_trait = ambitious
	    	add_trait = brave
			add_trait = adventurer
			
			e_ashlander_empire = {
				grant_title = PREV
			}
			if = {
				limit = {
					has_dlc = "Horse Lords"
				}
					set_government_type = nomadic_government
					add_law = succ_nomad_succession
				}
			else_if = {
				limit = {
					NOT = { has_dlc = "Horse Lords" }
				}
					set_government_type = tribal_government
					add_law = succ_gavelkind
			}
			set_defacto_liege = THIS
			set_character_flag = horde_invader
			character_event = { id = 60515 days = 1 } # Spawn population
		}
		if = {
			limit = {
				NOT = { has_global_flag = cumania_invaded }
			}
			set_global_flag = cumania_invaded			
				1797 = { # 
					kingdom = {
						e_ashlander_empire = {
							holder_scope = {
							    war = {
									casus_belli = ashlander_invasion
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}
			e_ashlander_empire = {
				holder_scope = {
					character_event = { id = EADI.56 } # Spawn courtiers
    				character_event = { id = EADI.57 } # Spawn troops						
			    }
	   	    }
	    }
	}
	option = {
		name = {
			text = EVTOPTA_EADI_052
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_052_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the dunmers invaded Khazaria
	id = EADI.55
	title = "EVTNAME_EADI_055"
	desc = "EVTDESC_EADI_055"
	picture = GFX_evt_battle_dark_elven_nomad
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = ashlander_khazaria #1813
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = khazaria_invaded
			has_global_flag = ashlander_aral
			has_global_flag = ashlander_cumania
			has_global_flag = ashlander_alania
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		activate_title = { title = e_ashlander_empire status = yes }			
		create_character = { #Generic ashlander ashkhan
			age = 27
			random_traits = yes
				female = no
				religion = elven_tribunal_heresy
				culture = dark_elven_nomad
				dynasty = actually_culture
				trait = brilliant_strategist
				martial = 10
			}
		#give him a random boost
		new_character = {
		    save_global_event_target_as = invasion_leader
		    wealth = 12000
			prestige = 5000
			change_martial = 7
	    	add_trait = ambitious
	    	add_trait = brave
			add_trait = adventurer
			
			e_ashlander_empire = {
				grant_title = PREV
			}
			if = {
				limit = {
					has_dlc = "Horse Lords"
				}
					set_government_type = nomadic_government
				}
			else_if = {
				limit = {
					NOT = { has_dlc = "Horse Lords" }
				}
					set_government_type = tribal_government
			}
			set_defacto_liege = THIS
			set_character_flag = horde_invader
			character_event = { id = 60515 days = 1 } # Spawn population
		}
		if = {
			limit = {
				NOT = { has_global_flag = khazaria_invaded }
			}
			set_global_flag = khazaria_invaded	
				1813 = { # 
					kingdom = {
						e_ashlander_empire = {
							holder_scope = {
							    war = {
									casus_belli = ashlander_invasion
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}
			e_ashlander_empire = {
				holder_scope = {
					character_event = { id = EADI.56 } # Spawn courtiers
    				character_event = { id = EADI.57 } # Spawn troops						
			    }
	   	    }
	    }
	}
	option = {
		name = {
			text = EVTOPTA_EADI_052
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_052_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

character_event = {
	id = EADI.56
	title = "EVTNAMEINVADERS3"
	desc = "EVTDESCINVADERS3"
	picture = GFX_evt_battle_dark_elven_nomad
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_ashlander_empire }
	}	
	immediate = {
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = no
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = no
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = no
			age = 25
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = no
			age = 26
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = no
			age = 28
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = yes
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = yes
			age = 17
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = yes
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = no
			age = 27
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = no
			age = 51
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = no
			age = 44
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_tribunal_heresy
			culture = dark_elven_nomad
			female = no
			age = 24
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
	}
	option = {
		name = "EVTOPTA_INVADERS3"
	}
}
	
character_event = {#Invader gets their troops
	id = EADI.57
	title = "EVTNAMEINVADERS4"
	desc = "EVTDESCINVADERS4"
	picture = GFX_evt_battle_dark_elven_nomad
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_ashlander_empire }
	}
	
	immediate = {
		if = {
			limit = {
				has_global_flag = alania_invaded
			}
			spawn_unit = {
				province = 604 # Berek - Carpathians mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 604 # Berek - Carpathians mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
            spawn_unit = {
				province = 604 # Berek - Carpathians mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
            spawn_unit = {
				province = 604 # Berek - Carpathians mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}			
		}
		else_if = {
			limit = {
				has_global_flag = aral_invaded
			}
			spawn_unit = {
				province = 622 # Schwyz - Apls
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 622 # Schwyz - Apls
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
            spawn_unit = {
				province = 622 # Schwyz - Apls
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 622 # Schwyz - Apls
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}			
		}
        else_if = {
			limit = {
				has_global_flag = cumania_invaded
			}
			spawn_unit = {
				province = 1797 # Hormuz
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 1797 # Hormuz
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}	
			spawn_unit = {
				province = 1797 # Hormuz
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}			
			spawn_unit = {
				province = 1797 # Hormuz
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}					
		}
        else_if = {
			limit = {
				has_global_flag = khazaria_invaded
			}
			spawn_unit = {
				province = 1813 # Ural mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 1813 # Ural mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 1813 # Ural mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 1813 # Ural mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}		
		}		
	}
	option = {
		name = "EVTOPTA_INVADERS4"
	}	
}

#############
#Blood Elves#
#############

narrative_event = {#High Elves but edgelords
	id = EADI.59
	title = "EVTNAME_EADI_059"
	desc = "EVTDESC_EADI_059"
	picture = GFX_evt_battle_blood_elven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	min_age = 16
	show_root = no
	hide_from = yes
	
	trigger = { #Only will start if there is a powerfull elven emperor
		
		has_global_flag = everyone_invaded
		has_global_flag = elven_empire_landed
	    OR = {
    		AND = { 
			    e_elven_empire = { has_holder = yes } 
			    is_landed = yes
				realm_size >= 100
			}
			OR = {
			    any_independent_ruler = {
				    is_high_elven_good_culture = yes
					is_landed = yes
					tier = EMPEROR
					realm_size >= 100
				}
				ROOT = {
			        is_high_elven_good_culture = yes
					independent = yes
					tier = EMPEROR
					realm_size >= 100
			    }
			}
		}
		NOR = {
			has_global_flag = blood_elves_scandinavia #272
			has_global_flag = blood_elves_russia #1820
		}
	}
	
	mean_time_to_happen = {
	    years = 5
	}
	
	immediate = {
		random_list = {
			75 = {
				set_global_flag = blood_elves_scandinavia
			}
			25 = {
				set_global_flag = blood_elves_russia
			}
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_051
		}
		trigger = {
			NOT = { religion = elven }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_051_F
		}
		trigger = {
			religion = elven
		}
	}
}

narrative_event = {#Notification that the blood elves invade Scandinavia
	id = EADI.60
	title = "EVTNAME_EADI_060"
	desc = "EVTDESC_EADI_060"
	picture = GFX_evt_battle_blood_elven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = blood_elves_scandinavia
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = blood_elves_russia
			has_global_flag = scandinavia_invaded
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
	    activate_title = { title = e_blood_elven_empire status = yes }			
		create_character = { #Generic edgelord elf
			age = 27
			random_traits = yes
				female = no
				religion = elven_heresy
				culture = blood_elven
				dynasty = actually_culture
				trait = brilliant_strategist
				martial = 10
			}
		#give him a random boost
		new_character = {
		    wealth = 1000
			prestige = 1000
			
			save_global_event_target_as = invasion_leader
			e_blood_elven_empire = {
				grant_title = PREV
			}
			set_government_type = feudal_government
			e_blood_elven_empire = {
				add_law = succ_primogeniture
				add_law = true_cognatic_succession
				if = {
					limit = {
						has_dlc = "Zeus"
					}
					add_law = revoke_title_law_2
				}
				if = {
					limit = {
						NOT = { has_dlc = "Zeus" }
					}
					add_law = crown_authority_1
	    		}
			}
			set_defacto_liege = THIS
			set_character_flag = otherworlden_migrator
		}
		if = {
			limit = {
				NOT = { has_global_flag = scandinavia_invaded }
			}
			set_global_flag = scandinavia_invaded		
				272 = { # 
					kingdom = {
						e_blood_elven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_blood_elven_empire = {
				holder_scope = {
					character_event = { id = EADI.62 } # Spawn courtiers
    				character_event = { id = EADI.63 } # Spawn troops					
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_052
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_052_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the blood elves invade Russia
	id = EADI.61
	title = "EVTNAME_EADI_061"
	desc = "EVTDESC_EADI_061"
	picture = GFX_evt_battle_blood_elven
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = blood_elves_russia
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = blood_elves_scandinavia
			has_global_flag = russia_invaded_blood_elves
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
	    activate_title = { title = e_blood_elven_empire status = yes }			
		create_character = { #Generic edgelord elf
			age = 27
			random_traits = yes
				female = no
				religion = elven_heresy
				culture = blood_elven
				dynasty = actually_culture
				trait = brilliant_strategist
				martial = 10
			}
		#give him a random boost
		new_character = {
		    wealth = 1000
			prestige = 1000
			
			save_global_event_target_as = invasion_leader
			e_blood_elven_empire = {
				grant_title = PREV
			}
			set_government_type = feudal_government
			e_blood_elven_empire = {
				add_law = succ_primogeniture
				add_law = true_cognatic_succession
				if = {
					limit = {
						has_dlc = "Zeus"
					}
					add_law = revoke_title_law_2
				}
				if = {
					limit = {
						NOT = { has_dlc = "Zeus" }
					}
					add_law = crown_authority_1
	    		}
			}
			set_defacto_liege = THIS
			set_character_flag = otherworlden_migrator
		}
		if = {
			limit = {
				NOT = { has_global_flag = russia_invaded_blood_elves }
			}
			set_global_flag = russia_invaded_blood_elves		
				1820 = { # 
					kingdom = {
						e_blood_elven_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_blood_elven_empire = {
				holder_scope = {
					character_event = { id = EADI.62 } # Spawn courtiers
    				character_event = { id = EADI.63 } # Spawn troops					
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_052
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_052_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

character_event = {
	id = EADI.62
	title = "EVTNAMEINVADERS3"
	desc = "EVTDESCINVADERS3"
	picture = GFX_evt_battle_elven
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_blood_elven_empire }
	}	
	immediate = {
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = no
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = no
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = no
			age = 25
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = no
			age = 26
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = no
			age = 28
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = yes
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = yes
			age = 17
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = yes
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = no
			age = 27
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = no
			age = 51
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = no
			age = 44
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = elven_heresy
			culture = blood_elven
			female = no
			age = 24
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
	}
	option = {
		name = "EVTOPTA_INVADERS3"
	}
}
	
character_event = {#Invader gets their troops
	id = EADI.63
	title = "EVTNAMEINVADERS4"
	desc = "EVTDESCINVADERS4"
	picture = GFX_evt_battle_elven
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_blood_elven_empire }
	}
	
	immediate = {
		if = {
			limit = {
				has_global_flag = scandinavia_invaded
			}
			spawn_unit = {
				province = 272 # 
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 3000 3000 }
					heavy_infantry = { 2000 2000 }
					archers = { 2000 2000 }
					knights = { 500 500 }
				}
			}
			spawn_unit = {
				province = 272 # 
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 3000 3000 }
					heavy_infantry = { 2000 2000 }
					archers = { 2000 2000 }
					knights = { 500 500 }
				}
			}
            spawn_fleet = {
				province = closest # closest sea zone
				disband_on_peace = yes
				troops =
				{
					galleys = { 100 100 }
				}
			}			
		}
		else_if = {
			limit = {
				has_global_flag = russia_invaded_blood_elves
			}
			spawn_unit = {
				province = 1820 # 
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 3000 3000 }
					heavy_infantry = { 2000 2000 }
					archers = { 2000 2000 }
					knights = { 500 500 }
				}
			}
			spawn_unit = {
				province = 1820 # 
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 3000 3000 }
					heavy_infantry = { 2000 2000 }
					archers = { 2000 2000 }
					knights = { 500 500 }
				}
			}
            spawn_fleet = {
				province = closest # closest sea zone
				disband_on_peace = yes
				troops =
				{
					galleys = { 100 100 }
				}
			}			
		}		
	}
	option = {
		name = "EVTOPTA_INVADERS4"
	}	
}

narrative_event = {#Notification that the edgelords elves achieve victory
    id = EADI.64
	title = "EADITITLE64"
	desc = "EADIDESC64"
	picture = GFX_evt_battle_blood_elven
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_blood_elven_empire }
		is_landed = yes
		NOT = { has_global_flag = blood_elven_empire_landed }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
	    ROOT = { 
            save_event_target_as = leader_of_blood_elven_invasion
			primary_title = { 
			    set_title_landless = { title = THIS status = no }
		    }
        }
	    set_global_flag = blood_elven_empire_landed
	}
	
	option = {
		name = "EVTOPTA_EADI_64_A"
		trigger = { 
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = "EVTOPTB_EADI_64_A"
		trigger = { 
			is_fantasy_culture = yes
		}
	}
	option = {
	    name = EVTOPTA_EADI_64_B
		trigger = { 
			NOT = { is_fantasy_culture = yes }
		}
		tooltip_info = yes
        if = {
            limit = {
                event_target:leader_of_blood_elven_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_blood_elven_invasion
            }
		}	
	}
	option = {
	    name = EVTOPTB_EADI_64_B
		trigger = { 
			is_fantasy_culture = yes
		}
		tooltip_info = yes
        if = {
            limit = {
                event_target:leader_of_blood_elven_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_blood_elven_invasion
            }
		}	
	}
}

narrative_event = {#Notification that the ashlanders achieve victory
    id = EADI.65
	title = "EADITITLE65"
	desc = "EADIDESC65"
	picture = GFX_evt_battle_dark_elven_nomad
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_ashlander_empire }
		is_landed = yes
		NOT = { has_global_flag = ashlander_landed }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
	    ROOT = { 
            save_event_target_as = leader_of_ashlander_invasion
			primary_title = { 
			    set_title_landless = { title = THIS status = no }
		    }
        }
	    set_global_flag = ashlander_landed
	}
	
	option = {
		name = "EVTOPTA_EADI_65_A"
		trigger = { 
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = "EVTOPTB_EADI_65_A"
		trigger = { 
			is_fantasy_culture = yes
		}
	}
	
	option = {
	    name = EVTOPTA_EADI_65_B
		tooltip_info = yes
		trigger = { 
			NOT = { is_fantasy_culture = yes }
		}
        if = {
            limit = {
                event_target:leader_of_ashlander_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_ashlander_invasion
            }
		}	
	}
	
	option = {
	    name = EVTOPTB_EADI_65_B
		tooltip_info = yes
		trigger = { 
			is_fantasy_culture = yes
		}
        if = {
            limit = {
                event_target:leader_of_ashlander_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_ashlander_invasion
            }
		}	
	}
}


#Debug event that turn on various otherworlden titles
#character_event = {
#    id = EADI.67
#	
#	hide_window = yes
#
#	is_triggered_only = yes
#	
#	major = yes
#	trigger = { 
#	    has_global_flag = everyone_invaded
#       NOT = { has_global_flag = otherworlden_titles_activated }		
#	}
#	
#	immediate = {
#	    hidden_tooltip = {
#		    set_global_flag = otherworlden_titles_activated
#			character_event = { id = EADI.68 }
#			character_event = { id = EADI.69 }
#			character_event = { id = EADI.70 }
#			character_event = { id = EADI.71 }
#			character_event = { id = EADI.72 }
#			character_event = { id = EADI.73 }
#			character_event = { id = EADI.74 }
#			character_event = { id = EADI.75 }
#			character_event = { id = EADI.76 }
#			character_event = { id = EADI.77 }
#			character_event = { id = EADI.78 }
#			character_event = { id = EADI.79 }
#			character_event = { id = EADI.80 }
#			character_event = { id = EADI.81 }		
#		}
#	}
#}

character_event = { #Elven Church
    id = EADI.68
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = { 
			has_global_flag = elves_britain
			has_global_flag = elves_france
			has_global_flag = elves_german
			has_global_flag = elves_russia			
		}	
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = k_elven_church status = yes }		
			create_random_priest = {
				random_traits = yes
				religion = elven
				culture = high_elven
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				k_elven_church = {
					grant_title = PREV
				}
			}
		}
	}
}

character_event = { #Dark Elven Church
    id = EADI.69
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = {
			has_global_flag = dunmer_araby
			has_global_flag = dunmer_iraq
			has_global_flag = dunmer_persia
			has_global_flag = dunmer_hejaz
		}	
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = k_dark_elven_church status = yes }		
			create_random_priest = {
				random_traits = yes
				religion = elven_tribunal
				culture = dark_elven
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				k_dark_elven_church = {
					grant_title = PREV
				}
			}
		}
	}
}

character_event = { #Dark Elven Heresy Church
    id = EADI.70
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = {
			has_global_flag = dunmer_araby
			has_global_flag = dunmer_iraq
			has_global_flag = dunmer_persia
			has_global_flag = dunmer_hejaz
		}	
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = k_dark_elven_heresy_church status = yes }		
			create_random_priest = {
				random_traits = yes
				religion = elven_tribunal_heresy
				culture = dark_elven
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				k_dark_elven_heresy_church = {
					grant_title = PREV
				}
			}
		}
	}
}

character_event = { #Dwarven Church
    id = EADI.71
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = {
			has_global_flag = dwarfs_hungary
			has_global_flag = dwarfs_switzerland
			has_global_flag = dwarfs_balkans
			has_global_flag = dwarfs_ural
		}
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = k_dwarven_church status = yes }		
			create_random_priest = {
				random_traits = yes
				religion = dwarven
				culture = dwarven_dawi
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				k_dwarven_church = {
					grant_title = PREV
				}
			}
		}
	}
}

character_event = { #Ordinators, I mean, Overseers
    id = EADI.72
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = {
			has_global_flag = dunmer_araby
			has_global_flag = dunmer_iraq
			has_global_flag = dunmer_persia
			has_global_flag = dunmer_hejaz
		}	
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = d_overseers status = yes }		
			create_random_soldier = {
				random_traits = yes
				religion = elven_tribunal
				culture = dark_elven
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				d_overseers = {
					grant_title = PREV
				}
			}
		}
	}
}

character_event = { #Dark Elven Assassins
    id = EADI.73
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = {
			has_global_flag = dunmer_araby
			has_global_flag = dunmer_iraq
			has_global_flag = dunmer_persia
			has_global_flag = dunmer_hejaz
		}	
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = d_dark_elves_assassins status = yes }		
			create_random_intriguer = {
				random_traits = yes
				name = Eno
				religion = elven_tribunal
				culture = dark_elven
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				d_dark_elves_assassins = {
					grant_title = PREV
				}
				join_society = dark_elven_assassins
			}
		}
	}
}

character_event = { #Golden Eagle Guard
    id = EADI.74
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = { 
			has_global_flag = elves_britain
			has_global_flag = elves_france
			has_global_flag = elves_german
			has_global_flag = elves_russia			
		}
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = d_golden_eagle_guard status = yes }		
			create_random_soldier = {
				random_traits = yes
				religion = elven
				culture = high_elven
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				d_golden_eagle_guard = {
					grant_title = PREV
				}
			}
		}
	}
}

character_event = { #Guardians of Knowledge
    id = EADI.75
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = {
			has_global_flag = dwemer_gilan
			has_global_flag = dwemer_georgia
			has_global_flag = dwemer_afgan
			#has_global_flag = dwemer_tibet
		}
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = d_guardians_of_knowledge status = yes }		
			create_random_priest = {
				random_traits = yes
				religion = dwarven_dwemer
				culture = dark_dwarven
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				d_guardians_of_knowledge = {
					grant_title = PREV
				}
			}
		}
	}
}

character_event = { #Lore Keepers
    id = EADI.76
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = {
			has_global_flag = dwarfs_hungary
			has_global_flag = dwarfs_switzerland
			has_global_flag = dwarfs_balkans
			has_global_flag = dwarfs_ural
		}
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = d_lore_keepers status = yes }		
			create_random_soldier = {
				random_traits = yes
				religion = dwarven
				culture = dwarven_dawi
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				d_lore_keepers = {
					grant_title = PREV
				}
			}
		}
	}
}

character_event = { #Medjeray
    id = EADI.77
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = {
			has_global_flag = cat_folk_egypt
			has_global_flag = cat_folk_tunis
			has_global_flag = cat_folk_magreeb
			has_global_flag = cat_folk_lybia
		}
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = d_cat_folk_holy_order status = yes }		
			create_random_soldier = {
				random_traits = yes
				religion = cat_folk_religion
				culture = cat_folk
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				d_cat_folk_holy_order = {
					grant_title = PREV
				}
			}
		}
	}
}

character_event = { #Solar Church
    id = EADI.78
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = {
			has_global_flag = cat_folk_egypt
			has_global_flag = cat_folk_tunis
			has_global_flag = cat_folk_magreeb
			has_global_flag = cat_folk_lybia
		}
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = d_cat_folk_church status = yes }		
			create_random_soldier = {
				random_traits = yes
				religion = cat_folk_religion
				culture = cat_folk
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				d_cat_folk_church = {
					grant_title = PREV
				}
			}
		}
	}
}

character_event = { #Blood Cult
    id = EADI.79
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    NOR = {
			has_global_flag = blood_elves_scandinavia #272
			has_global_flag = blood_elves_russia #1820
		}
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = d_blood_cult status = yes }		
			create_random_priest = {
				random_traits = yes
				religion = elven_heresy
				culture = blood_elven
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				d_blood_cult = {
					grant_title = PREV
				}
			}
		}
	}
}

character_event = { #Nurutushian
    id = EADI.80
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = {
			has_global_flag = dwemer_gilan
			has_global_flag = dwemer_georgia
			has_global_flag = dwemer_afgan
			#has_global_flag = dwemer_tibet
		}
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = d_dwarven_dwemer_heresy_church status = yes }		
			create_random_priest = {
				random_traits = yes
				religion = dwarven_dwemer_heresy
				culture = dark_dwarven
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				d_dwarven_dwemer_heresy_church = {
					grant_title = PREV
				}
			}
		}
	}
}

character_event = { #Cult of Hazhut 
    id = EADI.81
	
	hide_window = yes

	is_triggered_only = yes
	
	major = yes
	
	trigger = { 
	    OR = {
			has_global_flag = dwemer_gilan
			has_global_flag = dwemer_georgia
			has_global_flag = dwemer_afgan
			#has_global_flag = dwemer_tibet
		}
	}
	
	immediate = {
	    hidden_tooltip = {
			activate_title = { title = d_dwarven_dwemer_heresy_hashut_church status = yes }		
			create_random_priest = {
				random_traits = yes
				religion = dwarven_dwemer_heresy_hashut
				culture = dark_dwarven
				dynasty = NONE
				female = no
				age = 40
			}
			new_character = {
				prestige = 300
				wealth = 300
				d_dwarven_dwemer_heresy_hashut_church = {
					grant_title = PREV
				}
			}
		}
	}
}

######
#Orcs#
######

narrative_event = {#Orcs
	id = EADI.82
	title = "EVTNAME_EADI_082"
	desc = "EVTDESC_EADI_082"
	picture = GFX_evt_orcish_gates
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	min_age = 16
	show_root = no
	hide_from = yes
	
	trigger = { #Only will start if there is a powerfull dark elven emperor
		
		controls_religion = yes # Let it happen for the Pope. He's always around.
		NOR = {
			has_global_flag = orc_mongolia #1456
			has_global_flag = orc_uyghuristan #1446
		}
		has_global_flag = orcs_ready
	}
	
	mean_time_to_happen = {
	    months = 1
	}
	
	immediate = {
		random_list = {
			50 = {
				set_global_flag = orc_mongolia
			}
			50 = {
				set_global_flag = orc_uyghuristan
			}
		}
		create_character = {
			dynasty = 1256131 #Azorku
			name = Shamar
			culture = oruk
			religion = orc_religion
			attributes = {
				martial = 15
			    diplomacy = 10
				stewardship = 15
				intrigue = 7
				learning = 10
			}
            health = 7
			fertility = 0.8
			trait = brilliant_strategist
            trait = wroth
            trait = just
            trait = cruel
            trait = strong
            trait = adventurer
            trait = robust			
			trait = inspiring_leader
			trait = flat_terrain_leader
		}
		#give him a random boost
		new_character = {
		    wealth = 12000
			prestige = 5000
			
			save_global_event_target_as = invasion_leader
			e_orcish_horde = {
				grant_title = PREV
			}
			if = {
				limit = {
					has_dlc = "Horse Lords"
				}
					set_government_type = nomadic_government
				}
			else_if = {
				limit = {
					NOT = { has_dlc = "Horse Lords" }
				}
					set_government_type = tribal_government
			}
			character_event = { id = 60515 days = 1 } # Spawn population
			set_defacto_liege = THIS
			set_character_flag = otherworlden_migrator
		}
		#Ativate titles
		character_event = {	id = EADTITLE.7	}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_082
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_082_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the orcs invade Mongolia
	id = EADI.83
	title = "EVTNAME_EADI_083"
	desc = "EVTDESC_EADI_083"
	picture = GFX_evt_battle_oruk
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = orc_mongolia
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = orc_mongolia_invaded
			has_global_flag = orc_uyghuristan_invaded
			#has_global_flag = ashlander_cumania
			#has_global_flag = ashlander_khazaria
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = orc_mongolia_invaded }
			}
			set_global_flag = orc_mongolia_invaded
				1456 = { # 
					kingdom = {
						e_orcish_horde = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_orcish_horde = {
				holder_scope = {
					character_event = { id = EADI.85 } # Spawn courtiers
    				character_event = { id = EADI.86 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places				
			    }
	   	    }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_083
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_083_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the orcs invade Uyghuristan
	id = EADI.84
	title = "EVTNAME_EADI_084"
	desc = "EVTDESC_EADI_084"
	picture = GFX_evt_battle_oruk
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = orc_uyghuristan
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = orc_mongolia_invaded
			has_global_flag = orc_uyghuristan_invaded
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = orc_mongolia_invaded }
			}
			set_global_flag = orc_mongolia_invaded
				1456 = { # 
					kingdom = {
						e_orcish_horde = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_orcish_horde = {
				holder_scope = {
					character_event = { id = EADI.85 } # Spawn courtiers
    				character_event = { id = EADI.86 } # Spawn troops	
                    character_event = { id = EADI.45 } # Assign gods names and holy places						
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_083
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_083_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

character_event = {
	id = EADI.85
	title = "EVTNAMEINVADERS3"
	desc = "EVTDESCINVADERS3"
	picture = GFX_evt_battle_oruk
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_orcish_horde }
	}	
	immediate = {
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = no
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = no
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = no
			age = 25
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = no
			age = 26
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = no
			age = 28
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = yes
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = yes
			age = 17
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = yes
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = no
			age = 27
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = no
			age = 51
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = no
			age = 44
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion
			culture = oruk
			female = no
			age = 24
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
	}
	option = {
		name = "EVTOPTA_INVADERS3"
	}
}
	
character_event = {#Invader gets their troops
	id = EADI.86
	title = "EVTNAMEINVADERS4"
	desc = "EVTDESCINVADERS4"
	picture = GFX_evt_battle_oruk
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_orcish_horde }
	}
	
	immediate = {
		if = {
			limit = {
				has_global_flag = orc_mongolia_invaded
			}
			spawn_unit = {
				province = 1456 # Berek - Carpathians mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 1456 # Berek - Carpathians mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
            spawn_unit = {
				province = 1456 # Berek - Carpathians mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
            spawn_unit = {
				province = 1456 # Berek - Carpathians mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
            spawn_unit = {
				province = 1456 # Berek - Carpathians mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 1456 # Berek - Carpathians mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}	
			spawn_unit = {
				province = 1456 # Berek - Carpathians mountains
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}				
		}
		else_if = {
			limit = {
				has_global_flag = orc_uyghuristan_invaded
			}
			spawn_unit = {
				province = 1446 # Schwyz - Apls
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 1446 # Schwyz - Apls
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
            spawn_unit = {
				province = 1446 # Schwyz - Apls
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 1446 # Schwyz - Apls
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
            spawn_unit = {
				province = 1446 # Schwyz - Apls
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 1446 # Schwyz - Apls
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
			spawn_unit = {
				province = 1446 # Schwyz - Apls
				troops =
				{
				light_cavalry = { 2750 2750 }
				horse_archers = { 2250 2250 }
				knights = { 500 500 }
			    }
			}
		}		
	}
	option = {
		name = "EVTOPTA_INVADERS4"
	}	
}

narrative_event = {#Notification that the orcs achieve victory
    id = EADI.87
	title = "EADITITLE87"
	desc = "EADIDESC87"
	picture = GFX_evt_battle_oruk
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_orcish_horde }
		is_landed = yes
		NOT = { has_global_flag = orcish_horde_landed }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
	    ROOT = { 
            save_event_target_as = leader_of_orcish_invasion
            primary_title = { 
			    set_title_landless = { title = THIS status = no }
		    }			
        }
	    set_global_flag = orcish_horde_landed
		set_global_flag = everyone_invaded
	}
	
	option = {
		name = "EVTOPTA_EADI_87_A"
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = "EVTOPTB_EADI_87_A"
		trigger = {
			is_fantasy_culture = yes
		}
	}
	option = {
	    name = EVTOPTA_EADI_87_B
		tooltip_info = yes
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
        if = {
            limit = {
                event_target:leader_of_orcish_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_orcish_invasion
            }
		}	
	}
	
	option = {
	    name = EVTOPTB_EADI_87_B
		tooltip_info = yes
		trigger = {
			is_fantasy_culture = yes
		}
        if = {
            limit = {
                event_target:leader_of_orcish_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_orcish_invasion
            }
		}	
	}
}

narrative_event = {#Notification that the orcs was defeated
    id = EADI.88
	title = "EADITITLE88"
	desc = "EADIDESC88"
	picture = GFX_evt_battle_oruk
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_orcish_horde }
		NOT = { has_global_flag = orcish_horde_defeated }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
		set_global_flag = orcish_horde_defeated
        primary_title = {
			activate_title = { title = e_orcish_horde status = no }
			destroy_landed_title = e_orcish_horde
		}
        set_global_flag = everyone_invaded
	}
	
	option = {
		name = "EVTOPTA_EADI_46_A"
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = "EVTOPTA_EADI_46_F"
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

##########
#Oruk Hay#
##########

narrative_event = {#Orcs, but civilized
	id = EADI.89
	title = "EVTNAME_EADI_089"
	desc = "EVTDESC_EADI_089"
	picture = GFX_evt_battle_oruk_hai
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	min_age = 16
	show_root = no
	hide_from = yes
	
	trigger = { 
		
		has_global_flag = everyone_invaded
		has_global_flag = orcish_horde_landed
	    OR = {
    		AND = { 
			    e_orcish_horde = { has_holder = yes } 
			    is_landed = yes
			}
			OR = {
			    any_independent_ruler = {
				    culture = oruk
					is_landed = yes
					tier = EMPEROR
				}
				ROOT = {
			        culture = oruk
					independent = yes
					tier = EMPEROR
			    }
			}
		}
		NOR = {
			has_global_flag = oruk_hai_bengal #1484
			has_global_flag = oruk_hai_pamir #1465
		}
	}
	
	mean_time_to_happen = {
	    years = 5
	}
	
	immediate = {
		random_list = {
			50 = {
				set_global_flag = oruk_hai_bengal
			}
			50 = {
				set_global_flag = oruk_hai_pamir
			}
		}
	}
	
	option = {
		name = "EVTOPTA_EADI_051"
	}
}

narrative_event = {#Notification that the oruk hai invade Bengal
	id = EADI.90
	title = "EVTNAME_EADI_090"
	desc = "EVTDESC_EADI_090"
	picture = GFX_evt_battle_oruk_hai
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = oruk_hai_bengal
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = oruk_hai_pamir
			has_global_flag = oruk_hai_bengal_invaded
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
	    activate_title = { title = e_orcish_empire status = yes }			
		create_character = { #Generic oruk hai warlord
			age = 27
			random_traits = yes
				female = no
				religion = orc_religion_dark_lord
				culture = oruk_hai
				dynasty = actually_culture
				trait = brilliant_strategist
				martial = 10
			}
		#give him a random boost
		new_character = {
		    wealth = 1000
			prestige = 1000
			
			save_global_event_target_as = invasion_leader
			e_orcish_empire = {
				grant_title = PREV
			}
			set_government_type = feudal_government
			e_orcish_empire = {
				add_law = succ_primogeniture
				add_law = true_cognatic_succession
				if = {
					limit = {
						has_dlc = "Zeus"
					}
					add_law = revoke_title_law_2
				}
				if = {
					limit = {
						NOT = { has_dlc = "Zeus" }
					}
					add_law = crown_authority_1
	    		}
			}
			set_defacto_liege = THIS
			set_character_flag = otherworlden_migrator
		}
		if = {
			limit = {
				NOT = { has_global_flag = oruk_hai_bengal_invaded }
			}
			set_global_flag = oruk_hai_bengal_invaded		
				1484 = { # 
					kingdom = {
						e_orcish_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_orcish_empire = {
				holder_scope = {
					character_event = { id = EADI.92 } # Spawn courtiers
    				character_event = { id = EADI.93 } # Spawn troops					
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_052
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_052_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

narrative_event = {#Notification that the oruk hai invade Pamir
	id = EADI.91
	title = "EVTNAME_EADI_091"
	desc = "EVTDESC_EADI_091"
	picture = GFX_evt_battle_oruk_hai
	border = "GFX_event_narrative_frame_war"
	major = yes
	
	only_playable = yes
	religion = catholic
	min_age = 16
	has_global_flag = oruk_hai_pamir
	portrait = event_target:invasion_leader
	show_root = no
	hide_from = yes
	
	trigger = {
		controls_religion = yes
		NOR = {
			has_global_flag = oruk_hai_bengal
			has_global_flag = oruk_hai_pamir_invaded
		}
	}
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
	    activate_title = { title = e_orcish_empire status = yes }			
		create_character = { #Generic oruk hai warlord
			age = 27
			random_traits = yes
				female = no
				religion = orc_religion_dark_lord
				culture = oruk_hai
				dynasty = actually_culture
				trait = brilliant_strategist
				martial = 10
			}
		#give him a random boost
		new_character = {
		    wealth = 1000
			prestige = 1000
			
			save_global_event_target_as = invasion_leader
			e_orcish_empire = {
				grant_title = PREV
			}
			set_government_type = feudal_government
			e_orcish_empire = {
				add_law = succ_primogeniture
				add_law = true_cognatic_succession
				if = {
					limit = {
						has_dlc = "Zeus"
					}
					add_law = revoke_title_law_2
				}
				if = {
					limit = {
						NOT = { has_dlc = "Zeus" }
					}
					add_law = crown_authority_1
	    		}
			}
			set_defacto_liege = THIS
			set_character_flag = otherworlden_migrator
		}
		if = {
			limit = {
				NOT = { has_global_flag = oruk_hai_pamir_invaded }
			}
			set_global_flag = oruk_hai_pamir_invaded		
				1465 = { # 
					kingdom = {
						e_orcish_empire = {
							holder_scope = {
								war = {
									casus_belli = fantasy_migration
									target = PREVPREVPREV # The top liege of the owner of the province
									thirdparty_title = PREVPREV # The de jure kingdom
								}
							}
						}
					}
				}					
			e_orcish_empire = {
				holder_scope = {
					character_event = { id = EADI.92 } # Spawn courtiers
    				character_event = { id = EADI.93 } # Spawn troops					
			    }
	   	    }
		}
	}
	option = {
		name = {
			text = EVTOPTA_EADI_052
		}
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_EADI_052_F
		}
		trigger = {
			is_fantasy_culture = yes
		}
	}
}

character_event = {
	id = EADI.92
	title = "EVTNAMEINVADERS3"
	desc = "EVTDESCINVADERS3"
	picture = GFX_evt_battle_elven
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_orcish_empire }
	}	
	immediate = {
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = no
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = no
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = no
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = no
			age = 25
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = no
			age = 26
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = no
			age = 28
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = yes
			age = 16
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = yes
			age = 17
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = yes
			age = 18
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = yes
			age = 20
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = no
			age = 27
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = no
			age = 51
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = no
			age = 44
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
		create_character = {
			random_traits = yes
			dynasty = none
			religion = orc_religion_dark_lord
			culture = oruk_hai
			female = no
			age = 24
			attributes = {
				martial = 12
			}
			trait = brilliant_strategist
		}
	}
	option = {
		name = "EVTOPTA_INVADERS3"
	}
}
	
character_event = {#Invader gets their troops
	id = EADI.93
	title = "EVTNAMEINVADERS4"
	desc = "EVTDESCINVADERS4"
	picture = GFX_evt_battle_elven
	hide_window = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_orcish_empire }
	}
	
	immediate = {
		if = {
			limit = {
				has_global_flag = oruk_hai_bengal_invaded
			}
			spawn_unit = {
				province = 1484 # 
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 3000 3000 }
					heavy_infantry = { 2000 2000 }
					archers = { 2000 2000 }
					knights = { 500 500 }
				}
			}
			spawn_unit = {
				province = 1484 # 
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 3000 3000 }
					heavy_infantry = { 2000 2000 }
					archers = { 2000 2000 }
					knights = { 500 500 }
				}
			}
			spawn_unit = {
				province = 1484 # 
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 3000 3000 }
					heavy_infantry = { 2000 2000 }
					archers = { 2000 2000 }
					knights = { 500 500 }
				}
			}
			spawn_unit = {
				province = 1484 # 
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 3000 3000 }
					heavy_infantry = { 2000 2000 }
					archers = { 2000 2000 }
					knights = { 500 500 }
				}
			}
            spawn_fleet = {
				province = closest # closest sea zone
				disband_on_peace = yes
				troops =
				{
					galleys = { 400 400 }
				}
			}			
		}
		else_if = {
			limit = {
				has_global_flag = oruk_hai_pamir_invaded
			}
			spawn_unit = {
				province = 1465 # 
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 3000 3000 }
					heavy_infantry = { 2000 2000 }
					archers = { 2000 2000 }
					knights = { 500 500 }
				}
			}
			spawn_unit = {
				province = 1465 # 
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 3000 3000 }
					heavy_infantry = { 2000 2000 }
					archers = { 2000 2000 }
					knights = { 500 500 }
				}
			}
			spawn_unit = {
				province = 1465 # 
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 3000 3000 }
					heavy_infantry = { 2000 2000 }
					archers = { 2000 2000 }
					knights = { 500 500 }
				}
			}
			spawn_unit = {
				province = 1465 # 
				troops =
				{
					light_cavalry = { 1000 1000 }
					light_infantry = { 3000 3000 }
					heavy_infantry = { 2000 2000 }
					archers = { 2000 2000 }
					knights = { 500 500 }
				}
			}
            spawn_fleet = {
				province = closest # closest sea zone
				disband_on_peace = yes
				troops =
				{
					galleys = { 400 400 }
				}
			}			
		}		
	}
	option = {
		name = "EVTOPTA_INVADERS4"
	}	
}

narrative_event = {#Notification that the oruk hai achieve victory
    id = EADI.94
	title = "EADITITLE94"
	desc = "EADIDESC94"
	picture = GFX_evt_battle_oruk_hai
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_orcish_empire }
		is_landed = yes
		NOT = { has_global_flag = oruk_empire_landed }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
	    ROOT = { 
            save_event_target_as = leader_of_oruk_invasion
			primary_title = { 
			    set_title_landless = { title = THIS status = no }
		    }
        }
	    set_global_flag = oruk_empire_landed
	}
	
	option = {
		name = "EVTOPTA_EADI_94_A"
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
	}
	
	option = {
		name = "EVTOPTA_EADI_94_F"
		trigger = {
			is_fantasy_culture = yes
		}
	}
	
	option = {
	    name = EVTOPTA_EADI_94_B
		tooltip_info = yes
		trigger = {
			NOT = { is_fantasy_culture = yes }
		}
        if = {
            limit = {
                event_target:leader_of_oruk_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_oruk_invasion
            }
		}	
	}
	
	option = {
	    name = EVTOPTA_EADI_94_B_F
		tooltip_info = yes
		trigger = {
			is_fantasy_culture = yes
		}
        if = {
            limit = {
                event_target:leader_of_oruk_invasion = {
                    ai = yes
                    is_alive = yes
                }
            }
            custom_tooltip = {
                text = player_character_invasion_leader
                set_player_character = event_target:leader_of_oruk_invasion
            }
		}	
	}
}

narrative_event = {#Notification that the oruk hai was defeated
    id = EADI.95
	title = "EADITITLE95"
	desc = "EADIDESC95"
	picture = GFX_evt_battle_oruk_hai
	major = yes

	is_triggered_only = yes
	trigger = {
		primary_title = { title = e_orcish_empire }
		NOT = { has_global_flag = oruk_empire_defeated }
	}
	major_trigger = {
		ai = no
	}
	
	immediate = {
		set_global_flag = oruk_empire_defeated
        primary_title = {
			activate_title = { title = e_orcish_empire status = no }
			destroy_landed_title = e_orcish_empire
		}
        set_global_flag = everyone_invaded
	}
	
	option = {
		name = "EVTOPTA_EADI_95_A"
	}
}