namespace = RAG

character_event = { #Ragnarr a decendent of the gods
	id = RAG.2
	hide_window = yes
	is_triggered_only = yes
	only_men = yes
	min_age = 32
	immediate = {
		any_child = {
			limit = {
				is_female = no
				is_adult = yes
			}
			character_event = {id = TOG.3135}
		}
	}
	
}

character_event = { #Ragnarr the decendent of the gods
	id = RAG.1
	desc = RAG1
	picture = GFX_evt_vikings_arriving_oldgods
	is_triggered_only = yes
	option = {
		if = {
			limit = {
				OR = {
					has_game_rule = {
						name = supernatural_events
						value = unrestricted
					}
					has_game_rule = {
						name = supernatural_events
						value = on
					}
				}
			}
			add_trait = immortal
		}
		add_trait = berserker
		name = RAG1A
		hidden_tooltip = { character_event = { id = RAG.1000 days = 6000 random = 250 } }
	}
	
}
character_event = {
	id = RAG.1000
	desc = RAG1000
	picture = GFX_evt_lovers

	is_triggered_only = yes
	
	only_men = yes
	
	immediate = {
		create_character = {
			name="Aslaug" # Aka Kraka or Randalin
			dna = gdazbjynnbx
			properties = gglfck000000
			random_traits = no
			female = yes
			age = 16
			religion = norse_pagan
			culture = norse
			fertility = -10.0
			attributes = {
				diplomacy = 7
				martial = 7
				stewardship = 7
				intrigue = 5
				learning = 7
			}
			health = 12
			trait=fair
			trait=quick
			trait=zealous
			trait=temperate
			trait=mystic
			trait=midas_touched
		}
		new_character = {
			fertility = -10.0
			add_artifact = gramr
			save_event_target_as = aslaug
			set_character_flag = is_aslaug
		}
	}
	
	option = {
		ai_chance = {
			factor = 100
		}
		event_target:aslaug = {
			add_lover = ROOT
			add_friend = ROOT
			give_minor_title = title_volva
		}
		hidden_tooltip = {
			character_event = { #Aslaug brings Ivar Halfdan Sigurdr
				id = RAG.1001
				days = 8395
			}
		}
		name = RAG1000A
	}
	
	option = {
		ai_chance = {
			factor = 0
		}
		hidden_tooltip = {
			event_target:aslaug = {
				death = {
					death_reason = death_missing
				}
			}
		}
		name = RAG1000B
	}
}

character_event = {
	id = RAG.1001
	desc = RAG1001
	picture = GFX_evt_pregnancy

	is_triggered_only = yes
	trigger = {
		event_target:aslaug = {
			is_alive = yes
		}
	}
	
	option = {
		create_character = {
			name=Ivar # The Boneless
			dynasty = 20084
			age = 24
			
			dna = gdtznjynibb
			properties = ej0dgd000000
			religion = norse_pagan
			culture = norse
			random_traits = no
			attributes = {
				martial=8
				stewardship=8
				diplomacy=7
				intrigue=5
				learning=3
			}
			trait=ambitious
			trait=hunter
			trait=strong
			trait=brave
			trait=immortal_warlord
			trait = dynasty_founder
		}
		hidden_tooltip = {
			new_character = {
				add_trait = axe4
				add_trait = combat_exp
				add_trait = heavy_infantry_leader
				add_trait = berserker
				add_trait = seaking
				set_character_flag = wpn
				give_nickname = nick_the_boneless
				add_trait = robust
				set_father = ROOT
				set_mother = event_target:aslaug
				character_event = {id = RAG.1100 days = 4000 random = 250}
			}
		}
		create_character = {
			name="Bjrn" # Bjrn Ironside
			dynasty=502
			age = 20
			dna = udhvsvadurz
			properties = gj0ejd000000
			religion="norse_pagan"
			culture=norse
			random_traits = no
			attributes = {
				martial = 7
				stewardship=5
				diplomacy = 8
				intrigue = 3
				learning = 3
			}
			trait=brave
			trait=temperate
			trait=hunter
			trait="charismatic_negotiator"
			trait=viking
		}
		hidden_tooltip = {
			new_character = {
				add_trait = ulfberht2
				add_trait = combat_exp
				set_character_flag = wpn
				give_nickname = nick_the_ironside
				set_father = ROOT
				set_mother = event_target:aslaug
			}
		}
		create_character = {
			name="Halfdan" # Ragnarsson 'Hvitserk'
			dynasty = 7514
			age = 17
			dna = tctbpftnsvn
			properties = tg0djd000000
			religion="norse_pagan"
			culture=norse
			random_traits = no
			attributes = {
				martial=7
				stewardship=6
				diplomacy=4
				intrigue=5
				learning=3
			}
			trait=ambitious
			trait=hunter
			trait=wroth
			trait=cruel
			trait=viking
			trait=skilled_tactician
			trait = dynasty_founder
		}
		hidden_tooltip = {
			new_character = {
				add_trait = spear2
				add_trait = combat_exp
				add_trait = ravager
				add_trait = flanker
				add_trait = light_foot_leader
				set_character_flag = wpn
				set_father = ROOT
				set_mother = event_target:aslaug
				give_nickname = nick_whiteshirt
				character_event = {id = RAG.1200 days = 8000 random = 500}
			}
		}
		create_character = {
			name="Sigurdr" # Snake-in-the-eye
			dynasty=490
			dna = gdarbjynnbx
			properties = gi0ced000000
			religion="norse_pagan"
			culture=norse
			age = 0
			random_traits = no
			trait = dynasty_founder
			attributes = {
				martial=6
				stewardship=8
				diplomacy=8
				intrigue=5
				learning=3
			}
		}
		hidden_tooltip = {
			new_character = {
				set_father = ROOT
				set_mother = event_target:aslaug
				give_nickname = nick_snake_in_the_eye
				character_event = {id = RAG.1300 days = 6200 random = 250}
			}
		}
		name = RAG1001A
	}
}

#Isles
character_event = {
	id = RAG.1100
	
	hide_window = yes # Only fires for unplayable landless characters
	hide_from = yes
	is_triggered_only = yes
	
	trigger = {
		is_landed = no
		NOT = { has_character_modifier = planning_duchy_adventure }
	}
	
	immediate = {
		if = {
			limit = { prisoner = yes }
			imprison = no
		}
		random_independent_ruler = {
			limit = {
				in_revolt = no
				NOT = {religion_group = pagan_group}
				any_realm_province = {
					county = {
						title = c_innse_gall
					}
				}
			}
			
			random_realm_province = {
				limit = {
					county = {
						title = c_innse_gall
					}
				}
				
				ROOT = {
					character_event = {
						id = RAG.1101 # Fire the attack
						days = 700
					}
					opinion = {
						who = PREVPREV
						months = 36
						modifier = opinion_duchy_adventure_target
					}
					reverse_opinion = {
						who = PREVPREV
						months = 36
						modifier = rsp
					}
					add_character_modifier = {
						name = planning_duchy_adventure
						hidden = yes
						duration = 730
					}
					
				}
				PREV = {
					character_event = {
						id = TOG.1211 # Warn the target
					}
				}
			}
		}
		if = {
			limit = { trait = in_hiding	}
			remove_trait = in_hiding
			add_character_modifier = {
				name = went_out_of_hiding_timer
				duration = 180
				hidden = yes
			}
			hidden_tooltip = { character_event = { id = CM.6400 } } # Notify plotters and family
		}
		character_event = { id = TOG.1215 days = 30 }
	}

}


character_event = {
	id = RAG.1101
	
	hide_window = yes # Only fires for unplayable landless characters
	
	is_triggered_only = yes
	prisoner = no
	
	trigger = {
		is_landed = no
		
		NOT = { trait = incapable }

		any_independent_ruler = {
			any_realm_province = {
				county = {
					title = c_innse_gall
				}
			}
			has_opinion_modifier = {
				who = ROOT
				modifier = rsp
			}
		 }
	}
	
	immediate = {
		wealth = 1000
		clr_character_flag = do_not_disturb
		
		liege = {
			character_event = {
				id = TOG.1213
				days = 1
			}
		}
		
		liege = {
			capital_scope = {
				random_independent_ruler = {
					limit = {
						any_realm_province = {
							county = {
								title = c_innse_gall
							}
						}
						
						has_opinion_modifier = {
							who = ROOT
							modifier = rsp
						}
					}
					random_realm_province = {
						limit = {
							county = {
								title = c_innse_gall
							}
						}
						
						ROOT = {
							add_trait = adventurer
							set_character_flag = duchy_adventurer
							
							set_defacto_liege = ROOT
							set_government_type = tribal_government
							create_title = {
								tier = DUKE
								landless = yes
								temporary = yes
								culture = ROOT
								name = "VIKING_CONQUEST"
								holder = ROOT
							}
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 1250 1250 }
									archers = { 1140 1140 }
								}
								attrition = 0.25
							}
							
							# Create a fleet, just to be sure
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 20 20 }
								}
							}
							
							
							
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 1250 1250 }
									archers = { 1140 1140 }
								}
								attrition = 0.25
							}
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								
								troops =
								{
									galleys = { 20 20 }
								}
							}
							
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 1350 1350 }
									archers = { 1140 1140 }
								}
								attrition = 0.25
							}
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 1350 1350 }
									archers = { 1140 1140 }
								}
								attrition = 0.25
							}
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 1250 1250 }
									archers = { 1390 1390 }
								}
								attrition = 0.25
							}
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 30 30 }
								}
							}
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 30 30 }
								}
							}
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 30 30 }
								}
							}
							war = {
								target = PREVPREV
								casus_belli = duchy_adventure
								thirdparty_title = PREV
								tier = DUKE
							}
							remove_opinion = {
								who = PREVPREV
								modifier = opinion_duchy_adventure_target
							}
							reverse_remove_opinion = {
								who = PREVPREV
								modifier = rsp
							}
						}
					}
				}
			}
		}
		
		# Create some decent commander characters
		create_random_soldier = {
			random_traits = no
			dynasty = none
			religion = ROOT
			culture = ROOT
			female = no
		}
		new_character = {
			add_trait = combat_exp
			add_trait = axe3
			add_trait = born_lowborn
			set_character_flag = wpn
		}
		create_random_soldier = {
			random_traits = yes
			dynasty = none
			religion = ROOT
			culture = ROOT
			female = no
		}
		new_character = {
			add_trait = spear2
			add_trait = born_lowborn
			set_character_flag = wpn

		}
		
		
		
	}
	
	option = {
		name = OK
	}
}

#York
character_event = {
	id = RAG.1200
	
	hide_window = yes # Only fires for unplayable landless characters
	hide_from = yes
	is_triggered_only = yes
	
	trigger = {
		is_landed = no
		NOT = { has_character_modifier = planning_duchy_adventure }
	}
	
	immediate = {
		if = {
			limit = { prisoner = yes }
			imprison = no
		}
		random_independent_ruler = {
			limit = {
				in_revolt = no
				NOT = {religion_group = pagan_group}
				any_realm_province = {
					county = {
						title = c_york
					}
				}
			}
			
			random_realm_province = {
				limit = {
					county = {
						title = c_york
					}
				}
				
				ROOT = {
					character_event = {
						id = RAG.1201 # Fire the attack
						days = 700
					}
					opinion = {
						who = PREVPREV
						months = 36
						modifier = opinion_duchy_adventure_target
					}
					reverse_opinion = {
						who = PREVPREV
						months = 36
						modifier = rsp
					}
					add_character_modifier = {
						name = planning_duchy_adventure
						hidden = yes
						duration = 730
					}
					
				}
				PREV = {
					character_event = {
						id = TOG.1211 # Warn the target
					}
				}
			}
		}
		if = {
			limit = { trait = in_hiding	}
			remove_trait = in_hiding
			add_character_modifier = {
				name = went_out_of_hiding_timer
				duration = 180
				hidden = yes
			}
			hidden_tooltip = { character_event = { id = CM.6400 } } # Notify plotters and family
		}
		character_event = { id = TOG.1215 days = 30 }
	}

}


character_event = {
	id = RAG.1201
	
	hide_window = yes # Only fires for unplayable landless characters
	
	is_triggered_only = yes
	prisoner = no
	
	trigger = {
		is_landed = no
		
		NOT = { trait = incapable }

		any_independent_ruler = {
			any_realm_province = {
				county = {
					title = c_york
				}
			}
			has_opinion_modifier = {
				who = ROOT
				modifier = rsp
			}
		 }
	}
	
	immediate = {
		wealth = 1000
		clr_character_flag = do_not_disturb
		
		liege = {
			character_event = {
				id = TOG.1213
				days = 1
			}
		}
		
		liege = {
			capital_scope = {
				random_independent_ruler = {
					limit = {
						any_realm_province = {
							county = {
								title = c_york
							}
						}
						
						has_opinion_modifier = {
							who = ROOT
							modifier = rsp
						}
					}
					random_realm_province = {
						limit = {
							county = {
								title = c_york
							}
						}
						
						ROOT = {
							add_trait = adventurer
							set_character_flag = duchy_adventurer
							
							set_defacto_liege = ROOT
							set_government_type = tribal_government
							create_title = {
								tier = DUKE
								landless = yes
								temporary = yes
								culture = ROOT
								name = "VIKING_CONQUEST"
								holder = ROOT
							}
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 1250 1250 }
									archers = { 1140 1140 }
								}
								attrition = 0.25
							}
							
							# Create a fleet, just to be sure
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 20 20 }
								}
							}
							
							
							
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 2250 2250 }
									archers = { 140 140 }
								}
								attrition = 0.25
							}
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								
								troops =
								{
									galleys = { 30 30 }
								}
							}
							
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 2350 2350 }
									archers = { 140 140 }
								}
								attrition = 0.25
							}
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 2350 2350 }
									archers = { 2140 2140 }
								}
								attrition = 0.25
							}
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 2250 2250 }
									archers = { 3390 3390 }
								}
								attrition = 0.25
							}
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 25 25 }
								}
							}
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 35 35 }
								}
							}
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 60 60 }
								}
							}
							war = {
								target = PREVPREV
								casus_belli = duchy_adventure
								thirdparty_title = PREV
								tier = DUKE
							}
							remove_opinion = {
								who = PREVPREV
								modifier = opinion_duchy_adventure_target
							}
							reverse_remove_opinion = {
								who = PREVPREV
								modifier = rsp
							}
						}
					}
				}
			}
		}
		
		# Create some decent commander characters
		create_character = {
			name = "Ragnarr"
			age = 21
			random_traits = yes
			dynasty = 7514
			religion = ROOT
			culture = ROOT
			female = no
		}
		new_character = {
			
			add_trait = axe3
			add_trait = combat_exp
			set_character_flag = wpn
			add_trait = kin_by_oath
			set_father = ROOT
		}
		create_character = {
			name = "Sigfri"
			age = 23
			random_traits = yes
			dynasty = 7514
			religion = ROOT
			culture = ROOT
			female = no
		}
		new_character = {
			add_trait = spear2
			add_trait = combat_exp
			set_character_flag = wpn
			add_trait = kin_by_oath
			set_father = ROOT
		}
		
		create_character = {
			name="Gurum" # Founder of Danelaw
			age = 24
			dynasty=7514
			random_traits = no
			religion=norse_pagan
			culture=ROOT
			attributes = {
				martial=10
				stewardship=3
				diplomacy=2
				intrigue=8
				learning=1
			}
			trait = immortal_warlord
			trait = duelist
			trait = scarred
			trait = viking
			trait = strong
			trait = wroth
			trait = ambitious
			trait = brave
			trait = proud
			trait = aggressive_leader
			trait = inspiring_leader
			trait = kin_by_oath
			
		}
		new_character = {
			set_character_flag = h_cmd
			add_trait = axe5
			add_trait = combat_exp
			set_character_flag = wpn
			
			add_trait = kin_by_oath
			set_father = ROOT
		}
		
		
		create_character = {
			name="Ubbe" # Ragnarsson
			dynasty=7515
			age=39
			dna = gdxuwalnmax
			properties = fj0jij000000
			religion="norse_pagan"
			culture=norse
			attributes = {
				martial=6
				stewardship=4
				diplomacy=5
				intrigue=4
				learning=2
			}
			trait=hunter
			trait=brave
			trait=viking
			trait=tough_soldier
			
		}
		new_character = {
			add_trait = axe5
			add_trait = combat_exp
			add_trait = robust
			add_trait = ravager
			set_character_flag = wpn
		}
	}
	
	option = {
		name = OK
	}
}


#Sjalland
character_event = {
	id = RAG.1300
	hide_from = yes
	hide_window = yes # Only fires for unplayable landless characters
	
	is_triggered_only = yes
	
	trigger = {
		is_landed = no
		NOT = { has_character_modifier = planning_duchy_adventure }
	}
	
	immediate = {
		if = {
			limit = { prisoner = yes }
			imprison = no
		}
		random_independent_ruler = {
			limit = {
				in_revolt = no
				any_realm_province = {
					county = {
						title = c_sjaelland
					}
				}
			}
			
			random_realm_province = {
				limit = {
					county = {
						title = c_sjaelland
					}
				}
				
				ROOT = {
					character_event = {
						id = RAG.1301 # Fire the attack
						days = 700
					}
					opinion = {
						who = PREVPREV
						months = 36
						modifier = opinion_duchy_adventure_target
					}
					reverse_opinion = {
						who = PREVPREV
						months = 36
						modifier = rsp
					}
					add_character_modifier = {
						name = planning_duchy_adventure
						hidden = yes
						duration = 730
					}
					
				}
				PREV = {
					character_event = {
						id = TOG.1211 # Warn the target
					}
				}
			}
		}
		if = {
			limit = { trait = in_hiding	}
			remove_trait = in_hiding
			add_character_modifier = {
				name = went_out_of_hiding_timer
				duration = 180
				hidden = yes
			}
			hidden_tooltip = { character_event = { id = CM.6400 } } # Notify plotters and family
		}
		character_event = { id = TOG.1215 days = 30 }
	}

}


character_event = {
	id = RAG.1301
	
	hide_window = yes # Only fires for unplayable landless characters
	
	is_triggered_only = yes
	prisoner = no
	
	trigger = {
		is_landed = no
		
		NOT = { trait = incapable }

		any_independent_ruler = {
			any_realm_province = {
				county = {
					title = c_sjaelland
				}
			}
			has_opinion_modifier = {
				who = ROOT
				modifier = rsp
			}
		 }
	}
	
	immediate = {
		wealth = 1000
		clr_character_flag = do_not_disturb
		
		liege = {
			character_event = {
				id = TOG.1213
				days = 1
			}
		}
		
		liege = {
			capital_scope = {
				random_independent_ruler = {
					limit = {
						any_realm_province = {
							county = {
								title = c_sjaelland
							}
						}
						
						has_opinion_modifier = {
							who = ROOT
							modifier = rsp
						}
					}
					random_realm_province = {
						limit = {
							county = {
								title = c_sjaelland
							}
						}
						
						ROOT = {
							add_trait = adventurer
							set_character_flag = duchy_adventurer
							
							set_defacto_liege = ROOT
							set_government_type = tribal_government
							create_title = {
								tier = DUKE
								landless = yes
								temporary = yes
								culture = ROOT
								name = "VIKING_CONQUEST"
								holder = ROOT
							}
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 1150 1150 }
									archers = { 1130 1130 }
								}
								attrition = 0.25
							}
							
							# Create a fleet, just to be sure
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 20 20 }
								}
							}
							
							
							
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 350 350 }
									archers = { 2140 2140 }
								}
								attrition = 0.25
							}
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								
								troops =
								{
									galleys = { 30 30 }
								}
							}
							
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 120 120 }
									archers = { 540 540 }
								}
								attrition = 0.25
							}
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 2325 2325 }
									archers = { 214 214 }
								}
								attrition = 0.25
							}
							spawn_unit = {
								province = PREVPREVPREV
								owner = ROOT
								troops = {
									light_infantry = { 2225 2225 }
									archers = { 339 339 }
								}
								attrition = 0.25
							}
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 25 25 }
								}
							}
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 35 35 }
								}
							}
							spawn_fleet = {
								province = PREVPREVPREV # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 60 60 }
								}
							}
							war = {
								target = PREVPREV
								casus_belli = duchy_adventure
								thirdparty_title = PREV
								tier = DUKE
							}
							remove_opinion = {
								who = PREVPREV
								modifier = opinion_duchy_adventure_target
							}
							reverse_remove_opinion = {
								who = PREVPREV
								modifier = rsp
							}
						}
					}
				}
			}
		}
		
		# Create some decent commander characters
		create_random_soldier = {
			random_traits = no
			dynasty = none
			religion = ROOT
			culture = ROOT
			female = no
		}
		new_character = {
			add_trait = combat_exp
			add_trait = swordsman3
			add_trait = born_lowborn
			set_character_flag = wpn
		}
		create_random_soldier = {
			random_traits = yes
			dynasty = none
			religion = ROOT
			culture = ROOT
			female = no
		}
		new_character = {
			add_trait = spear3
			set_character_flag = wpn
			add_trait = born_lowborn
		}
		
		
		
	}
	
	option = {
		name = OK
	}
}



#Rurik
character_event = {
	id = RAG.1410
	
	only_independent = yes
	is_triggered_only = yes
	hide_window = yes
	
	trigger = {
		NOT = {year = 866}
		year = 858
		NOT = {has_global_flag = rurik_attack}
		culture = norse
		OR = {
			religion = norse_pagan
			religion = norse_pagan_reformed
		}
		ai =yes
	}
	immediate = {
		set_global_flag = rurik_attack
		create_character = {
			name="Rurik" # Rurik, legendary founder of Rus. Probably known as Hrrekr by his Norse contemporaries.
			dynasty=705
			age = 30
			dna = tczeyfghtom
			properties = th0ebd000000
			religion="norse_pagan"
			culture=norse
			attributes = {
				diplomacy = 12
				martial = 8
				stewardship = 8
				intrigue = 6
				learning = 3
			}
			trait=gregarious
			trait=ambitious
			trait=just
			trait=quick
			trait=brilliant_strategist
			trait=brave
		}
		new_character = {
			add_trait = swordsman4
			add_trait = combat_exp
			set_character_flag = wpn
			
			character_event = {id = RAG.1400 days = 25 random = 100} #Viking settlement revolt
		}
	}
}

character_event = {
	id = RAG.1400
	hide_from = yes
	hide_window = yes # Only fires for unplayable landless characters
	
	is_triggered_only = yes
	
	trigger = {
		is_landed = no
		NOT = { has_character_modifier = planning_duchy_adventure }
	}
	
	immediate = {
		if = {
			limit = { prisoner = yes }
			imprison = no
		}
		random_independent_ruler = {
			limit = {
				in_revolt = no
				any_realm_province = {
					county = {
						title = c_novgorod
					}
				}
			}
			
			random_realm_province = {
				limit = {
					county = {
						title = c_novgorod
					}
				}
				
				ROOT = {
					character_event = {
						id = RAG.1401 # Fire the attack
						days = 700
					}
					opinion = {
						who = PREVPREV
						months = 36
						modifier = opinion_duchy_adventure_target
					}
					reverse_opinion = {
						who = PREVPREV
						months = 36
						modifier = rsp
					}
					add_character_modifier = {
						name = planning_duchy_adventure
						hidden = yes
						duration = 730
					}
					
				}
				PREV = {
					character_event = {
						id = TOG.1211 # Warn the target
					}
				}
			}
		}
		if = {
			limit = { trait = in_hiding	}
			remove_trait = in_hiding
			add_character_modifier = {
				name = went_out_of_hiding_timer
				duration = 180
				hidden = yes
			}
			hidden_tooltip = { character_event = { id = CM.6400 } } # Notify plotters and family
		}
		character_event = { id = TOG.1215 days = 30 }
	}

}


character_event = {
	id = RAG.1401
	
	hide_window = yes # Only fires for unplayable landless characters
	
	is_triggered_only = yes
	prisoner = no
	
	trigger = {
		is_landed = no
		
		NOT = { trait = incapable }

		any_independent_ruler = {
			any_realm_province = {
				county = {
					title = c_novgorod
				}
			}
			has_opinion_modifier = {
				who = ROOT
				modifier = rsp
			}
		 }
	}
	
	immediate = {
		wealth = 1000
		clr_character_flag = do_not_disturb
		
		liege = {
			character_event = {
				id = TOG.1213
				days = 1
			}
		}
		
		liege = {
			capital_scope = {
				random_independent_ruler = {
					limit = {
						any_realm_province = {
							county = {
								title = c_novgorod
							}
						}
						
						has_opinion_modifier = {
							who = ROOT
							modifier = rsp
						}
					}
					random_realm_province = {
						limit = {
							county = {
								title = c_novgorod
							}
						}
						
						ROOT = {
							add_trait = adventurer
							set_character_flag = duchy_adventurer
							
							set_defacto_liege = ROOT
							set_government_type = tribal_government
							create_title = {
								tier = DUKE
								landless = yes
								temporary = yes
								culture = ROOT
								name = "VIKING_CONQUEST"
								holder = ROOT
							}
							spawn_unit = {
								province = 41
								owner = ROOT
								troops = {
									light_infantry = { 1150 1150 }
									archers = { 1130 1130 }
								}
								attrition = 0.25
							}
							
							# Create a fleet, just to be sure
							spawn_fleet = {
								province = 41 # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 20 20 }
								}
							}
							
							
							
							spawn_unit = {
								province = 41
								owner = ROOT
								troops = {
									light_infantry = { 350 350 }
									archers = { 2140 2140 }
								}
								disband_on_peace = yes
								attrition = 0.25
							}
							spawn_fleet = {
								province = 41 # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								
								troops =
								{
									galleys = { 30 30 }
								}
							}
							
							spawn_unit = {
								province = 41
								owner = ROOT
								troops = {
									light_infantry = { 120 120 }
									archers = { 540 540 }
								}
								attrition = 0.25
							}
							spawn_unit = {
								province = 41
								owner = ROOT
								troops = {
									light_infantry = { 2325 2325 }
									archers = { 214 214 }
								}
								disband_on_peace = yes
								attrition = 0.25
							}
							spawn_unit = {
								province = 41
								owner = ROOT
								troops = {
									light_infantry = { 2225 2225 }
									archers = { 339 339 }
								}
								disband_on_peace = yes
								attrition = 0.25
							}
							spawn_fleet = {
								province = 41 # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 25 25 }
								}
							}
							spawn_fleet = {
								province = 41 # closest sea zone
								owner = ROOT
								cannot_inherit = yes
								troops =
								{
									galleys = { 40 490 }
								}
							}
							spawn_fleet = {
								province = 41 # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 60 60 }
								}
							}
							war = {
								target = PREVPREV
								casus_belli = duchy_adventure
								thirdparty_title = PREV
								tier = DUKE
							}
							remove_opinion = {
								who = PREVPREV
								modifier = opinion_duchy_adventure_target
							}
							reverse_remove_opinion = {
								who = PREVPREV
								modifier = rsp
							}
						}
					}
				}
			}
		}
		
		# Create some decent commander characters
		create_random_soldier = {
			random_traits = no
			dynasty = none
			religion = ROOT
			culture = ROOT
			female = no
		}
		new_character = {
			add_trait = combat_exp
			add_trait = swordsman3
			add_trait = born_lowborn
			set_character_flag = wpn
		}
		create_random_soldier = {
			random_traits = yes
			dynasty = none
			religion = ROOT
			culture = ROOT
			female = no
		}
		new_character = {
			add_trait = spear3
			add_trait = born_lowborn
			set_character_flag = wpn

		}
		
		create_character = {
			name="Helgi"
			dynasty=705
			age = 10
			religion=slavic_pagan
			culture=norse
			attributes = {
				diplomacy=9
				martial=9
			}
			trait=quick
			trait=proud
			trait=tough_soldier
		}
		new_character = {
			add_trait = swordsman2
			add_trait = combat_exp
			add_trait = kin_by_oath
			set_character_flag = wpn
			give_nickname = nick_the_seer
			set_father = ROOT
			add_character_modifier = {
				name = gedu
				days = 3650
				hidden = yes
			}
			set_focus = focus_ed_martial
		}
		
	}
	
	option = {
		name = OK
	}
}



#Dyre
character_event = {
	id = RAG.1510
	
	only_independent = yes
	is_triggered_only = yes
	hide_window = yes
	
	trigger = {
		NOT = {year = 866}
		year = 860
		NOT = {has_global_flag = dyre_attack}
		culture = norse
		OR = {
			religion = norse_pagan
			religion = norse_pagan_reformed
		}
		ai =yes
	}
	immediate = {
		set_global_flag = dyre_attack
		create_character = {
			name="Dyre" # Ruler of Kiev
			age = 16
			dynasty=7516
			dna = oelfvuthkot
			properties = cc0dbd00000000
			religion="norse_pagan"
			culture=norse
			attributes = {
				martial=9
				diplomacy=9
				stewardship=6
			}
			trait=ambitious
			trait=cynical
			trait=greedy
			trait=gregarious
			trait=grey_eminence
			trait=brave
			trait=heavy_infantry_leader
			trait=genius
		}
		new_character = {
			add_trait = swordsman2
			add_trait = combat_exp
			set_character_flag = wpn
			give_nickname = nick_the_stranger
			character_event = {id = RAG.1500 days = 25 random = 100} #Viking settlement revolt
		}
	}
}



character_event = {
	id = RAG.1500
	hide_from = yes
	hide_window = yes # Only fires for unplayable landless characters
	
	is_triggered_only = yes
	
	trigger = {
		is_landed = no
		NOT = { has_character_modifier = planning_duchy_adventure }
	}
	
	immediate = {
		if = {
			limit = { prisoner = yes }
			imprison = no
		}
		random_independent_ruler = {
			limit = {
				in_revolt = no
				any_realm_province = {
					county = {
						title = c_kiev
					}
				}
			}
			
			random_realm_province = {
				limit = {
					county = {
						title = c_kiev
					}
				}
				
				ROOT = {
					character_event = {
						id = RAG.1501 # Fire the attack
						days = 700
					}
					opinion = {
						who = PREVPREV
						months = 36
						modifier = opinion_duchy_adventure_target
					}
					reverse_opinion = {
						who = PREVPREV
						months = 36
						modifier = rsp
					}
					add_character_modifier = {
						name = planning_duchy_adventure
						hidden = yes
						duration = 730
					}
					
				}
				PREV = {
					character_event = {
						id = TOG.1211 # Warn the target
					}
				}
			}
		}
		if = {
			limit = { trait = in_hiding	}
			remove_trait = in_hiding
			add_character_modifier = {
				name = went_out_of_hiding_timer
				duration = 180
				hidden = yes
			}
			hidden_tooltip = { character_event = { id = CM.6400 } } # Notify plotters and family
		}
		character_event = { id = TOG.1215 days = 30 }
	}

}


character_event = {
	id = RAG.1501
	
	hide_window = yes # Only fires for unplayable landless characters
	
	is_triggered_only = yes
	prisoner = no
	
	trigger = {
		is_landed = no
		
		NOT = { trait = incapable }

		any_independent_ruler = {
			any_realm_province = {
				county = {
					title = c_kiev
				}
			}
			has_opinion_modifier = {
				who = ROOT
				modifier = rsp
			}
		 }
	}
	
	immediate = {
		wealth = 1000
		clr_character_flag = do_not_disturb
		
		liege = {
			character_event = {
				id = TOG.1213
				days = 1
			}
		}
		
		liege = {
			capital_scope = {
				random_independent_ruler = {
					limit = {
						any_realm_province = {
							county = {
								title = c_kiev
							}
						}
						
						has_opinion_modifier = {
							who = ROOT
							modifier = rsp
						}
					}
					random_realm_province = {
						limit = {
							county = {
								title = c_kiev
							}
						}
						
						ROOT = {
							add_trait = adventurer
							set_character_flag = duchy_adventurer
							
							set_defacto_liege = ROOT
							set_government_type = tribal_government
							create_title = {
								tier = DUKE
								landless = yes
								temporary = yes
								culture = ROOT
								name = "VIKING_CONQUEST"
								holder = ROOT
							}
							spawn_unit = {
								province = 547
								owner = ROOT
								troops = {
									light_infantry = { 1150 1150 }
									archers = { 1130 1130 }
								}
								attrition = 0.25
							}
							
							# Create a fleet, just to be sure
							spawn_fleet = {
								province = 547 # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 20 20 }
								}
							}
							
							
							
							spawn_unit = {
								province = 547
								owner = ROOT
								disband_on_peace = yes
								troops = {
									light_infantry = { 350 350 }
									archers = { 2140 2140 }
								}
								attrition = 0.25
							}
							spawn_fleet = {
								province = 547 # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								
								troops =
								{
									galleys = { 30 30 }
								}
							}
							
							spawn_unit = {
								province = 547
								owner = ROOT
								troops = {
									light_infantry = { 120 120 }
									archers = { 540 540 }
								}
								attrition = 0.25
							}
							spawn_unit = {
								province = 547
								owner = ROOT
								disband_on_peace = yes
								troops = {
									light_infantry = { 2325 2325 }
									archers = { 214 214 }
								}
								attrition = 0.25
							}
							spawn_unit = {
								province = 547
								owner = ROOT
								disband_on_peace = yes
								troops = {
									light_infantry = { 2225 2225 }
									archers = { 339 339 }
								}
								attrition = 0.25
							}
							spawn_fleet = {
								province = 547 # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 25 25 }
								}
							}
							spawn_fleet = {
								province = 547 # closest sea zone
								owner = ROOT
								cannot_inherit = yes
								troops =
								{
									galleys = { 40 40 }
								}
							}
							spawn_fleet = {
								province = 547 # closest sea zone
								owner = ROOT
								disband_on_peace = yes
								troops =
								{
									galleys = { 60 60 }
								}
							}
							war = {
								target = PREVPREV
								casus_belli = duchy_adventure
								thirdparty_title = PREV
								tier = DUKE
							}
							remove_opinion = {
								who = PREVPREV
								modifier = opinion_duchy_adventure_target
							}
							reverse_remove_opinion = {
								who = PREVPREV
								modifier = rsp
							}
						}
					}
				}
			}
		}
		
		# Create some decent commander characters
		create_random_soldier = {
			random_traits = no
			dynasty = none
			religion = ROOT
			culture = ROOT
			female = no
		}
		new_character = {
			add_trait = combat_exp
			add_trait = swordsman3
			add_trait = born_lowborn
			set_character_flag = wpn
		}
		create_random_soldier = {
			random_traits = yes
			dynasty = none
			religion = ROOT
			culture = ROOT
			female = no
		}
		new_character = {
			add_trait = spear3
			set_character_flag = wpn
			add_trait = born_lowborn
		}
		
		
		
	}
	
	option = {
		name = OK
	}
}





narrative_event = { #Balgarsko
	id = RAG.5000
	desc = RAG5000
	title = RAG5000T
	picture = GFX_evt_great_schism
	hide_from = yes
	is_triggered_only = yes
	
	trigger = {
		NOT = {year = 860}
		dynasty = 591
		higher_tier_than = DUKE
		religion_group = christian
		has_landed_title = k_bulgaria
		NOT = {has_global_flag = christian_bulgaria}
	}
	
	immediate = {
		set_global_flag = christian_bulgaria
		
	}
	
	option = {
		hidden_tooltip = {
			set_no_dynasty = yes
		}
		add_trait = dynasty_founder
		dynasty = 8636
		
		if = {
			limit = {culture = bolghar}
			culture = bulgarian
		}
		hidden_tooltip = {
			
			character_event = {id = DYN.2000}
			any_realm_character = {
				limit = {
					ai = yes
				}
				if = {
					limit = {culture = bolghar}
					culture = bulgarian
				}
				if = {
					limit = {
						NOT = {religion = ROOT}
						NOT = {trait = zealous}
					}
					religion = ROOT
				}
			}
		}
		if = {
			limit = {trait = cynical}
			remove_trait = cynical
		}
		name = RAG5000A
		hidden_tooltip = {
			any_playable_ruler = {
				limit = {ai = no}
				narrative_event = {id = RAG.5001}
			}
		}
	}
}

narrative_event = { #Balgarsko
	id = RAG.5001
	desc = RAG5000
	title = RAG5000T
	picture = GFX_evt_great_schism
	is_triggered_only = yes

	option = {
		trigger = {
			religion_group = christian
		}
		name = RAG5000B
	}
	
	option = {
		trigger = {
			NOT = {religion_group = christian}
		}
		name = RAG5000C
	}
}

#Scotland Conquest
narrative_event = {
	id = RAG.5010
	desc = RAG5010
	title = RAG5010T
	picture = GFX_evt_rival_rulers
	hide_from = yes
	is_triggered_only = yes
	only_independent = yes
	min_age = 16
	max_age = 40
	trigger = {
		NOT = {year = 860}
		year = 800
		higher_tier_than = COUNT
		culture = irish
		NOT = {has_claim = k_scotland}
		capital_scope = {
			kingdom = {
				title = k_scotland
			}
		}
		NOT = {has_global_flag = claimed_scotland}
		any_playable_ruler = {
			has_landed_title = k_scotland
			culture = pictish
		}
	}
	immediate = {
		set_global_flag = claimed_scotland
	}
	option = {
		add_claim = k_scotland
		k_scotland = {
			holder_scope = {
				reverse_war = {
					target = ROOT
					casus_belli = claim
					thirdparty_title = PREV
					infamy = 0
				}
			}
		}
		capital_scope = {
			ROOT = {
				spawn_unit = {
					province = PREV
					owner = ROOT
					#leader = ROOT
					troops = {
						light_infantry = { 412 412 }
					}
					attrition = 0.5
					reinforces = yes
					reinforce_rate_multiplier = 1
					cannot_inherit = yes
				}
				spawn_unit = {
					province = PREV
					owner = ROOT
					#leader = ROOT
					troops = {
						light_infantry = { 533 533 }
					}
					attrition = 0.5
					reinforces = yes
					reinforce_rate_multiplier = 1
					cannot_inherit = yes
				}
				spawn_unit = {
					province = PREV
					owner = ROOT
					#leader = ROOT
					troops = {
						light_infantry = { 416 416 }
					}
					attrition = 0.5
					reinforces = yes
					reinforce_rate_multiplier = 1
					cannot_inherit = yes
				}
			}
		}
		hidden_tooltip = {
			any_playable_ruler = {
				limit = {has_landed_title = k_scotland}
				character_event = {id = RAG.5011}
			}
		}
		name = RAG5010A
	}
}

narrative_event = {
	id = RAG.5011
	desc = RAG5010
	title = RAG5010T
	picture = GFX_evt_rival_rulers
	is_triggered_only = yes
	option = {
		FROM = {
			add_claim = k_scotland
		}
		name = RAG5010B
	}
}


narrative_event = { #Scottish King Aipins
	id = RAG.5012
	desc = RAG5012
	title = RAG5012T
	picture = GFX_evt_tribal_lands
	hide_from = yes
	is_triggered_only = yes
	
	trigger = {
		NOT = {year = 866}
		NOT = {has_global_flag = scottish_king}
		dynasty = 9223
		has_landed_title = k_scotland
		
	}
	
	immediate = {
		set_global_flag = scottish_king
	}
	
	option = {
		hidden_tooltip = {
			set_no_dynasty = yes
		}
		add_trait = dynasty_founder
		dynasty = 688
		
		if = {
			limit = {culture = irish}
			any_realm_province = {
				limit = {culture = irish}
				culture = scottish
			}
			culture = scottish
		}
		if = {
			limit = {
				OR = {
					has_nickname = no
					has_nickname = nick_the_usurper
				}
			}
			give_nickname = nick_the_conqueror
		}
		
		hidden_tooltip = {
			character_event = {id = DYN.2000}
			any_realm_character = {
				limit = {
					ai = yes
				}
				if = {
					limit = {culture = irish}
					culture = scottish
				}
			}
		}
		name = RAG5012A
		hidden_tooltip = {
			any_playable_ruler = {
				limit = {
					ai = no
					NOT = {culture = pictish}
				}
				narrative_event = {id = RAG.5013}
			}
		}
	}
}

narrative_event = { #Scottish King Aipins
	id = RAG.5013
	desc = RAG5012
	title = RAG5012T
	picture = GFX_evt_great_schism
	is_triggered_only = yes
	
	option = {
		name = RAG5012B
	}
}

