add_namespace = eu4_like_ideas_events

country_event = {
	id = eu4_like_ideas_events.1
	title = eu4_like_ideas_events.EVTNAME1
	desc = eu4_like_ideas_events.EVTDESC1

	hidden = yes
	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			set_ideas_up_at_start_effect = yes
		}
	}

	option = {
		name = eu4_like_ideas_events1.EVTOPT1

		ai_chance = { factor = 100 }
	}
}

country_event = {
	id = eu4_like_ideas_events.2
	title = eu4_like_ideas_events.EVTNAME2
	desc = eu4_like_ideas_events.EVTDESC2

	hidden = yes

	trigger = {
		is_ai = yes
		has_global_flag = eu4_like_ideas_ai_idea_cost_reduced
		NOT = { has_idea = eu4_like_ideas_AI_pp_cost_reduction_5 }
		NOT = { has_idea = eu4_like_ideas_AI_pp_cost_reduction_10 }
		NOT = { has_idea = eu4_like_ideas_AI_pp_cost_reduction_15 }
		NOT = { has_idea = eu4_like_ideas_AI_pp_cost_reduction_20 }
		NOT = { has_idea = eu4_like_ideas_AI_pp_cost_reduction_25 }
		NOT = { has_idea = eu4_like_ideas_AI_pp_cost_reduction_30 }
		NOT = { has_idea = eu4_like_ideas_AI_pp_cost_reduction_35 }
		NOT = { has_idea = eu4_like_ideas_AI_pp_cost_reduction_40 }
		NOT = { has_idea = eu4_like_ideas_AI_pp_cost_reduction_45 }
		NOT = { has_idea = eu4_like_ideas_AI_pp_cost_reduction_50 }
	}

	mean_time_to_happen = {
		months = 1
	}

	immediate = {
		hidden_effect = {
			set_AI_pp_cost_reduction_modifier = yes
		}
	}

	option = {
		name = eu4_like_ideas_events2.EVTOPT1

		ai_chance = { factor = 100 }
	}
}

country_event = {
	id = eu4_like_ideas_events.3
	title = eu4_like_ideas_events.EVTNAME3
	desc = eu4_like_ideas_events.EVTDESC3
	picture = GFX_tiled_window_transparent_transparent

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			set_country_flag = is_deciding_about_swapping_national_ideas
		}
	}

	option = {
		name = eu4_like_ideas_events3.EVTOPT1

		ai_chance = { factor = 100 }

		if = {
			limit = {
				calculate_right_national_ideas_id = yes
				NOT = { check_variable = { national_ideas_id = national_ideas_id_other_context } }
			}
			custom_effect_tooltip = EU4_LIKE_IDEAS_SWAP_NATIONAL_IDEAS
			hidden_effect = {
				swap_national_ideas_effect = yes
			}
		}
		clr_country_flag = is_deciding_about_swapping_national_ideas
	}

	option = {
		name = eu4_like_ideas_events3.EVTOPT2

		ai_chance = { factor = 0 }

		if = {
			limit = {
				calculate_right_national_ideas_id = yes
				NOT = { check_variable = { national_ideas_id = national_ideas_id_other_context } }
			}
			add_to_array = { rejected_national_ideas_to_swap_to = national_ideas_id_other_context }
		}
		clr_country_flag = is_deciding_about_swapping_national_ideas
	}
}


# Manual Triggered for Save Games to gain new idea groups
country_event = {
	id = eu4_like_ideas_events.1000
	title = eu4_like_ideas_events.EVTNAME1000
	desc = eu4_like_ideas_events.EVTDESC1000
	picture = GFX_report_event_generic_research_lab

	is_triggered_only = yes

	trigger = {
		always = no
	}

	option = {
		name = eu4_like_ideas_events1000.EVTOPT1

		ai_chance = { factor = 0 }

		custom_effect_tooltip = RELOAD_IDEA_GROUPS_IN_SAVE_TT
		hidden_effect = {
			every_country = {
				clear_array = adm_idea_groups
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 1 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { adm_idea_groups = 1 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 2 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { adm_idea_groups = 2 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 3 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { adm_idea_groups = 3 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 4 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { adm_idea_groups = 4 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 5 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { adm_idea_groups = 5 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 6 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { adm_idea_groups = 6 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 19 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { adm_idea_groups = 19 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 22 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { adm_idea_groups = 22 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 25 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { adm_idea_groups = 25 }
				}
				clear_array = dip_idea_groups
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 7 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { dip_idea_groups = 7 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 8 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { dip_idea_groups = 8 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 9 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { dip_idea_groups = 9 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 10 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { dip_idea_groups = 10 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 11 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { dip_idea_groups = 11 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 12 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { dip_idea_groups = 12 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 20 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { dip_idea_groups = 20 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 23 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { dip_idea_groups = 23 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 26 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { dip_idea_groups = 26 }
				}
				clear_array = mil_idea_groups
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 13 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { mil_idea_groups = 13 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 14 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { mil_idea_groups = 14 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 15 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { mil_idea_groups = 15 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 16 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { mil_idea_groups = 16 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 17 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { mil_idea_groups = 17 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 18 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { mil_idea_groups = 18 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 21 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { mil_idea_groups = 21 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 24 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { mil_idea_groups = 24 }
				}
				if = {
					limit = {
						set_temp_variable = { idea_group_out_of_context = 27 }
						NOT = { has_selected_idea_group = yes }
					}
					add_to_array = { mil_idea_groups = 27 }
				}
			}
		}
	}

	option = {
		name = eu4_like_ideas_events1000.EVTOPT2

		ai_chance = { factor = 100 }
	}
}