﻿##This event file is for the setup and settings events##
##Use scripted_effects and scripted_triggers in the future!##

add_namespace = dynamic_wp_config
add_namespace = dw_flags
add_namespace = dynamic_wp_config_mod



####################################
####    SETTINGS EVENT CHAIN    ####
####################################


##Intro
country_event = {

	id = dynamic_wp_config.1                
	title = dynamic_wp_config.1.t   
	desc =  dynamic_wp_config.1.d   
	picture = GFX_SWP_SETUP
	immediate = { log = "[GetDateText]: [Root.GetName]: dynamic_wp_config.1" }

	fire_only_once = yes ##Should only trigger one time for one player
	is_triggered_only = yes ##Triggered through news event which is triggered through on_actions


	immediate = {	
		set_country_flag = dynamic_wp_config	
	}

	##Take me there!
	option = {
		name = dynamic_wp_config.1.a 
			country_event = { id = dynamic_wp_config.3 } ##Option: AI is ignored for now!
	}
	
	##Abort the settings
	option = {
		name = dynamic_wp_config.1.b   
			add_political_power = -1
			
			#hidden_effect = { country_event = { days = 1 id = dynamic_wp_config_mod.1 } }
	}	
	
}


##First Option: AI ##Currently deactivated!
country_event = {

	id = dynamic_wp_config.2                
	title = dynamic_wp_config.2.t   
	desc =  dynamic_wp_config.2.d   
	picture = GFX_SWP_SETUP
	immediate = { log = "[GetDateText]: [Root.GetName]: dynamic_wp_config.2" }

	fire_only_once = yes
	is_triggered_only = yes 


	##Activate
	option = {
		name = dynamic_wp_config.2.a 
			country_event = { id = dynamic_wp_config.3 }
			
			set_global_flag = swp_ai_settings
	}
	
	
	##Deactivate
	option = {
		name = dynamic_wp_config.2.b  
		
			country_event = { id = dynamic_wp_config.3 }
	}	
	
}


##Second Option: government and coup stuff
country_event = {

	id = dynamic_wp_config.3                
	title = dynamic_wp_config.3.t   
	desc =  dynamic_wp_config.3.d   
	picture = GFX_SWP_SETUP
	immediate = { log = "[GetDateText]: [Root.GetName]: dynamic_wp_config.3" }

	fire_only_once = yes
	is_triggered_only = yes 


	##Activate
	option = {
		name = dynamic_wp_config.3.a 
			country_event = { id = dynamic_wp_config.4 }
			
			set_global_flag = swp_government_settings
	}
	
	
	##Deactivate
	option = {
		name = dynamic_wp_config.3.b  

			country_event = { id = dynamic_wp_config.4 }
	}	
	
}


##Third Option: vanilla peace conference
country_event = {

	id = dynamic_wp_config.4               
	title = dynamic_wp_config.4.t   
	desc =  dynamic_wp_config.4.d   
	picture = GFX_SWP_SETUP
	immediate = { log = "[GetDateText]: [Root.GetName]: dynamic_wp_config.4" }

	fire_only_once = yes
	is_triggered_only = yes 


	##Activate
	option = {
		name = dynamic_wp_config.4.a 
			country_event = { id = dynamic_wp_config.5 }
			
			set_global_flag = swp_vanilla_conference_settings
	}
	
	
	##Deactivate
	option = {
		name = dynamic_wp_config.4.b  

			country_event = { id = dynamic_wp_config.5 }
	}	
	
}


##Fourth Option: Easier Decisions
country_event = {

	id = dynamic_wp_config.5               
	title = dynamic_wp_config.5.t   
	desc =  dynamic_wp_config.5.d   
	picture = GFX_SWP_SETUP
	immediate = { log = "[GetDateText]: [Root.GetName]: dynamic_wp_config.5" }

	fire_only_once = yes
	is_triggered_only = yes 


	##Activate
	option = {
		name = dynamic_wp_config.5.a 
			country_event = { id = dynamic_wp_config.6 }
			
			set_global_flag = swp_easier_decisions_settings
	}
	
	
	##Deactivate
	option = {
		name = dynamic_wp_config.5.b  

			country_event = { id = dynamic_wp_config.6 }
	}	
	
}


##Last Event of the chain. Success!
country_event = {

	id = dynamic_wp_config.6               
	title = dynamic_wp_config.6.t   
	desc =  dynamic_wp_config.6.d   
	picture = GFX_SWP_SETUP
	immediate = { log = "[GetDateText]: [Root.GetName]: dynamic_wp_config.6" }

	fire_only_once = yes
	is_triggered_only = yes 


	##Success!
	option = {
		name = dynamic_wp_config.6.a 
			add_political_power = 1	
			
			#hidden_effect = { country_event = { days = 1 id = dynamic_wp_config_mod.1 } }
			
	}
	
	
}



#####################################
####    OVERHAUL MODS SETTINGS   ####
#####################################


##Intro
country_event = {

	id = dynamic_wp_config_mod.1                
	title = dynamic_wp_config_mod.1.t   
	desc =  dynamic_wp_config_mod.1.d   
	picture = GFX_SWP_SETUP
	immediate = { log = "[GetDateText]: [Root.GetName]: dynamic_wp_config_mod.1" }

	fire_only_once = yes 
	is_triggered_only = yes 

	
	##Let me select
	option = {
		name = dynamic_wp_config_mod.1.a 
			hidden_effect = { country_event = { id = dynamic_wp_config_mod.2 } }
	}
	
	
	##I use vanilla!
	option = {
		name = dynamic_wp_config_mod.1.b   

	}	
	
}


##Millennium Dawn or Modern Day?
country_event = {

	id = dynamic_wp_config_mod.2               
	title = dynamic_wp_config_mod.2.t   
	desc =  dynamic_wp_config_mod.2.d   
	picture = GFX_SWP_SETUP
	immediate = { log = "[GetDateText]: [Root.GetName]: dynamic_wp_config_mod.2" }

	fire_only_once = yes 
	is_triggered_only = yes 

	
	##MD
	option = {
		name = dynamic_wp_config_mod.2.a 
			hidden_effect = { country_event = { id = dynamic_wp_config_mod.2 } }
	}
	
	
	#Modern Day 4
	option = {
		name = dynamic_wp_config_mod.2.b   

	}

	##Next Page ->
	option = {
		name = dynamic_wp_config_mod.2.c

			hidden_effect = { country_event = { id = dynamic_wp_config_mod.3 } }

	}	
	
}


##Millennium Dawn or Modern Day?
country_event = {

	id = dynamic_wp_config_mod.3                
	title = dynamic_wp_config_mod.3.t   
	desc =  dynamic_wp_config_mod.3.d   
	picture = GFX_SWP_SETUP
	immediate = { log = "[GetDateText]: [Root.GetName]: dynamic_wp_config_mod.3" }

	fire_only_once = yes 
	is_triggered_only = yes 

	
	##BICE
	option = {
		name = dynamic_wp_config_mod.3.a 
			hidden_effect = { country_event = { id = dynamic_wp_config_mod.2 } }
	}
	
	
	##KR
	option = {
		name = dynamic_wp_config_mod.3.b   

	}	
	
	##Abort.
	option = {
		name = dynamic_wp_config_mod.3.c   

	}	
	
}



######################################
##HIDDEN FLAG SETTING EVENTS##########
######################################

##CONFIG
##trigger event for "create country flag when player is at war"
country_event = {

    id = dw_flags.0
	immediate = { log = "[GetDateText]: [Root.GetName]: dw_flags.0" }
	
	hidden = yes
		
	trigger = {
		is_ai = no
		has_war = yes 		
		NOT = { has_country_flag = dw_player_war }		
	}
	
	mean_time_to_happen = { days = 2 }

	option = {	
		country_event = { days = 80 id = dw_flags.1 }	
	}
	
}


##create country flag when player is at war
country_event = {

    id = dw_flags.1
	immediate = { log = "[GetDateText]: [Root.GetName]: dw_flags.1" }

	hidden = yes
	is_triggered_only = yes
	
	option = {	
		set_country_flag = dw_player_war	
	}
	
}



##delete country flag when player is not at war anymore
country_event = {

    id = dw_flags.2  
	immediate = { log = "[GetDateText]: [Root.GetName]: dw_flags.2" }

	hidden = yes
		
	trigger = {
		is_ai = no
		has_war = no	
		has_country_flag = dw_player_war
	}
	
	mean_time_to_happen = {
		days = 2
	}
	
	#Delete flags
	option = { 
	
		if = {
			limit = {
				has_country_flag = dw_player_war
			}
			clr_country_flag = dw_player_war	
		}
		
		if = {
			limit = {
				has_country_flag = peace_declined
			}
			clr_country_flag = peace_declined	
		}
		
		if = {
			limit = {
				has_global_flag = peace_in_process
			}
			clr_global_flag = peace_in_process	
		}
	}			
}


#####HIDDEN FLAG SETTINGS FOR AI WAR WITH PLAYER######


##CONFIG
##create countryflag when AI is at war
country_event = {

    id = dw_flags.3 
	immediate = { log = "[GetDateText]: [Root.GetName]: dw_flags.3" }
	
	hidden = yes

	trigger = {

		is_ai = yes
		has_war = yes 
		any_enemy_country = {	
			is_ai = no	
		}
		
		NOT = { has_country_flag = dw_ai_war }
	
	}

	mean_time_to_happen = {	
	
	##modify for TEST
		#days = 2
		days = 60
	}
	
	option = {
	
		set_country_flag = dw_ai_war
	
	}		
}


##delete country flag; AI not longer at war!
country_event = {

    id = dw_flags.4  
	immediate = { log = "[GetDateText]: [Root.GetName]: dw_flags.4" }

	hidden = yes
		
	trigger = {

		is_ai = yes
		
		NOT = {
			any_enemy_country = {
				is_ai = no	
			}
		}
		has_country_flag = dw_ai_war
	}
	
	mean_time_to_happen = {
		days = 2
	}	
	
	#Delete flags
	option = { 
	
		if = {
			limit = {
				has_country_flag = dw_ai_war
			}
			clr_country_flag = dw_ai_war	
		}
		
		if = {
			limit = {
				has_country_flag = peace_declined
			}
			clr_country_flag = peace_declined	
		}
		
		if = {
			limit = {
				has_global_flag = peace_in_process
			}
			clr_global_flag = peace_in_process	
		}
	}			
}



##CONFIG
##delete peace_declined flag after a specific time (150 days), nation can ask again after 50 days
country_event = {

    id = dw_flags.7 
	immediate = { log = "[GetDateText]: [Root.GetName]: dw_flags.7" }
	
	hidden = yes
		
		
	is_triggered_only = yes	
	#trigger = {
	#	has_country_flag = peace_declined	
	#}
	
	#mean_time_to_happen = {	
	#	days = 150
	#	#days = 2
	#}
	
	
	option = {
	
		if = {
			limit = {
				has_country_flag = peace_declined		
			}
			clr_country_flag = peace_declined
		}	
	}			
}


##country event for nations IDEOLOGIES/LAWS
country_event = {

    id = dw_flags.8 
	immediate = { log = "[GetDateText]: [Root.GetName]: dw_flags.8" }
	
	hidden = yes
		
	trigger = {
		
		OR = {
			has_idea = partial_economic_mobilisation
			has_idea = war_economy
			has_idea = tot_economic_mobilisation
		}

		OR = {
		
			has_idea = limited_conscription 
			has_idea = extensive_conscription
			has_idea = service_by_requirement
			has_idea = all_adults_serve
			has_idea = scraping_the_barrel
		
		}
		NOT = { has_country_flag = swp_laws }
	}
	
	mean_time_to_happen = { days = 2 }

	option = {
		set_country_flag = swp_laws
		
	}
			
}

##disable the laws
country_event = {

    id = dw_flags.9
	immediate = { log = "[GetDateText]: [Root.GetName]: dw_flags.9" }
	
	hidden = yes
		
	trigger = {
	
		has_country_flag = swp_laws
		NOT = {
		
			OR = {
				has_idea = partial_economic_mobilisation
				has_idea = war_economy
				has_idea = tot_economic_mobilisation
			}

			OR = {

				has_idea = limited_conscription 
				has_idea = extensive_conscription
				has_idea = service_by_requirement
				has_idea = all_adults_serve
				has_idea = scraping_the_barrel
			
			}
			
		}	
			
	}
	
	mean_time_to_happen = { days = 2 }

	option = {	
			clr_country_flag = swp_laws
		}
}



##DELETE STATE FLAGS
country_event = {

    id = dw_flags.10
	immediate = { log = "[GetDateText]: [Root.GetName]: dw_flags.10" }

	hidden = yes
	is_triggered_only = yes

	
	#Delete state flags
	option = { 
	
		##remove state flags
		every_state = {
			limit = {
				has_state_flag = SWP_demanded
			}
			clr_state_flag = SWP_demanded
		
		}
	}

	
}	

##Add flag Truce over
country_event = {

    id = dw_flags.11                 
	immediate = { log = "[GetDateText]: [Root.GetName]: dw_flags.11" }
	
	hidden = yes
	is_triggered_only = yes

	
	option = { 
	
		if = {
			limit = {
				is_ai = no
			}
			
			set_country_flag = swp_truce_over
			#add_ideas = anti_german_military
		}
	}

	
}		
