##USE SUPER_EVENT_MAKER_GUI IN USEFUL PYTHON PROGRAMS TO MAKE NEW SUPER EVENTS##
TNO_fire_super_event = {
	hidden_effect = {
		if = {
			limit = { NOT = { has_global_flag = TNO_my_world_is_on_fire_how_about_yours } } #Doesn't set any new super events if nuclear war has occured
			if = {
				limit = {
					check_variable = { TNO_temp_super_event = token:SE_OPERATION_SEALION_2 }
					has_global_flag = german_civil_war_goeringvic
				}
				set_temp_variable = { TNO_temp_super_event = token:SE_FALL_SEALION_II }
			}
			set_variable = { TNO_super_event = TNO_temp_super_event }
		}
		if = {
			limit = {
				NOT = {
					has_game_rule = {
						rule = SUPER_EVENTS_STATUS
						option = SUPER_EVENTS_NO_AUDIO
					}
					has_game_rule = {
						rule = SUPER_EVENTS_STATUS
						option = SUPER_EVENTS_DISABLED
					}
					has_global_flag = TNO_my_world_is_on_fire_how_about_yours
				}
			}
			### SUPERS WITH DYNAMIC SFX ###
			if = {
				limit = { check_variable = { TNO_temp_super_event = token:SE_GREAT_ASIAN_WAR } check_variable = { YUN.YUN_legitimacy_cap > 99 } }
				random_list = {
					80 = { scoped_play_song = "TNO_SE_GREAT_ASIAN_WAR_2" }
					20 = { scoped_play_song = "TNO_SE_GREAT_ASIAN_WAR_3" }
				}
			}
			else_if = {
				limit = { check_variable = { TNO_temp_super_event = token:SE_WEST_AFRICAN_WAR } has_global_flag = WAC_scenario_1 }
				scoped_play_song = "TNO_SE_WEST_AFRICAN_WAR_1"
			}
			else_if = {
				limit = { check_variable = { TNO_temp_super_event = token:SE_WEST_AFRICAN_WAR } has_global_flag = WAC_scenario_2 }
				scoped_play_song = "TNO_SE_WEST_AFRICAN_WAR_2"
			}
			else_if = {
				limit = { check_variable = { TNO_temp_super_event = token:SE_WEST_AFRICAN_WAR } has_global_flag = WAC_scenario_3 }
				scoped_play_song = "TNO_SE_WEST_AFRICAN_WAR_3"
			}
			else_if = {
				limit = {
					check_variable = { TNO_temp_super_event = token:SE_RUSSIAN_REUNIFICATION_OMOLON_APRILFOOLS }
					OMO = { has_country_flag = OMO_2022_sunset_superevent }
				}
				scoped_play_song = "TNO_SE_RUSSIAN_REUNIFICATION_OMOLON_APRILFOOLS_SUNSET"
			}
			else_if = {
				limit = {
					check_variable = { TNO_temp_super_event = token:SE_SOUTH_AFRICAN_WAR }
					tag = BRA
				}
				scoped_play_song = "TNO_SE_SOUTH_AFRICAN_WAR_BRAZIL"
			}

			### NUCLEAR WAR - CAN'T BE SCOPED ###
			else_if = {
				limit = { check_variable = { TNO_temp_super_event = token:SE_NUCLEAR_WAR } }
				play_song = "TNO_SE_NUCLEAR_WAR"
			}

			### DEFAULT ###
			else = {
				meta_effect = {
					text = { scoped_play_song = "TNO_[SUPER]" }
					SUPER = "[?TNO_super_event.GetTokenKey]"
				}
			}
		}
		if = { # Effects from closing Superevent GUI if disabled
			limit = {
				has_game_rule = {
					rule = SUPER_EVENTS_STATUS
					option = SUPER_EVENTS_DISABLED
				}
			}
			TNO_super_event_option_effect = yes
		}
	}
}

TNO_super_event_option_effect = { # Shared effect for button effects for actual button and bypass if super events are disabled
	if = {
		limit = {
			check_for_superevent_option_endscreen = yes
		}	
		TNO_russia_ending_screen = yes
	}
	if = {
		limit = { 
			check_variable = { TNO_super_event = token:SE_SOUTH_ATLANTIC_WAR }
		}
		scoped_play_song = "tno_song_south_atlantic_war" #this is an actual song
	}
	clear_variable = TNO_super_event
}

d_fire_super_event = {
	set_temp_variable = { TNO_temp_super_event = args^0 }
	TNO_fire_super_event = yes
}