on_actions = {


	######## SAF CAPTURE EVENTS

	on_state_control_changed = {
		effect = {

			if = { # Cape Town capture event
				limit = {

					OR = {
						AND = {
							ROOT = { tag = BOR }
							FROM = { tag = SAF }
							FROM.FROM = { state = 681 }
						}

						AND = {
							ROOT = { tag = ANG }
							FROM = { tag = SAF }
							FROM.FROM = { state = 681 }
						}
					}
				}
				USA = { country_event = { id = USA.saf.war.missions.17 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.17 days = 1 } }
				ANG = { country_event = { id = USA.saf.war.missions.17 days = 1 } }
				BOR = { country_event = { id = USA.saf.war.missions.17 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.17 days = 1 } }
				}
			}

			if = { # East London capture event
				limit = {
					OR = {
						AND = { 
							ROOT = { tag = BOR }
							FROM = { tag = SAF }
							FROM.FROM = { state = 934 }
						}


						AND = {
							ROOT = { tag = GRO }
							FROM = { tag = SAF }
							FROM.FROM = { state = 934 }
						}
					}
				}
				USA = { country_event = { id = USA.saf.war.missions.15 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.15 days = 1 } }
				GRO = { country_event = { id = USA.saf.war.missions.15 days = 1 } }
				BOR = { country_event = { id = USA.saf.war.missions.15 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.15 days = 1 } }
				}
			}

			if = { # Salisbury Capture event
				limit = {
					ROOT = { tag = SAF }
					FROM = { tag = GRO }
					FROM.FROM = { state = 1061 }
				}
				USA = { country_event = { id = USA.saf.war.missions.13 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.13 days = 1 } }
				GRO = { country_event = { id = USA.saf.war.missions.13 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.13 days = 1 } }
				}
			}

			if = { # Salisbury recapture event
				limit = {
					ROOT = { tag = GRO }
					FROM = { tag = SAF }
					FROM.FROM = { state = 1061 }
					has_global_flag = SAF_WAR_Salisbury_captured_Captured
				}
				USA = { country_event = { id = USA.saf.war.missions.14 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.14 days = 1 } }
				GRO = { country_event = { id = USA.saf.war.missions.14 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.14 days = 1 } }
				}
			}

			if = { # Quelimane Capture event
				limit = {
					ROOT = { tag = SAF }
					FROM = { tag = GRO }
					FROM.FROM = { state = 544 }
				}
				USA = { country_event = { id = USA.saf.war.missions.11 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.11 days = 1 } }
				GRO = { country_event = { id = USA.saf.war.missions.11 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.11 days = 1 } }
				}
			}

			if = { # Quelimane recapture event
				limit = {
					ROOT = { tag = GRO }
					FROM = { tag = SAF }
					FROM.FROM = { state = 544 }
					has_global_flag = SAF_WAR_Quelimane_Captured
				}
				USA = { country_event = { id = USA.saf.war.missions.12 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.12 days = 1 } }
				GRO = { country_event = { id = USA.saf.war.missions.12 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.12 days = 1 } }
				}
			}

			if = { # Leopold Capture event
				limit = {
					ROOT = { tag = SAF }
					FROM = { tag = COG }
					FROM.FROM = { state = 295 }
				}
				USA = { country_event = { id = USA.saf.war.missions.9 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.9 days = 1 } }
				COG = { country_event = { id = USA.saf.war.missions.9 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.9 days = 1 } }
				}
			}

			if = { # Leopold recapture event
				limit = {
					ROOT = { tag = COG }
					FROM = { tag = SAF }
					FROM.FROM = { state = 295 }
					has_global_flag = SAF_WAR_Leopoldville_Captured
				}
				USA = { country_event = { id = USA.saf.war.missions.10 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.10 days = 1 } }
				COG = { country_event = { id = USA.saf.war.missions.10 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.10 days = 1 } }
				}
			}

			if = { # Libreville Capture event
				limit = {
					ROOT = { tag = SAF }
					FROM = { tag = COG }
					FROM.FROM = { state = 529 }
				}
				USA = { country_event = { id = USA.saf.war.missions.7 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.7 days = 1 } }
				COG = { country_event = { id = USA.saf.war.missions.7 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.7 days = 1 } }
				}
			}

			if = { # Libreville recapture event
				limit = {
					ROOT = { tag = COG }
					FROM = { tag = SAF }
					FROM.FROM = { state = 529 }
					has_global_flag = SAF_WAR_Libre_Captured
				}
				USA = { country_event = { id = USA.saf.war.missions.8 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.8 days = 1 } }
				COG = { country_event = { id = USA.saf.war.missions.8 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.8 days = 1 } }
				}
			}

			if = { # Johanas capture event
				limit = {
					ROOT = { tag = SAF }
					FROM = { tag = BOR }
					FROM.FROM = { state = 940 }
				}
				USA = { country_event = { id = USA.saf.war.missions.5 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.5 days = 1 } }
				BOR = { country_event = { id = USA.saf.war.missions.5 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.5 days = 1 } }
				}
			}

			if = { # Johanas recapture event
				limit = {
					ROOT = { tag = BOR }
					FROM = { tag = SAF }
					FROM.FROM = { state = 275 }
					has_global_flag = SAF_WAR_Johans_Captured
				}
				USA = { country_event = { id = USA.saf.war.missions.6 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.6 days = 1 } }
				BOR = { country_event = { id = USA.saf.war.missions.6 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.6 days = 1 } }
				}
			}

			if = { # Bloem Capture
				limit = {
					ROOT = { tag = SAF }
					FROM = { tag = BOR }
					FROM.FROM = { state = 275 }
				}
				USA = { country_event = { id = USA.saf.war.missions.3 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.3 days = 1 } }
				BOR = { country_event = { id = USA.saf.war.missions.3 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.3 days = 1 } }
				}
			}

			if = { # Bloem recapture
				limit = {
					ROOT = { tag = BOR }
					FROM = { tag = SAF }
					FROM.FROM = { state = 275 }
					has_global_flag = SAF_WAR_Bloem_Captured
				}
				USA = { country_event = { id = USA.saf.war.missions.4 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.4 days = 1 } }
				BOR = { country_event = { id = USA.saf.war.missions.4 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.4 days = 1 } }
				}
			}

			if = { # Windhoek recapture
				limit = {
					ROOT = { tag = ANG }
					FROM = { tag = SAF }
					FROM.FROM = { state = 778 }
					has_global_flag = SAF_WAR_Windhoek_Captured
				}
				USA = { country_event = { id = USA.saf.war.missions.2 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.2 days = 1 } }
				ANG = { country_event = { id = USA.saf.war.missions.2 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.2 days = 1 } }
				}
			}

			if = { # Windhoek capture
				limit = {
					ROOT = { tag = SAF }
					FROM = { tag = ANG }
					FROM.FROM = { state = 778 }
				}
				USA = { country_event = { id = USA.saf.war.missions.1 days = 1 } }
				SAF = { country_event = { id = USA.saf.war.missions.1 days = 1 } }
				ANG = { country_event = { id = USA.saf.war.missions.1 days = 1 } }
				if = {
					limit = { NOT = { SAF = { has_volunteers_amount_from = { tag = BRA count = 0 } } } }
					BRA = { country_event = { id = USA.saf.war.missions.1 days = 1 } }
				}
			}

		}


	}

	#EVENTS
	on_startup = {
		effect = {
			#ZZZ = {
			#	country_event = { # Andean Pact
			#		id = LATAM.8
			#		days = 1249
			#	}
			#}
			every_country = {
				news_event = { # FIFA
					id = LATAM_news.42
					days = 167
				}
				news_event = { # Che Guevara Released
					id = LATAM_news.17
					days = 195
				}
				news_event = { # Punta del Este Meeting // Revolutionary Coordination Junta
					id = LATAM_news.18
					days = 388
				}
				#news_event = { # Martyrs Day
				#	id = LATAM_news.3
				#	days = 738
				#}
				news_event = { # Latam Congress of Fascist Youth!
					id = LATAM_news.43
					days = 340
				}
			}
			BLZ = {
				country_event = { # Belmopan Plan
					id = BLZ_skeleton.1
					days = 480
				}
			}
			CHL = {
				country_event = { # Cautinazo
					id = LATAM.7
					days = 559
				}
				country_event = { # Laguna del Desierto
					id = LATAM.1
					days = 1405
				}
			}

			COL = {
				country_event = { # Gomez fucking dies
					id = colombia.0
					days = 100
				}
				country_event = { # Pinilla takes over
					id = colombia.1
					days = 160
				}
				country_event = { # Pinilla check
					id = colombia.2
					days = 365
				}
				country_event = { # Border clashes
					id = colombia.7
					days = 1281
				}
				country_event = { #nazis spawn
					id = colombia.18
					days = 1295
				}
				country_event = { # Civil War restarts
					id = colombia.8
					days = 1712
				}
			}
			####

			USA = {
				set_country_flag = USA_var_display_hidden #Hides var display
				
				set_variable = { USA_political_weekly_tick = 0.004 }
				
				set_variable = { USA_crisis_counter = 0 } #Variable used to track crisis status, if > 0 country is in crisis

				#MLK speech
				country_event = { id = USA.66 days = 15 random_hours = 1440 }

				#NIXON STARTS HIS WILD WILD RIDE YEE HAW
				country_event = { id = USA.125 days = 2 }
				country_event = { id = USA.71 days = 31 }
				country_event = { id = USA.73 days = 68 }
				country_event = { id = USA.74 days = 109 }
				country_event = { id = USA.75 days = 130 }
				country_event = { id = USA.76 days = 160 }
				country_event = { id = USA.77 days = 190 }
				country_event = { id = USA.83 days = 384 }
				country_event = { id = USA.84 days = 384 }
				country_event = { id = USA.85 days = 384 }
				country_event = { id = USA.86 days = 410 }
				country_event = { id = USA.87 days = 428 }
				country_event = { id = USA.88 days = 459 }
				country_event = { id = USA.89 days = 489 }
				country_event = { id = USA.90 days = 520 }
				country_event = { id = USA.91 days = 550 }
				country_event = { id = USA.92 days = 581 }
				country_event = { id = USA.93 days = 581 }
				country_event = { id = USA.94 days = 612 }
				country_event = { id = USA.96 days = 673 }
				country_event = { id = USA.97 days = 703 }
				country_event = { id = USA.98 days = 765 }
				country_event = { id = USA.99 days = 794 }
				country_event = { id = USA.100 days = 825 }
				country_event = { id = USA.101 days = 855 }
				country_event = { id = USA.102 days = 886 }
				#country_event = { id = USA.167 days = 400 }

				#Nixon Wild Ride Landing Method
				country_event = { id = USA.3 days = 180 }
				#country_event = { id = USA.4 days = 31 } # This should be called by the mccormack ascention
				country_event = { id = USA.5 days = 1065 } # 2 december 1964

				#NPP Event
				#country_event = { id = USA.105 days = 988 }

				#Civil Rights starts getting bad
				country_event = { id = USA.115 days = 200 }
				#PRESIDENT STUFF
				#1964 Primaries - NPP
				country_event = { id = USA.130 days = 964 }
				#1964 Primaries - RD
				country_event = { id = USA.133 days = 970 }

				#1968 Primaries - NPP
				country_event = { id = USA_elec_prim.2 days = 2373 }
				country_event = { id = USA_elec_prim.2 days = 2387 }
				#1968 Primaries - RD
				country_event = { id = USA_elec_prim.1 days = 2373 }
				country_event = { id = USA_elec_prim.1 days = 2387 }

				#1972 Primaries - NPP
				country_event = { id = USA_elec_prim.12 days = 3834 }
				country_event = { id = USA_elec_prim.12 days = 3848 }
				#1972 Primaries - RD
				country_event = { id = USA_elec_prim.11 days = 3834 }
				country_event = { id = USA_elec_prim.11 days = 3848 }

				#SENATE
				#1962 Elections preparation
				country_event = { id = USA_election_helpers.6 days = 30 }
				#1964 Elections preparation, Presidential
				country_event = { id = USA_election_helpers.1 days = 760 }
				country_event = { id = USA_election_helpers.11 days = 760 }
				#1966 Elections preparation
				country_event = { id = USA_election_helpers.3 days = 1491 }
				#1968 Elections preparation, Presidential
				country_event = { id = USA_election_helpers.6 days = 2221 }
				country_event = { id = USA_election_helpers.11 days = 2221 }
				#1970 Elections preparation
				country_event = { id = USA_election_helpers.1 days = 2952 }
				#1972 Elections preparation, Presidential
				country_event = { id = USA_election_helpers.3 days = 3682 }
				country_event = { id = USA_election_helpers.11 days = 3682 }
				##1974 Elections preparation
				country_event = { id = USA_election_helpers.6 days = 4413 } # THANKS TNO GENERAL CHAT
				##1976 Elections preparation, Presidential
				#country_event = { id = USA_election_helpers.1 days = 5143 }
				#country_event = { id = USA_election_helpers.11 days = 5143 }
				##1978 Elections preparation
				#country_event = { id = USA_election_helpers.3 days = 5874 }
				##1980 Elections preparation, Presidential
				#country_event = { id = USA_election_helpers.6 days = 6604 }
				#country_event = { id = USA_election_helpers.11 days = 6604 }
				##1982 Elections preparation
				#country_event = { id = USA_election_helpers.1 days = 7335 }

				## Senate deaths - name lists aren't set up for their replacements, not dealing with that
				#country_event = { id = USA.senate.deaths.1 days = 2536 }
				#country_event = { id = USA.senate.deaths.3 days = 1580 }
				#country_event = { id = USA.senate.deaths.5 days = 941 }
				#country_event = { id = USA.senate.deaths.7 days = 1203 }
				#country_event = { id = USA.senate.deaths.9 days = 2572 }

				USA_pie_chart_math = yes #pie chart adjustment is now on monthly pulse #this is true but it needs to happen at game start too
				#country_event = { id = USA.124 } #pie chart old montly pulse I assume

				#ECONOMY EXPECTATIONS eco
				country_event = { id = USA.120 days = 300 } #set expectation for 64 - event pops up in 62
				country_event = { id = USA.121 days = 1035 } #check expectation for 64
				country_event = { id = USA.121 days = 1765 } #check expectation for 66
				country_event = { id = USA.121 days = 2496 } #check expectation for 68
				country_event = { id = USA.121 days = 3226 } #check expectation for 70
				country_event = { id = USA.121 days = 3957 } #check expectation for 72

				#76 and 80 are to be coded in, t. lazy lazer

				country_event = { id = USA.144 days = 371 } #Wallace relection
				country_event = { id = hart.misc.7 days = 383 } #John Glenn election, not anymore loser now its chep getting married
				country_event = { id = hart.misc.5 days = 1445 } # Jane Jacobs Intro
				country_event = { id = USA.143 days = 816 } #Alaska Earthquake

				country_event = { id = USA.1803 days = 2930 } #do you still not have civil rights in the 70s

				country_event = { id = USA.1901 days = 1714 } #Pre-Stonewall 1
				country_event = { id = USA.1902 days = 2147 } #Pre-Stonewall 2
				country_event = { id = USA.1903 days = 2347 } #Pre-Stonewall 3
				country_event = { id = USA.1904 days = 2500 } #Pre-Stonewall 4
				country_event = { id = USA.1905 days = 2736 } #Stonewall Riots

				country_event = { id = USASJ.2 days = 100 random_hours = 16000 }
				
				###PHILIPPINES### Deprecated for now
				#country_event = { id = PHI_Blitz.1 days = 35 }
				###
				
				#country_event = { id = WFB.315 days = 2920 }
				
				#Indonesia#
				country_event = { id = USA_INS.100 days = 150 }
				
				#India
				country_event = { id = USA_IND.6 days = 800 }
				
				#Flavor events
				#country_event = { id = USA.culture.1 days = 2876 } #Death of Joseph Kennedy, event is all old lore
				country_event = { id = USA.culture.5 days = 1571 }
				country_event = { id = USA.culture.6 days = 1808 }
				country_event = { id = USA.culture.7 days = 2428 }
				country_event = { id = USA.culture.8 days = 1938 }
				country_event = { id = USA.culture.11 days = 832 }
				country_event = { id = USA.culture.13 days = 2644 }
				country_event = { id = USA.culture.14 days = 81 }
				country_event = { id = USA.culture.15 days = 373 }
				country_event = { id = USA.culture.16 days = 644 }
				country_event = { id = USA.culture.17 days = 836 }
				country_event = { id = USA.culture.18 days = 3762 }
				country_event = { id = USA.culture.19 days = 764 }
				country_event = { id = USA.culture.20 days = 645 }
				country_event = { id = USA.culture.21 days = 363 }
				country_event = { id = USA.culture.22 days = 815 }
				country_event = { id = USA.culture.23 days = 1362 }
				country_event = { id = USA.culture.24 days = 2843 }
				country_event = { id = USA.culture.25 days = 985 }
				country_event = { id = USA.culture.26 days = 1616 }
				country_event = { id = USA.culture.27 days = 3919 }
				country_event = { id = USA.culture.28 days = 489 }
				country_event = { id = USA.culture.30 days = 269 }
				country_event = { id = USA.culture.31 days = 414 }
				country_event = { id = USA.culture.32 days = 31 }
				country_event = { id = USA.culture.34 days = 2492 }
				country_event = { id = USA.culture.35 days = 274 }
				country_event = { id = USA.culture.36 days = 449 }
				country_event = { id = USA.culture.37 days = 951 }
				country_event = { id = USA.culture.38 days = 1098 }
				country_event = { id = USA.culture.39 days = 1595 }
				country_event = { id = USA.culture.40 days = 1932 }
				country_event = { id = USA.culture.41 days = 2622 }
				country_event = { id = USA.culture.42 days = 2736 }
				country_event = { id = USA.culture.43 days = 1929 }
				country_event = { id = USA.culture.44 days = 2787 }
				country_event = { id = USA.early_flavor.1 days = 219 }
				country_event = { id = USA.early_flavor.8 days = 753 }
				country_event = { id = USA.early_flavor.11 days = 397 }
				country_event = { id = USA.flavor.1 days = 825 }
				country_event = { id = USA.flavor.3 days = 798 }
				#country_event = { id = USA.flavor.10 days = 98 }
				#country_event = { id = USA.flavor.11 days = 443 }
				country_event = { id = USA.flavor.12 days = 730 }
				country_event = { id = USA.flavor.13 days = 835 }
				country_event = { id = USA.flavor.14 days = 910 }
				country_event = { id = USA.flavor.15 days = 2735 }
				country_event = { id = USA.flavor.16 days = 36 }
				country_event = { id = USA.spyflavor.1 days = 530 }
				country_event = { id = USA.spyflavor.2 days = 1079 }
				country_event = { id = USA.spyflavor.3 days = 1494 }
				country_event = { id = USA.spyflavor.4 days = 2047 }
				country_event = { id = USA.spyflavor.5 days = 2502 }
				country_event = { id = USA.spyflavor.6 days = 2533 }
				country_event = { id = USA.spyflavor.7 days = 2534 }

				#SCHLAFLY owns the LIBBERS
				country_event = { id = USA_schlafly_flavor.1 days = 97 }
				country_event = { id = USA_schlafly_flavor.20 days = 721 } #SAW
				country_event = { id = USA_schlafly_flavor.25 days = 2950 } #schlafly 1970 events

				country_event = { id = USA.1760 days = 235 } # Kirkpatrick flavour event chain - August 24, 1962
				country_event = { id = kirk.25 days = 561 } # The Case for Supporting the Free State of Magadan - July 16, 1963

				country_event = { id = USA.flavor.27 days = 4981 } #star wars: in guatemala or tunisia?

				set_variable = { USA_campaigning_multiplier = 1 }
				set_variable = { USA_campaigning_efficiency_reset_point = 1 } #Alter this is you want campaigning efficiency to reset to a different value post election

				USA_define_president_vars = yes

				set_variable = { africa_total_riot_event_variable = 1 }

				country_event = { id = USA_FBI_LATAM.7 days = 173 } # Paraguay Prelude
			}

			CAN = {
				country_event = { id = OFN.20 days = 463 } #1963 Election
				country_event = { id = OFN.21 days = 2138 } #1967 Election
				news_event = { id = WORLD.18216 days = 1943 } #Expo 67 Montréal
				#news_event = { id = WORLD.18217 days = 2008 } #Canadian Centennial
			}
			
			AST = {
				country_event = { id = AST_scripted.1 days = 57 } #Porking Scandal/1962 snap election
				country_event = { id = AST_scripted.3 days = 1190 } #1965 election
				country_event = { id = AST_scripted.4 days = 2284 } #1968 election
				country_event = { id = AST_scripted.5 days = 3381 } #1971 election
				country_event = { id = AST_scripted.7 days = 930 } #the question of a republic
				country_event = { id = AST_scripted.10 days = 2159 } #nuke trigger, late 1967
			}

			PRU = {
				country_event = { id = peru_skel.1 days = 160 } # 1962 Elections
			}

			USA = {
				country_event = {
					id = us_elections.1
				}
			}

			USA = {
				country_event = { id = USA.128 days = 2400 } #MLK Dies
			}

		}
	}

	#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

	#STARTUP DEFINITIONS
	on_startup = {
		effect = {
			USA = {
				set_country_flag = USA_60_R_RD

				set_country_flag = USA_initial_tree_flag
				load_focus_tree = USA_initial_tree
				set_variable = { USA_unity = 10 }
				set_variable = { OFN_unity = 13 }

				#Moved out of history file
				set_country_flag = USA_containment_theory_flag
				set_country_flag = USA_toe_the_middle_line_flag

				#Country Flags for voting blocks
				set_country_flag = USA_RD_United
				set_country_flag = USA_Right_Yockey_United
				set_country_flag = USA_Left_Center_United
				USA_get_total_congress_votes = yes

				# Fopo STARTUP
				set_variable = { TNO_fopo_selected_front = 1 }

				#Supreme court
				set_variable = { US_judge1 = 1 }
				set_variable = { US_judge2 = 1 }
				set_variable = { US_judge3 = 2 }
				set_variable = { US_judge4 = 1 }
				set_variable = { US_judge5 = 2 }
				set_variable = { US_judge6 = 1 }
				set_variable = { US_judge7 = 1 }
				set_variable = { US_judge8 = 1 }
				set_variable = { US_judge9 = 2 }
				set_variable = { US_judge10 = 0 } #pog
				set_variable = { US_judge11 = 0 } #poggg
				set_variable = { US_judge12 = 0 } #wow so pog
				set_variable = { US_judge13 = 0 } #extremely pog
				set_variable = { US_judge14 = 0 } #pog pog pog pog
				set_variable = { US_judge15 = 0 } #ultra mega giga pog pog pog
				set_variable = { USj_next = 1 }
				set_variable = { US_judge_count = 9 }
				set_variable = { US_supreme_court = 14 }
				set_variable = { US_sc_ccount = 4 }
				set_variable = { US_sc_lcount = 5 }


				set_variable = { presidents_party = 1 }
				set_variable = { bill_id = 0 } #no bill to pass at game start

				#These go between 0 and 30
				set_variable = { USA_RD_Unity = 25 }
				set_variable = { USA_NPP_Unity = 20 }
				clamp_variable = {
					var = USA_RD_Unity
					min = 0
					max = 30
				}
				clamp_variable = {
					var = USA_NPP_Unity
					min = 0
					max = 30
				}
				#The number of extra votes you have outside your voting block
				set_variable = { temporary_congress_votes = 0 }
				#The number of extra votes you have for one single piece of legislation
				set_variable = { temporary_congress_votes_next_bill = 0 }

				#other variables
				set_variable = { US_presidents = 36 }
				set_variable = { EPA_strength = 0 } #doesnt exist

				add_to_array = { global.OFN_members = CAN }
				add_to_array = { global.OFN_members = FAR }
				add_to_array = { global.OFN_members = AST }
				add_to_array = { global.OFN_members = NZL }
				add_to_array = { global.OFN_members = ICE }
				add_to_array = { global.OFN_members = GUY }
				add_to_array = { global.OFN_members = SUR }
				add_to_array = { global.OFN_members = WIN }
				add_to_array = { global.OFN_members = BLZ }
				add_to_array = { global.OFN_members = HAI }
			}

			NZL = {
				# RESOURCE RIGHTS
				give_resource_rights = { receiver = USA state = 723 resources = { oil aluminium rubber tungsten steel chromium uranium } }
				
				# National Spirits
				set_variable = { NZL_Culture_War_var = 9 } # Anglo Dominance
				set_variable = { NZL_World_Stage_var = 9 } # Bearer of the Torch
				set_variable = { NZL_Social_Fabric_var = 9 } # Pristine
				
				# Skeleton PM Events
				country_event = { id = new_zealand_pm_skeleton.1 days = 698 }
			}

			USA = {
				initialize_US_elections_system = yes
				recalculate_supreme_court = yes
			}

			CUB = {
				#Starting event
				#Cuban starting tourism level
				set_variable = { CUB_tourism = -20 }

				#US trust of the Cuban government
				set_variable = { CUB_US_trust = 10 }

				#Cuban domestic terror support
				set_variable = { CUB_terror_popularity = 1 }

				#Cuban terrorist capabilities
				set_variable = { CUB_terror_power = 1 }
			}
		}
	}

	#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	#WW3 starts, USA gotta load in a swanky new tree
	on_declare_war = {
		effect = {
			if = {
				limit = {
					ROOT = {
						OR = {
							tag = JAP
							tag = GER
						}
					}
					FROM = { tag = USA }
				}
				USA = {
					set_country_flag = USA_WW3_Is_On
					add_to_variable = { USA_crisis_counter = 1 }
					USA_reload_presidential_tree = yes
					country_event = { id = USA.WW3.1 }
					set_global_flag = TNO_world_tension_WW3
				}
			}

			if = {
				limit = {
					ROOT = { tag = USA }
					FROM = {
						OR = {
							tag = JAP
							tag = GER
						}
					}
				}
				USA = {
					set_country_flag = USA_WW3_Is_On
					add_to_variable = { USA_crisis_counter = 1 }
					USA_reload_presidential_tree = yes
					country_event = { id = USA.WW3.1 }
					set_global_flag = TNO_world_tension_WW3
				}
			}

			if = { # WW3 Super event
				limit = {
					OR = {
						AND = {
							OR = {
								ROOT = { tag = JAP }
								ROOT = { tag = GER }
							}
							FROM = { tag = USA }
						}
						AND = {
							OR = {
								FROM = { tag = JAP }
								FROM = { tag = GER }
							}
							ROOT = { tag = USA }
						}
					}
					NOT = {
						has_global_flag = german_civil_war_goeringvic
					}
				}
				set_global_flag = TNO_world_tension_WW3
				every_country = {
					limit = {
						is_ai = no
					}
					set_temp_variable = { TNO_temp_super_event = token:SE_WW3 }
					TNO_fire_super_event = yes
				}
			}
		}
	}
	#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	#on_startup = { #COMMENT THIS OUT TO DISABLE PRINTING BY DEFAULT, thanks testers
	#	effect = {
	#		USA = {
	#			set_country_flag = USA_debug_printing_all
	#			country_event = {
	#				id = USA.10000
	#			}
	#		}
	#	}
	#}

	on_daily_USA = {
		effect = {
			USA_check_if_crisis_to_cancel_bill = yes
			if = {
				limit = {
					has_country_flag = pros_dead_forever
				}
				USA_keeping_the_pros_dead = yes
			}
			if = {
				limit = {
					has_country_flag = nats_dead_forever
				}
				USA_keeping_the_nats_dead = yes
			}
			if = { #Campaigns effects - self
				limit = {
					has_variable = US_voting_campaign_region:US_voting_campaign_timer
					check_variable = { US_voting_campaign_region:US_voting_campaign_timer < 100 }
					OR = {
						has_country_flag = USA_senate_elections
						has_country_flag = USA_presidential_elections
					}
					NOT = {
						has_country_flag = USA_senate_conclusion
						has_country_flag = USA_presidential_conclusion
					}
				}
				add_to_variable = { US_voting_campaign_region:US_voting_campaign_timer = 3.333 }
			}
			else_if = {
				limit = {
					has_country_flag = USA_senate_elections
					check_variable = { US_voting_campaign_region:US_voting_campaign_timer > 99.99 } #Because variables do be trolling
					check_variable = { US_voting_campaign_region:US_voting_campaign_countdown = 0 }
					NOT = { has_country_flag = USA_senate_conclusion }
				}
				USA_campaigning_effect_senate = yes
				clear_variable = US_voting_campaign_region:US_voting_campaign_timer
				set_variable = { US_voting_region_cooldown = US_voting_campaign_region }
				set_variable = { US_voting_region_cooldown:US_voting_campaign_countdown = 20 }
			}
			else_if = {
				limit = {
					has_country_flag = USA_presidential_elections
					check_variable = { US_voting_campaign_region:US_voting_campaign_timer > 99.99 } #Because variables do be trolling
					check_variable = { US_voting_campaign_region:US_voting_campaign_countdown = 0 }
					NOT = { has_country_flag = USA_presidential_conclusion }
				}
				USA_campaigning_effect = yes
				clear_variable = US_voting_campaign_region:US_voting_campaign_timer
				set_variable = { US_voting_region_cooldown = US_voting_campaign_region }
				set_variable = { US_voting_region_cooldown:US_voting_campaign_countdown = 20 }
			}
			if = { #Gradual reduction of campaign cooldown
				limit = { check_variable = { US_voting_region_cooldown:US_voting_campaign_countdown > 0 } }
				add_to_variable = { US_voting_region_cooldown:US_voting_campaign_countdown = -1 }
			}
			else_if = { #Reset of timer variable for visuals
				limit = { check_variable = { US_voting_region_cooldown:US_voting_campaign_countdown < 1 } }
				clear_variable = US_voting_region_cooldown:US_voting_campaign_timer
			}
			
			if = { #Campaigns effects - opposition campaign start
				limit = {
					NOT = { has_country_flag = currently_campaigning_opposition }
					check_variable = { US_voting_opposition_campaign_countdown = 0 }
					OR = {
						has_country_flag = USA_senate_elections
						has_country_flag = USA_presidential_elections
					}
					NOT = {
						has_country_flag = USA_senate_conclusion
						has_country_flag = USA_presidential_conclusion
					}
				}
				USA_opposition_set_campaign_area = yes
				
				set_variable = { USA_opposition_campaign_region:US_voting_opposition_timer = 100 }
				divide_variable = { USA_opposition_campaign_region:US_voting_opposition_timer = 30 }
			}
			if = { #Campaigns effects - opposition campaign progress
				limit = {
					has_country_flag = currently_campaigning_opposition
					check_variable = { USA_opposition_campaign_region:US_voting_opposition_timer < 100 }
					OR = {
						has_country_flag = USA_senate_elections
						has_country_flag = USA_presidential_elections
					}
					NOT = {
						has_country_flag = USA_senate_conclusion
						has_country_flag = USA_presidential_conclusion
					}
				}
				add_to_variable = { USA_opposition_campaign_region:US_voting_opposition_timer = 3.333 }
			}
			else_if = {
				limit = {
					has_country_flag = USA_senate_elections
					check_variable = { USA_opposition_campaign_region:US_voting_opposition_timer > 99.99 } #Because variables do be trolling
					NOT = { has_country_flag = USA_senate_conclusion }
				}
				USA_campaigning_effect_opposition_senate = yes
				set_variable = { US_voting_opposition_campaign_countdown = 1 } #Take a break, Artificial not-so-Intelligence
				clear_variable = USA_opposition_campaign_region:US_voting_opposition_timer
			}
			else_if = {
				limit = {
					has_country_flag = USA_presidential_elections
					check_variable = { USA_opposition_campaign_region:US_voting_opposition_timer > 99.99 } #Because variables do be trolling
					NOT = { has_country_flag = USA_presidential_conclusion }
				}
				USA_campaigning_effect_opposition = yes
				set_variable = { US_voting_opposition_campaign_countdown = 1 } #Take a break, Artificial not-so-Intelligence
				clear_variable = USA_opposition_campaign_region:US_voting_opposition_timer
			}
			if = { #Giving a day for opposition to break
				limit = { check_variable = { US_voting_opposition_campaign_countdown > 0 } }
				add_to_variable = { US_voting_opposition_campaign_countdown = -1 }
			}
		}
	}
	on_weekly_USA = {
		effect = {
			USA_Controversy_Weekly_Tick = yes # already has a check in it.
			USA_all_demographic_shifts = yes 
		}
	}

	on_monthly_USA = {
		effect = {
			USA_pie_chart_math = yes

			if = {
				limit = {
					has_country_flag = USA_show_NPP_screen
				}
				USA_NPP_Party_Leader_Support_Updates = yes
			}

			if = {
				limit = { 
					check_variable = { date > 1971.6.10 } #mid 71, 1.5 years before 72 presidential election
					has_country_flag = USA_64_FR_NPP #wallace president, still in power (no lemay funnies)
				}
				country_event = { id = wallace.634 days = 7 } #wallace doesnt do a third term flavor event
			}
			
			if = {
				limit = {
					OR = {
						has_country_flag = USA_64_C_NPP
						has_country_flag = USA_64_FR_NPP
						has_country_flag = USA_68_FR_NPP
						has_country_flag = USA_68_R_RDC
						has_country_flag = USA_THURMOND_FR_NPP
						has_country_flag = USA_LEMAY
					}
					OR = {
						check_variable = { party_popularity@communist > 0.14 }
						check_variable = { party_popularity@national_socialism > 0.14 }
					}
				}
				USA_extremist_unity_check = yes
			}
			
			if = {
				limit = {
					has_country_flag = USA_64_R_RDC
					is_ai = no
				}
				USA_WFB_relationships_check = yes #Changes pops
			}

			add_to_variable = { month_counter = 1 }

			if = { ### Wallace, new "every 4 months" pulse
				limit = {
					has_country_flag = USA_64_FR_NPP
					has_completed_focus = USA_wal64_the_wallace_presidency
					OR = {
						check_variable = { month_counter = 1 }
						check_variable = { month_counter = 5 }
						check_variable = { month_counter = 9 }
					}
				}
				log = "[GetDateText]: [Root.GetName]: Wallace pop/expectation pulse"
				wallace_4month_pulse_check = yes

			}

			if = { ### Wallace, business check, less often
				limit = {
					has_country_flag = USA_64_FR_NPP
					has_completed_focus = USA_wal64_the_wallace_presidency
					OR = {
						check_variable = { month_counter = 1 }
						check_variable = { month_counter = 7 }
					}
				}
				log = "[GetDateText]: [Root.GetName]: Wallace business pulse"
				USA_wal_new_business_test = yes
			}

			if = { ## Yearly
				limit = {
					check_variable = {
						month_counter = 12
					}
				}
				set_variable = { month_counter = 0 }

			}

			if = {
				limit = { NOT = { has_country_flag = USA_l_npp_rise_finished } }
				if = {
					limit = {
						communist > 0.04
						NOT = { has_country_flag = USA_l_npp_rise_stage_1 }
					}
					set_country_flag = USA_l_npp_rise_stage_1
					country_event = { id = USA.flavor.4 days = 7 }
				}
				else_if = {
					limit = {
						communist > 0.09
						NOT = { has_country_flag = USA_l_npp_rise_stage_2 }
					}
					set_country_flag = USA_l_npp_rise_stage_2
					country_event = { id = USA.flavor.5 days = 7 }
				}
				else_if = {
					limit = { communist > 0.14 }
					set_country_flag = USA_l_npp_rise_finished
					country_event = { id = USA.flavor.6 days = 7 }
				}
			}

			if = {
				limit = { NOT = { has_country_flag = USA_y_npp_rise_finished } }
				if = {
					limit = {
						national_socialism > 0.04
						NOT = { has_country_flag = USA_y_npp_rise_stage_1 }
					}
					set_country_flag = USA_y_npp_rise_stage_1
					country_event = { id = USA.flavor.7 days = 7 }
				}
				else_if = {
					limit = {
						national_socialism > 0.09
						NOT = { has_country_flag = USA_y_npp_rise_stage_2 }
					}
					set_country_flag = USA_y_npp_rise_stage_2
					country_event = { id = USA.flavor.8 days = 7 }
				}
				else_if = {
					limit = { national_socialism > 0.14 }
					set_country_flag = USA_y_npp_rise_finished
					country_event = { id = USA.flavor.9 days = 7 }
				}
			}
		}
	}

	on_weekly_COL = { # Border Clashes '64
		effect = {
			if = {
				limit = {
					has_global_flag = COL_border_clashes_happening
					NOT = { has_global_flag = COL_border_war_ongoing }
				}
				random_country = { # Attacker country
					limit = {
						OR = {
							tag = COL
							AND = {
								OR = {
									tag = CLL
									tag = CLC
								}
								OR = {
									owns_state = 1662
									owns_state = 1660
									owns_state = 493
									owns_state = 1699
									owns_state = 1700
								}
							}
						}
					}
					country_event = { id = colombia.9 days = 3 random_hours = 7 }
				}
				set_global_flag = COL_border_war_ongoing
			}
		}
	}
	on_daily_COL = {
		effect = {
			if = {
				limit = {
					has_global_flag = COL_civil_war_ongoing
					OR = {
						AND = {
							country_exists = COL
							country_exists = CLL
						}
						AND = {
							country_exists = COL
							country_exists = CLC
						}
						AND = {
							country_exists = CLL
							country_exists = CLC
						}
					}
				}
				CCW_rubberband_update_effect = yes
			}
		}
	}

	on_monthly_IND = { 
		effect = {
			if = {
				limit = {
					has_dynamic_modifier = { modifier = IND_black_years_dynamic_modifier }
				}
				TNO_iwr_black_years_monthly_IND_effect = yes
			}
		}
	}

	on_monthly_NZL = {
		effect = {
			if = {
				limit = {
					NOT = {
						has_cosmetic_tag = NZL_Republic
					}
					OR = {
						has_idea = NZL_Culture_War_4
						has_idea = NZL_Culture_War_5
					}
					check_variable = {
						NZL_republic_var < 24
					}
				}
				add_to_variable = {
					NZL_republic_var = 1
				}
				if = {
					limit = {
						AND = {
							country_exists = SAF
							SAF = { has_cosmetic_tag = SAF_REP }
						}
					}
					add_to_variable = {
						NZL_republic_var = 0.5
					}
				}
				if = {
					limit = {
						AND = {
							country_exists = AST
							AST = { has_cosmetic_tag = AST_republic }
						}
					}
					add_to_variable = {
						NZL_republic_var = 0.5
					}
				}
			}
			if = {
				limit = {
					NOT = {
						has_cosmetic_tag = NZL_Republic
					}
					check_variable = {
						NZL_republic_var > 23.99
					}
				}
				country_event = new_zealand_pm_skeleton.8
			}
		}
	}
}

