on_actions = {
	on_startup = {
		effect = {
			# MONEY SYSTEM #
			every_country = {
				if = {
					limit = {
						NOT = { has_variable = money }
					}
					set_variable = { money = 100 }
				}
				add_dynamic_modifier = {
					modifier = inflation_dynamic_modifier
				}
				if = {
					limit = {
						is_ai = no
					}
					#set_variable = { show_economy_window = 1 }
				}
				if = {
					limit = {
						NOT = { has_idea = taxation_level_1 }
						NOT = { has_idea = taxation_level_2 }
						NOT = { has_idea = taxation_level_3 }
						NOT = { has_idea = taxation_level_4 }
						NOT = { has_idea = taxation_level_5 }
					}
					add_ideas = taxation_level_3
				}
				if = {
					limit = {
						NOT = { has_idea = social_spending_level_1 }
						NOT = { has_idea = social_spending_level_2 }
						NOT = { has_idea = social_spending_level_3 }
						NOT = { has_idea = social_spending_level_4 }
						NOT = { has_idea = social_spending_level_5 }
					}
					add_ideas = social_spending_level_3
				}
				if = {
					limit = {
						NOT = { has_idea = army_spending_level_1 }
						NOT = { has_idea = army_spending_level_2 }
						NOT = { has_idea = army_spending_level_3 }
						NOT = { has_idea = army_spending_level_4 }
						NOT = { has_idea = army_spending_level_5 }
					}
					add_ideas = army_spending_level_3
				}
				if = {
					limit = {
						NOT = { has_idea = research_spending_level_1 }
						NOT = { has_idea = research_spending_level_2 }
						NOT = { has_idea = research_spending_level_3 }
						NOT = { has_idea = research_spending_level_4 }
						NOT = { has_idea = research_spending_level_5 }
					}
					add_ideas = research_spending_level_3
				}
				if = {
					limit = {
						NOT = { has_idea = navy_spending_level_1 }
						NOT = { has_idea = navy_spending_level_2 }
						NOT = { has_idea = navy_spending_level_3 }
						NOT = { has_idea = navy_spending_level_4 }
						NOT = { has_idea = navy_spending_level_5 }
					}
					add_ideas = navy_spending_level_3
				}
				if = {
					limit = {
						NOT = { has_idea = road_spending_level_1 }
						NOT = { has_idea = road_spending_level_2 }
						NOT = { has_idea = road_spending_level_3 }
						NOT = { has_idea = road_spending_level_4 }
						NOT = { has_idea = road_spending_level_5 }
					}
					add_ideas = road_spending_level_3
				}
				if = {
					limit = {
						NOT = { has_idea = law_spending_level_1 }
						NOT = { has_idea = law_spending_level_2 }
						NOT = { has_idea = law_spending_level_3 }
						NOT = { has_idea = law_spending_level_4 }
						NOT = { has_idea = law_spending_level_5 }
					}
					add_ideas = law_spending_level_3
				}
				if = {
					limit = {
						NOT = {
							has_country_flag = Country_Optimised	#Blacklist or Whitelist (performance is better for whitelist)
						}
					}
					if = {
						limit = {
							calculate_money_balance = yes # calculates the money
							always = yes
						}
						# update static vars
						# this is kinda tarded but it works
						set_variable = { total_income_temp = total_income_temp }
						set_variable = { total_expenses_temp = total_expenses_temp }
						set_variable = { total_balance_temp = total_balance_temp }
					}
				}
			}
			#every_country = {
			#	pop_state_update = yes
			#}
			random_state = { state_event = { id = spain.17 days = 5 } }
			286 = { state_event = { id = cochinchina_expedition.1 days = 390 trigger_for = controller } }
			
			
			### START DATE 11.5.1857 ###
			if = {
				limit = { has_start_date < 1858.1.1 }

				### ON START-UP EVENTS IN THE YEAR 1857 (EVERYTHING ELSE SHOULD GO INTO _KDE_scripted_effect)

				# UCT - UNCLAIMED TERRITORY - USED FOR FLAVOUR AND HIDDEN STUFF
				UCT = {
					activate_mission = eoanb_treaty_QNG_shattered_qing
					news_event = { id = news_flavor.1 days = 68 }
					news_event = { id = news_flavor.21 days = 70 }
					news_event = { id = great_game.50 days = 112 } # 1857.9.1 (European explorer Schlagintweit beheaded in Kashgar)
				}
				
				# NORTH AMERICA
				MEX = {
					483 = {	add_to_variable = { var = yaqui_resistance_in_sonora value = 7 } }
				}
				USA = {
					country_event = { id = usa.352 days = 128 }
					country_event = { id = usa.266 days = 54 }
					country_event = { id = usa.344 days = 79 }
					country_event = { id = usa.249 days = 1 }
					country_event = { id = usa.341 days = 124 }
					country_event = { id = usa.346 days = 14 }
					country_event = { id = usa.347 days = 105 }
					country_event = { id = usa.348 days = 155 }
					country_event = { id = acw_generic.115 days = 100 random_days = 150 }
					country_event = { id = eco_crash.1 days = 117 random_days = 1 }
					country_event = { id = britishoceania.31 days = 810 }
					country_event = { id = usa.270 days = 131 }
					country_event = { id = nic_walker.1 days = 16 }
				}
				

				# EUROPE
				AUS = {
					country_event = { id = austria.12 days = 13 }
					country_event = { id = austria.13 days = 1 }
					country_event = { id = austria.51 days = 51 }
					country_event = { id = austria.59 days = 198 }
					country_event = { id = austria.64 days = 188 }
					country_event = { id = austria.121 days = 143 }
					country_event = { id = austria.814 days = 8 }
				}
				BAV = {
					country_event = { id = bavariaevent.22 days = 51 }
					country_event = { id = bavariaevent.0 days = 50 }
				}
				BEL = {
					country_event = { id = belgium_election.1 days = 213 } # 1857.12.10
				}
				DEN = {
					country_event = { id = denmark.201 days = 2 }
				}
				ENG = {
					country_event = { id = britain.136 days = 223 }
					country_event = { id = britain.2 days = 153 }
					country_event = { id = britain.7 days = 96 }
					country_event = { id = britain.11 days = 74 }
					country_event = { id = britain.27 days = 59 }
					country_event = { id = britain.32 days = 75 }
					country_event = { id = britain.33 days = 91 }
					country_event = { id = britain.52 days = 1 }
					country_event = { id = britain.66 days = 158 }
					country_event = { id = britain.184 days = 33 }
					country_event = { id = britishcanada.24 days = 234 }
					country_event = { id = britishindia.17 days = 10 }
				}
				FRA = {
					country_event = { id = nap_france.900 days = 248 }
					country_event = { id = france.701 days = 610 }
					country_event = { id = france.801 days = 1 }
					country_event = { id = france.231 days = 66 }
					country_event = { id = france.201 days = 43 }
					country_event = { id = rom_wallachia.12 days = 94 }
					country_event = { id = nap_france.1 days = 30 }
					country_event = { id = nap_france.4 days = 278 }
				}
				GRE = {
					country_event = { id = greece.25 days = 186 }
					country_event = { id = greece.1 days = 10 }
				}
				LVN = {
					country_event = { id = ita.993 days = 1 }
					country_event = { id = event_papacy.206 days = 1 }
				}
				MNC = {
					country_event = { id = risorgimento.713 days = 1 }
					country_event = { id = ita.993 days = 1 }
				}
				MNT = {
					country_event = { id = OTO_battleofgrahovac.3 days = 115 random_days = 10 }
					country_event = { id = OTO_battleofgrahovac.4 days = 115 random_days = 10 }
					country_event = { id = montenegro.2 days = 1170 random_days = 10 }
					country_event = { id = montenegro.9 days = 4528 random_days = 10 }
				}
				MOD = {
					country_event = { id = ita.993 days = 1 }
					country_event = { id = risorgimento.751 days = 30}
				}
				
				NOR = {
					country_event = { id = eoanb_sweden.44 days = 144 random_days = 5 }
				}
				NSC = {
					country_event = { id = risorgimento.34 days = 325 random_days = 20 }
					country_event = { id = risorgimento.602 days = 45 }
					country_event = { id = ita.993 days = 1 }
					country_event = { id = risorgimento.698 days = 219 }
				}
				PAP = {
					country_event = { id = portugal.3 days = 50 }
					country_event = { id = ita.993 days = 1 }
					country_event = { id = event_papacy.201 days = 0 }
					country_event = { id = event_papacy.202 days = 1 }
					country_event = { id = event_papacy.203 days = 5 }
					country_event = { id = event_papacy.204 days = 7 }
					country_event = { id = event_papacy.205 days = 16 }
					country_event = { id = event_papacy.206 days = 17 }
					country_event = { id = event_papacy.207 days = 27 }
					country_event = { id = event_papacy.208 days = 52 }
					country_event = { id = event_papacy.209 days = 54 }
					country_event = { id = event_papacy.210 days = 60 }
					country_event = { id = event_papacy.211 days = 73 }
					country_event = { id = event_papacy.212 days = 98 }
					country_event = { id = event_papacy.213 days = 117 }
				}
				PIE = {
					country_event = { id = risorgimento.602 days = 45 }
					country_event = { id = risorgimento.9 days = 1 }
					country_event = { id = risorgimento.210 days = 10 }
					country_event = { id = risorgimento.218 days = 167 }
					country_event = { id = risorgimento.33 days = 30 random_days = 20 }
					country_event = { id = risorgimento.268 days = 54 }
					country_event = { id = risorgimento.270 days = 40 }
					set_global_flag = eoanb_PAP_pope_pius_ix
					country_event = { id = ita.993 days = 1 }
				}
				POR = {
					country_event = { id = portugal.36 days = 75 }
				}
				PRM = {
					country_event = { id = ita.993 days = 1 }
					country_event = { id = event_papacy.207 days = 27 }
				}
				PRS = {
					country_event = { id = prussia.76 days = 74 }
					country_event = { id = prussia.91 days = 51 }
				}
				ROM = {
					country_event = { id = wallachian_union.12 days = 90 random_days = 5 }
					country_event = { id = rom_wallachia.1 days = 1 }
					country_event = { id = rom_wallachia.2 days = 91 }
				}
				RUS = {
					add_named_threat = { threat = 4.5 name = "The Crimean War" }
					RUS_great_game_map_update = yes
					country_event = { id = austria.121 days = 143 }
					country_event = { id = rossiya.501 days = 109 }
					country_event = { id = rossiya.510 days = 225 }
					country_event = { id = rossiya.811 days = 142 }
				}
				SAX = {
					country_event = { id = saxony.12 days = 143 }
					country_event = { id = saxony.14 days = 204 }
					country_event = { id = saxony.51 days = 21 }
					country_event = { id = saxony.181 days = 150 }
					country_event = { id = saxony.205 days = 51 }
					country_event = { id = saxony.206 days = 174 }
					country_event = { id = saxony.201 days = 532 }
				}
				SER = {
					country_event = { id = SER_politics.8 days = 1622 }
					country_event = { id = SER_politics.20 days = 154 }
				}
				SPR = {
					country_event = { id = spain.1 days = 191 random_days = 5 }
					country_event = { id = spain.3 days = 241 random_days = 5 }
					country_event = { id = spain.8 days = 5 random_days = 5 }
					country_event = { id = spain.9 days = 3155 }
					country_event = { id = spain.14 days = 21 }
					country_event = { id = spain.16 days = 18 }
				}
				SWE = {
					country_event = { id = eoanb_sweden.3 days = 14 random_days = 14 }
					country_event = { id = eoanb_sweden.44 days = 144 random_days = 5 }
					country_event = { id = eoanb_sweden.58 days = 219 }
				}
				SWI = {
					country_event = { id = swiss.9 days = 120 }
				}
				TUS = {
					country_event = { id = risorgimento.500 days = 1 }
					country_event = { id = risorgimento.602 days = 45 }
					country_event = { id = event_papacy.202 days = 1 }
					country_event = { id = ita.993 days = 1 }
				}
				
				# MIDDLE EAST / CENTRAL ASIA
				GWA = { add_to_war = { targeted_alliance = SRS enemy = RAJ } }
				OTO = {
					country_event = { id = OTO_battleofgrahovac.9 days = 20 } #if you want to test you must remove #
					country_event = {id = OTO_events.40 days = 505 random_days = 3}
					country_event = {id = OTO_events.217 days = 21 random_days = 184}
					country_event = {id = OTO_events.231 days = 204 random_days = 30 }
				}
				OUD = { add_to_war = { targeted_alliance = SRS enemy = RAJ } }
				PER = {
					add_named_threat = { threat = 0.5 name = "Persian Invasion for Herat" }
					country_event = { id = persia.354 days = 55 } 
				}
				RAJ = {
					country_event = { id = britishindia.17 days = 10 }
					set_global_flag = eoanb_flag_sepoy_rebellion_ongoing
					set_global_flag = eoanb_flag_sow_ongoing
				}
				SRS = { country_event = { days = 5 id = sepoy.1 } }

				# EAST ASIA
				CAM = {
					741 = { set_demilitarized_zone = yes }
				}
				CSK = {
					995 = { set_demilitarized_zone = yes }
				}
				KOR = {
					country_event = { id = KOR_joseon_dynasty.6 days = 10 } # 1857.5.21
				}
				QNG = {
					country_event = { id = portugal.36 days = 75 }
					country_event = { id = asiageneraldiplomatic.13 days = 115 }
				}
				RYU = {
					country_event = { id = ryukyu.4 days = 7 }
					country_event = { id = ryukyu.3 days = 25 random = 10 }
				}
				SGP = {
					country_event = { id = britishmalaya.1 days = 22}
					country_event = { id = britishmalaya.5 days = 174 }
				}
				TAI = {
					add_named_threat = { threat = 2.5 name = "Taiping War of Liberation" }
				}
				TSH = {
					country_event = { id = JAP_tokugawa_shogunate.1 days = 2 }
					country_event = { id = JAP_tokugawa_shogunate.61 days = 100 random_days = 50 }
				}
				VIN = {
					country_event = { id = VIN_nguyen_dynasty.1 days = 2 }
				}

				# OCEANIA


				# North Africa 
				MOR = {
					country_event = { id = morocco.31 days = 1 } # 1857.5.12
				}
				TUN = {
					country_event = { id = tunisia.1 days = 11 } # 1857.5.23
				}
			}


			### START DATE 1870 ###
			else_if = {
				limit = {
					has_start_date < 1871.1.1
				}
				FRA = {
					country_event = { id = france.757 days = 527 random_days = 400 }
				}
				JAP = { eoanbsys_demographic_bookmark_adjustment = yes }
				ROM = { set_cosmetic_tag = ROM_costag_generic_formed }
				USA = { set_global_flag = USA_gilded_age_ft load_focus_tree = usa_gilded_age }
			}

			### OTHER THINGS NEEDED FOR EVERY START DATE
			NSC = {
				NSC_mariano_d_ayala = { set_character_flag = NSC_exiled_character_flag }
				NSC_errico_amante = { set_character_flag = NSC_exiled_character_flag }
				NSC_bertrando_spaventa = { set_character_flag = NSC_exiled_character_flag }
				NSC_luigi_settembrini = { set_character_flag = NSC_exiled_character_flag }
				NSC_antonio_ranieri = { set_character_flag = NSC_exiled_character_flag }
				NSC_raffaele_piria = { set_character_flag = NSC_exiled_character_flag }
				NSC_enrico_pessina = { set_character_flag = NSC_exiled_character_flag }
				NSC_giuseppe_antonio_pasquale = { set_character_flag = NSC_exiled_character_flag }
				NSC_francesco_saverio_de_sanctis = { set_character_flag = NSC_exiled_character_flag }
				NSC_pasquale_villari = { set_character_flag = NSC_exiled_character_flag }
			}
		}
	}
}
