scripted_gui = {
	nkmp_startup_gui = {
		window_name = "nkmp_startup_gui_window"
		context_type = player_context
		visible = {
			has_country_flag = nkmp_flg_open_startup_gui
		}
		effects = {
			################## Confirm Button ##################
			nkmp_startup_confirm_button_click = {
				clr_country_flag = nkmp_flg_open_startup_gui
				################## AI ##################
				if = {
					limit = {
						ROOT = {
							has_country_flag = nkmp_flg_enable_puppet_ai
						}
					}
					add_ideas = nkmp_puppet_ai_enabled
				}
				################## END AI ##################
				################## Factions ##################
				if = {
					limit = {
						has_country_flag = nkmp_flg_remove_factions
					}
					every_country = {
						limit = {
							is_faction_leader = yes
						}
						dismantle_faction = yes
					}
				}
				################## END Factions ##################
				################## Guarantees ##################
				if = {
					limit = {
						has_country_flag = nkmp_flg_remove_guarantees
					}
					every_country = {
						THIS = {
							every_other_country = {
								diplomatic_relation = {
									country = PREV
									relation = guarantee
									active = no
								}
							}
						}
					}
				}
				################## END Guarantees ##################
				################## Vassals ##################
				if = {
					limit = {
						has_country_flag = nkmp_flg_remove_vassals
					}
					every_country = {
						limit = {
							is_subject = yes
						}
						OVERLORD = {
							set_autonomy = {
								target = PREV
								autonomy_state = autonomy_free
							}
						}
					}
				}
				################## END Vassals ##################
				################## Stop All Wars ##################
				if = {
					limit = {
						has_country_flag = nkmp_flg_stop_all_wars
					}
					every_country = {
						limit = {
							has_war = yes
						}
						THIS = {
							every_other_country = {
								limit = {
									has_war_with = PREV
								}
								white_peace = PREV
							}
						}
					}
				}
				################## END Stop All Wars ##################
				################## Global Max Infrastructure ##################
				if = {
					limit = {
						has_country_flag = nkmp_flg_global_infrastructure
					}
					every_state = {
						add_building_construction = {
							type = infrastructure
							level = 10
							instant_build = yes
						}
						add_extra_state_shared_building_slots = 1000
					}
					every_state = {
						limit = {
							OR = {
								has_railway_level = {
									level = 1
									state = THIS
								}
								has_railway_level = {
									level = 2
									state = THIS
								}
								has_railway_level = {
									level = 3
									state = THIS
								}
								has_railway_level = {
									level = 4
									state = THIS
								}
								has_railway_level = {
									level = 5
									state = THIS
								}
								has_railway_level = {
									level = 6
									state = THIS
								}
							}
						}
						set_temp_variable = {
							nkmp_temp_railroad_upgrade_var = THIS
						}
						if = {
							limit = {
								has_global_flag = nkmp_flg_global_MD_Mode
							}
							THIS = {
								build_railway = {
									level = 6
									fallback = yes
									start_state = nkmp_temp_railroad_upgrade_var
									target_state = THIS
								}
							}
						}
						else = {
							THIS = {
								build_railway = {
									level = 5
									fallback = yes
									start_state = nk1p_temp_railroad_upgrade_var
									target_state = THIS
								}
							}
						}
					}
				}
				################## END Global Max Infrastructure ##################
				################## Remove DMZ ##################
				if = {
					limit = {
						has_country_flag = nkmp_flg_remove_dmz
					}
					every_state = {
						limit = {
							is_demilitarized_zone = yes
						}
						set_demilitarized_zone = no
					}
				}
				################## END DMZ ##################
				################## Forbid Volunteers ##################
				if = {
					limit = {
						has_country_flag = nkmp_flg_forbid_volunteers
					}
					every_country = {
						limit = {
							is_ai = yes
						}
						set_rule = {
							can_send_volunteers = no
						}
						add_ideas = nkmp_forbid_volunteers_idea
					}
				}
				################## END Forbid Volunteers ##################
				################## Forbid Lend Lease ##################
				if = {
					limit = {
						has_country_flag = nkmp_flg_forbid_lend_lease
					}
					every_country = {
						limit = {
							is_ai = yes
						}
						add_ideas = nkmp_forbid_lend_lease_idea
					}
				}
				################## END Forbid Lend Lease ##################
				################## Forbid Guarantees ##################
				if = {
					limit = {
						has_country_flag = nkmp_flg_forbid_guarantees
					}
					every_country = {
						limit = {
							is_ai = yes
						}
						add_ideas = nkmp_forbid_guarantees_idea
					}
				}
				################## END Forbid Guarantees ##################
				################## Core All ##################
				if = {
					limit = {
						has_country_flag = nkmp_flg_core_all
					}
					every_state = {
						add_core_of = ROOT
					}
				}
				################## END Core All ##################
				################## Turn Off Energy ##################
				if = {
					limit = {
						has_country_flag = nkmp_flg_energy_disabled
						NOT = {
							has_global_flag = nkmp_flg_global_MD_Mode
						}
					}
					nkmp_energy_disabled_scripted_effect = yes
				}
				else_if = {
					limit = {
						has_country_flag = nkmp_flg_energy_disabled
						has_global_flag = nkmp_flg_global_MD_Mode
					}
					nkmp_md_energy_disabled_scripted_effect = yes
				}
				################## END Turn Off Energy ##################
				################## Turn Off Global Energy ##################
				if = {
					limit = {
						has_country_flag = nkmp_flg_global_energy_disabled
						NOT = {
							has_global_flag = nkmp_flg_global_MD_Mode
						}
					}
					every_country = {
						nkmp_energy_disabled_scripted_effect = yes
					}
				}
				else_if = {
					limit = {
						has_country_flag = nkmp_flg_global_energy_disabled
						has_global_flag = nkmp_flg_global_MD_Mode
					}
					every_country = {
						nkmp_md_energy_disabled_scripted_effect = yes
					}
				}
				################## END Turn Off Global Energy ##################
			}
			################## END Confirm Button ##################
		}
		properties = {
		}
	}
}
