add_namespace = eu4_like_ages_events

country_event = {
	id = eu4_like_ages_events.1
	title = eu4_like_ages_events.EVTNAME1
	desc = eu4_like_ages_events.EVTDESC1
	
	hidden = yes
	fire_only_once = yes
	
	trigger = {
		NOT = { has_variable = global.days_til_next_age }
		are_triggers_met_for_age_1 = yes
	}
	
	mean_time_to_happen = {
		days = 2
	}
	
	immediate = {
		hidden_effect = {
			set_current_age = yes
		}
	}
	
	option = {
		name = eu4_like_ages_events1.EVTOPT1
		
		ai_chance = { factor = 100 }
	}
}

country_event = {
	id = eu4_like_ages_events.2
	title = eu4_like_ages_events.EVTNAME2
	desc = eu4_like_ages_events.EVTDESC2
	
	hidden = yes
	fire_only_once = yes
	
	trigger = {
		NOT = { has_variable = global.days_til_next_age }
		are_triggers_met_for_age_2 = yes
	}
	
	mean_time_to_happen = {
		days = 2
	}
	
	immediate = {
		hidden_effect = {
			set_variable = { global.days_til_next_age = 100 }
			set_variable = { global.next_age = 2 }
		}
	}
	
	option = {
		name = eu4_like_ages_events2.EVTOPT1
		
		ai_chance = { factor = 100 }
	}
}

country_event = {
	id = eu4_like_ages_events.3
	title = eu4_like_ages_events.EVTNAME3
	desc = eu4_like_ages_events.EVTDESC3
	
	hidden = yes
	fire_only_once = yes
	
	trigger = {
		NOT = { has_variable = global.days_til_next_age }
		are_triggers_met_for_age_3 = yes
	}
	
	mean_time_to_happen = {
		days = 2
	}
	
	immediate = {
		hidden_effect = {
			set_variable = { global.days_til_next_age = 100 }
			set_variable = { global.next_age = 3 }
		}
	}
	
	option = {
		name = eu4_like_ages_events3.EVTOPT1
		
		ai_chance = { factor = 100 }
	}
}

country_event = {
	id = eu4_like_ages_events.4
	title = eu4_like_ages_events.EVTNAME4
	desc = eu4_like_ages_events.EVTDESC4
	
	hidden = yes
	fire_only_once = yes
	
	trigger = {
		NOT = { has_variable = global.days_til_next_age }
		are_triggers_met_for_age_4 = yes
	}
	
	mean_time_to_happen = {
		days = 2
	}
	
	immediate = {
		hidden_effect = {
			set_variable = { global.days_til_next_age = 100 }
			set_variable = { global.next_age = 4 }
		}
	}
	
	option = {
		name = eu4_like_ages_events4.EVTOPT1
		
		ai_chance = { factor = 100 }
	}
}

country_event = {
	id = eu4_like_ages_events.5
	title = eu4_like_ages_events.EVTNAME5
	desc = eu4_like_ages_events.EVTDESC5
	
	hidden = yes
	fire_only_once = yes
	
	trigger = {
		NOT = { has_variable = global.days_til_next_age }
		are_triggers_met_for_age_5 = yes
	}
	
	mean_time_to_happen = {
		days = 2
	}
	
	immediate = {
		hidden_effect = {
			set_variable = { global.days_til_next_age = 100 }
			set_variable = { global.next_age = 5 }
		}
	}
	
	option = {
		name = eu4_like_ages_events5.EVTOPT1
		
		ai_chance = { factor = 100 }
	}
}

country_event = {
	id = eu4_like_ages_events.6
	title = eu4_like_ages_events.EVTNAME6
	desc = eu4_like_ages_events.EVTDESC6
	
	hidden = yes
	fire_only_once = yes
	
	trigger = {
		NOT = { has_variable = global.days_til_next_age }
		are_triggers_met_for_age_6 = yes
	}
	
	mean_time_to_happen = {
		days = 2
	}
	
	immediate = {
		hidden_effect = {
			set_variable = { global.days_til_next_age = 100 }
			set_variable = { global.next_age = 6 }
		}
	}
	
	option = {
		name = eu4_like_ages_events6.EVTOPT1
		
		ai_chance = { factor = 100 }
	}
}

# Remove ideas of age abilities
country_event = {
	id = eu4_like_ages_events.1000
	title = eu4_like_ages_events.EVTNAME1000
	desc = eu4_like_ages_events.EVTDESC1000
	
	hidden = yes
	is_triggered_only = yes
	
	immediate = {
		hidden_effect = {
			if = {
				limit = {
					check_variable = { currently_selected_age_abilities^num > 0 }
				}
				for_each_loop = {
					array = currently_selected_age_abilities
					value = v
					meta_effect = {
						text = {
							if = {
								limit = {
									has_idea = age_ability_[ABILITY]
								}
								remove_ideas = age_ability_[ABILITY]
							}
						}
						ABILITY = "[?v]"
					}
				}
			}
			clear_array = currently_selected_age_abilities
			set_variable = { current_splendor = 0 }
		}
	}
	
	option = {
		name = eu4_like_ages_events1000.EVTOPT1
		
		ai_chance = { factor = 100 }
	}
}