add_namespace = qing
add_namespace = qing_reb

#qing.1-200		Succession, Assassination, Starting, General Information and Flavour Events
#qing.201-500	Political and War Events
#qing.501-700	Economy and Trade Events
#qing.701-999	Military Events

### New style id events 
country_event = { #Chinese Engineera and Mining Company
    id = qing.501
    title = qing.501.t
    desc = qing.501.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.501.a
    }
}

country_event = { #Kaiping Mines
    id = qing.502
    title = qing.502.t
    desc = qing.502.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.502.a
		add_tech_bonus = { bonus = 0.25 uses = 1 category = resource_extraction_tech }
		EOANBSYS_institutions_innovative_add_one = yes
		if = {
			limit = { owns_state = 603 }
				603 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
					type = coal_mine
					level = 1
					instant_build = yes
				}
			}
		}
		else = {
			random_owned_state = {
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = coal_mine
					level = 1
					instant_build = yes
				}
			}
		}
    }
}

country_event = { #Ping Hsiang Coal Mines
    id = qing.503
    title = qing.503.t
    desc = qing.503.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.503.a
		add_tech_bonus = { bonus = 0.25 uses = 1 category = resource_extraction_tech }
		EOANBSYS_institutions_innovative_add_one = yes
		if = {
			limit = { owns_state = 600 }
				600 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
					type = coal_mine
					level = 1
					instant_build = yes
				}
			}
		}
		else = {
			random_owned_state = {
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = coal_mine
					level = 1
					instant_build = yes
				}
			}
		}
    }
}

country_event = { #Keelung Coal Mines
    id = qing.504
    title = qing.504.t
    desc = qing.504.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.504.a
		add_tech_bonus = { bonus = 0.25 uses = 1 category = resource_extraction_tech }
		EOANBSYS_institutions_innovative_add_one = yes
		if = {
			limit = { owns_state = 600 }
				600 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
					type = coal_mine
					level = 1
					instant_build = yes
				}
			}
		}
		else = {
			random_owned_state = {
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = coal_mine
					level = 1
					instant_build = yes
				}
			}
		}
    }
}

country_event = { #Tayeh Ironmines
    id = qing.505
    title = qing.505.t
    desc = qing.505.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.505.a
		add_tech_bonus = { bonus = 0.25 uses = 1 category = resource_extraction_tech }
		EOANBSYS_institutions_innovative_add_one = yes
		if = {
			limit = { owns_state = 600 }
			600 = {
				add_extra_state_shared_building_slots = 1
				add_resource = {
					type = iron
					amount = 6
				}
			}
		}
		else = {
			random_owned_state = {
				add_extra_state_shared_building_slots = 1
				add_resource = {
					type = iron
					amount = 6
				}
			}
		}
    }
}
	
country_event = { #Mo Ho Gold Mining Company
    id = qing.506
    title = qing.506.t
    desc = qing.506.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.506.a
		add_timed_idea = {
			idea = QNG_gold_mining_company
			days = 720
		}
    }
}

###BOP

###Naval Events
country_event = { #The Guandong Fleet
    id = qing.701
    title = qing.701.t
    desc = qing.701.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.701.a

    }
}

country_event = { #The Fujian Fleet
    id = qing.702
    title = qing.702.t
    desc = qing.702.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.702.a

    }
}

country_event = { #The Nanyang Fleet
    id = qing.703
    title = qing.703.t
    desc = qing.703.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.703.a
		hidden_effect = {
			create_equipment_variant = {
				name = "Zhenbian Class"
				type = ship_hull_gunboat_2
				name_group = GER_GB_HISTORICAL
				parent_version = 0
				modules = {
					fixed_ship_battery_slot = ship_cannon_battery_1
					fixed_ship_fire_control_system_slot = fire_control_system_0
					fixed_ship_engine_slot = ship_engine_steam_screw_gunboat
					fixed_ship_secondaries_slot = empty
					fixed_ship_armor_slot = ship_armor_capital_hardwood_0
					mid_1_custom_slot = empty
					mid_2_custom_slot = empty
					rear_1_custom_slot = empty
				}
			}
			load_oob = QNG_nanyang
		}
    }
}

country_event = { #The Nanyang Fleet - Expansion
    id = qing.704
    title = qing.704.t
    desc = qing.704.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.704.a
		hidden_effect = {
			create_equipment_variant = {
				name = "Haian Class"
				type = ship_hull_frigate_1
				name_group = GER_GB_HISTORICAL
				parent_version = 0
				modules={
					fixed_ship_battery_slot=ship_cannon_battery_0
					fixed_ship_fire_control_system_slot=fire_control_system_0
					fixed_ship_engine_slot=ship_engine_paddle_cruiser
					mid_1_custom_slot=empty
					mid_2_custom_slot=empty
					fixed_ship_armor_slot=empty
				}
			}
			load_oob = QNG_nanyangexpansion
		}
    }
}

country_event = { #The Beyiang Fleet
    id = qing.705
    title = qing.705.t
    desc = qing.705.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.705.a
		hidden_effect = {
			create_equipment_variant = {
				name = "Zhenbian Class"
				type = ship_hull_gunboat_2
				name_group = GER_GB_HISTORICAL
				parent_version = 0
				modules = {
					fixed_ship_battery_slot = ship_cannon_battery_1
					fixed_ship_fire_control_system_slot = fire_control_system_0
					fixed_ship_engine_slot = ship_engine_steam_screw_gunboat
					fixed_ship_secondaries_slot = empty
					fixed_ship_armor_slot = ship_armor_capital_hardwood_0
					mid_1_custom_slot = empty
					mid_2_custom_slot = empty
					rear_1_custom_slot = empty
				}
			}
			load_oob = QNG_beiyang
		}
    }
}

country_event = { #The Beyiang Fleet - Expansion
    id = qing.706
    title = qing.706.t
    desc = qing.706.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.706.a
		hidden_effect = {
			load_oob = QNG_gunboats1_BEI
		}
    }
}

country_event = { #Imperial maritime Customs Service 
	id = qing.707
	title = qing.707.t
	desc = qing.707.d 
	
	#picture = 
	is_triggered_only = yes
	
	fire_only_once = yes
	option = { #WOW!!!!!!
		name = qing.707.a 
		add_ideas = QNG_imperial_maritime_custom_service_idea
	}
}
country_event = { #China Merchants Steam Navigation Company
	id = qing.708
	title = qing.708.t
	desc = qing.708.d 
	
	#picture = 
	is_triggered_only = yes
	fire_only_once = yes
	
	option = { #WOW!!!!!!
		name = qing.708.a 
		add_ideas = QNG_merchant_steam_navigation_company_idea
	}
}
country_event = { #Imperial Chinese Telegraph Administration
	id = qing.709
	title = qing.709.t
	desc = qing.709.d 
	
	#picture = 
	is_triggered_only = yes
	
	fire_only_once = yes
	option = { #WOW!!!!!!
		name = qing.709.a 
		add_ideas = QNG_imperial_chinese_telegraph_administration_idea
	}
}

country_event = { #Qing request tribute events 
    id = qing.710
    title = qing.710.t
    desc = qing.710.d

    is_triggered_only = yes

    option = {
        name = qing.710.a
		custom_effect_tooltip = tributary_gives_pp_tt
		set_global_flag = QNG_requests_for_pp_flag
		hidden_effect = {
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				country_Event = qing.711
			} 
		}
    }
	option = {
        name = qing.710.b
		custom_effect_tooltip = tributary_gives_mp_tt
		set_global_flag = QNG_requests_for_mp_flag
		hidden_effect = {
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				country_Event = qing.711
			} 
		}
    }
	option = {
        name = qing.710.c
		custom_effect_tooltip = tributary_gives_stab_tt
		set_global_flag = QNG_requests_for_stab_flag
		hidden_effect = {
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				country_Event = qing.711
			} 
		}
    }
}

country_event = { #tribute countries receives request for tribute
    id = qing.711
    title = qing.711.t
    desc = qing.711.d

    is_triggered_only = yes

    option = {
        name = qing.711.a #Yes
		ai_chance = {
			base = 100
		}
		if = {
			limit = {
				has_global_flag = QNG_requests_for_pp_flag
			}
			QNG = {add_political_power = 50}
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				add_political_power = -50 
				clr_country_flag = tribute_payment_in_process
			}  
			clr_global_flag = QNG_requests_for_pp_flag
		
			else_if = {
				limit = {
					has_global_flag = QNG_requests_for_mp_flag
				}
				QNG = {add_manpower = 1000 }
				every_country = {
					limit = {
						has_country_flag = tribute_payment_in_process
					}
					add_manpower = -1000
					clr_country_flag = tribute_payment_in_process
				}
				clr_global_flag = QNG_requests_for_mp_flag  
			}
			else_if = {
				limit = {
					has_global_flag = QNG_requests_for_stab_flag
				}
				QNG =  {add_stability = 0.01 }
				every_country = {
					limit = {
						has_country_flag = tribute_payment_in_process
					}
					add_stability = -0.01
					clr_country_flag = tribute_payment_in_process
				}
				clr_global_flag = QNG_requests_for_stab_flag  
			}
		}
		
    }
	option = {
        name = qing.711.b #No
		ai_chance = { base = -100 }
		add_political_power = 25
		QNG = {
			country_Event = qing.712
		}
    }
	option = {
        name = qing.711.c #Im ending the tribute payment 
		add_stability = 0.01
		ai_chance = { base = -100 }
		QNG = {
			country_Event = qing.713
		}
		clr_global_flag = QNG_requests_for_pp_flag
		clr_global_flag = QNG_requests_for_mp_flag
		clr_global_flag = QNG_requests_for_stab_flag
    }
}

country_event = { #denied request from tribute country 
    id = qing.712
    title = qing.712.t
    desc = qing.712.d

    is_triggered_only = yes

    option = {
        name = qing.712.a #Dont escalate
		add_political_power = -50
		hidden_effect = {
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				clr_country_flag = tribute_payment_in_process
			}
		} 
    }
	option = {
        name = qing.712.b #Escalate it
		FROM = {
			country_Event = qing.714
		}
    }
}

country_event = { #tributary backed out  
    id = qing.713
    title = qing.713.t
    desc = qing.713.d

    is_triggered_only = yes

    option = {
        name = qing.713.a #ok
		add_political_power = -50
		hidden_effect = {
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				clr_country_flag = tribute_payment_in_process
			}
		} 
		 
    }
	option = {
        name = qing.713.b #Cancel diplomatic ties!
		FROM = {
			country_Event = qing.716
		}
    }
}

country_event = { #diplomatic incident between qing and tribute country
    id = qing.714
    title = qing.714.t
    desc = qing.714.d

    is_triggered_only = yes

    option = {
        name = qing.714.a #damn 
		add_political_power = -50
		hidden_effect = {
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				clr_country_flag = tribute_payment_in_process
			}
		}
    }
	option = {
        name = qing.714.b #pay tribute 
		QNG = {
			country_Event = qing.717
		}
		if = {
			limit = {
				has_global_flag = QNG_requests_for_pp_flag
			}
			QNG = {add_political_power = 50}
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				add_political_power = -50 
				clr_country_flag = tribute_payment_in_process
			}  
			clr_global_flag = QNG_requests_for_pp_flag
		
			else_if = {
				limit = {
					has_global_flag = QNG_requests_for_mp_flag
				}
				QNG = {add_manpower = 1000 }
				every_country = {
					limit = {
						has_country_flag = tribute_payment_in_process
					}
					add_manpower = -1000
					clr_country_flag = tribute_payment_in_process
				}
				clr_global_flag = QNG_requests_for_mp_flag  
			}
			else_if = {
				limit = {
					has_global_flag = QNG_requests_for_stab_flag
				}
				QNG =  {add_stability = 0.01 }
				every_country = {
					limit = {
						has_country_flag = tribute_payment_in_process
					}
					add_stability = -0.01
					clr_country_flag = tribute_payment_in_process
				}
				clr_global_flag = QNG_requests_for_stab_flag  
			}
		}
		hidden_effect = {
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				clr_country_flag = tribute_payment_in_process
			}
		} 
    }
	option = {
        name = qing.714.c #end tribute payment 
		QNG = {
			country_Event = qing.713
		}
    }
}

country_event = { #tributary restored
    id = qing.715
    title = qing.15.t
    desc = qing.715.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.715.a #good 
		add_political_power = 50
		hidden_effect = {
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				clr_country_flag = tribute_payment_in_process
			}
		} 
    }
	option = {
        name = qing.715.b #punish them for trying to stop tribute payment! 
		FROM = {
			add_political_power = -100
		}
		hidden_effect = {
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				clr_country_flag = tribute_payment_in_process
			}
		} 
    }
}

country_event = { #diplomatic ties end 
    id = qing.716
    title = qing.716.t
    desc = qing.716.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.716.a #ok
		add_political_power = -50
		hidden_effect = {
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				clr_country_flag = tribute_payment_in_process
			}
		} 
    }
}

country_event = { #tributary backs down from refusal 
    id = qing.717
    title = qing.717.t
    desc = qing.717.d

    is_triggered_only = yes
    fire_only_once = yes

    option = {
        name = qing.717.a #good 
		 if = {
			limit = {
				has_global_flag = QNG_requests_for_pp_flag
			}
			QNG = {add_political_power = 50}
			every_country = {
				limit = {
					has_country_flag = tribute_payment_in_process
				}
				add_political_power = -50 
				clr_country_flag = tribute_payment_in_process
			}  
			clr_global_flag = QNG_requests_for_pp_flag
		
			else_if = {
				limit = {
					has_global_flag = QNG_requests_for_mp_flag
				}
				QNG = {add_manpower = 1000 }
				every_country = {
					limit = {
						has_country_flag = tribute_payment_in_process
					}
					add_manpower = -1000
					clr_country_flag = tribute_payment_in_process
				}
				clr_global_flag = QNG_requests_for_mp_flag  
			}
			else_if = {
				limit = {
					has_global_flag = QNG_requests_for_stab_flag
				}
				QNG =  {add_stability = 0.01 }
				every_country = {
					limit = {
						has_country_flag = tribute_payment_in_process
					}
					add_stability = -0.01
					clr_country_flag = tribute_payment_in_process
				}
				clr_global_flag = QNG_requests_for_stab_flag  
			}
		}
    }
}


### Old style id events
country_event = { #Mudan Incident (Japanese in Taiwan)
    id = qing.1
    title = qing.1.t
    desc = qing.1.d

#    picture = GFX_report_event_election_vote

    is_triggered_only = yes

    fire_only_once = yes

    option = { #oh shit we gotta act FAST
        name = qing.1.a
    }
}

country_event = { #Getting some Ironclads from the West
    id = qing.2
    title = qing.2.t
    desc = qing.2.d

#    picture = GFX_report_event_election_vote

    is_triggered_only = yes

    fire_only_once = yes

    option = { #america
        name = qing.2.a
    }
    option = { #prussia
        name = qing.2.b
    }
    option = { #france
        name = qing.2.c
    }
    option = { #britain
        name = qing.2.h
    }
}

country_event = { #Qing Flag Change
    id = qing.3
    title = qing.3.t
    desc = qing.3.d
    
    is_triggered_only = yes 
    fire_only_once = yes 

    option = {
        name = qing.3.a
        
        hidden_effect = { 
        set_cosmetic_tag = QNG1
        }
        
      custom_effect_tooltip = qing.3   
    }
    
}

country_event = { #Lee Teng-Fan Residence 
    id = qing.4
    title = qing.4.t
    desc = qing.4.d

    is_triggered_only= yes
	fire_only_once = yes

    option = {
        name = qing.4.a
        add_political_power = 5
		set_temp_variable = { eoanb_prestige_change = 1 }
		eoanb_change_prestige_score = yes
    }
}

country_event = { #Qing self strengthing movement
    id = qing.5
    title = qing.5.t
    desc = qing.5.d
    
    fire_only_once = yes 
    
    is_triggered_only = yes 

    immediate = {
		if={
			limit={
				QNG = {
					has_idea = CHI_idea_tianjin_treaty
				}
				OR = {
					QNG = {
						has_idea = CHI_idea_bejing_convention
					}
				}
			}
			#hidden_effect = { 
			#	country_event = {id = qing.6 days = 224}
			#}
		}
	}
	
	
    option = {
        name = qing.5.a
		set_country_flag = QNG_self_strengthening_movement_flag
		mark_focus_tree_layout_dirty = yes
		set_country_flag = QNG_diplomatic_flag
    }
    
}

news_event = { #Death of Xianfang
    id = qing.6
    title = qing.6.t
    desc = qing.6.d

	is_triggered_only = yes
	
	major = yes
	
	immediate = {
		hidden_effect = {
			if = {
				limit = {
					tag = QNG
				}
				QNG = {
					if = {
						limit = {
							has_country_flag = xianfeng_universal_prosperity_flag
							has_country_leader = {
								character = QNG_Xianfeng_Emperor
								ruling_only = yes
							}
						}
						QNG_Tongzhi_Emperor = {
							promote_leader = yes
							add_country_leader_role = {
								country_leader =  {
									ideology = absolutism
									expire = "1911.1.1"
								}
							}
						}
					}
					else = {
						QNG_Tongzhi_Emperor = {
							promote_leader = yes
							add_country_leader_role = {
								country_leader =  {
									ideology = absolutism
									expire = "1911.1.1"
								}
							}
							promote_character = yes
							promote_character = absolutism
						}
					}
					retire_character = QNG_Xianfeng_Emperor
					#country_event = { id = qing.202 days = 12 }
				}
			}
		}
	}

    option = {
        name = qing.6.a
		if = {
			limit = {
				tag = QNG
			}
			QNG = {
				clr_country_flag = xianfeng_universal_prosperity_flag
				set_country_flag = QNG_xianfeng_dies_flag
				mark_focus_tree_layout_dirty = yes
			}
		}
    }
}

news_event = { #Xinyou Coup
    id = qing.7
    title = qing.7.t
    desc = qing.7.d

	is_triggered_only = yes
	
	immediate={
		hidden_effect={
			QNG={
				if={
					limit={
						has_country_flag =  QNG_prince_gong1_flag
					}
					country_event = {id = qing.207 days = 1}
					clr_country_flag = QNG_xianfeng_dies_flag
					set_country_flag = QNG_Cixi_1_flag
				}

				else={#backup to refire event if cixi is not made ruler
					remove_country_leader_role = {
					  character = QNG_great_regency_council
					  ideology = absolutism
					}
					complete_national_focus = QNG_focus_hold_funeral_from_chengde_beijing
					clr_country_flag = QNG_xianfeng_dies_flag
					set_country_flag = QNG_Cixi_1_flag
					mark_focus_tree_layout_dirty = yes
					activate_advisor = QNG_cixi 
					
				}
				hidden_effect={
					swap_ideas ={ 
						add_idea = QNG_sushans_party_remnants
						remove_idea = QNG_sushans_party
					}
					swap_ideas ={ 
						add_idea = QNG_rengency_council_tongzhi_shattered
						remove_idea = QNG_rengency_council_tongzhi
					}
				}
			}
		}
	}

    option = {
        name = qing.7.a
    }
}

country_event = { #meeting with gong
    id = qing.8
    title = qing.8.t
    desc = qing.8.d
    
    fire_only_once = yes 
	is_triggered_only = yes
    
    option = {#gong agrees
        name = qing.8.a
        country_event = {id = qing.7 hours = 5}
		ai_chance={
			factor = 100
		}
    }
	option = {#gong disagrees
        name = qing.8.b
        country_event = {id = qing.9 hours = 5}
		ai_chance={
			factor = 0
		}
    }
    
}

country_event = { #meeting with gong refused, plot is reveled
    id = qing.9
    title = qing.9.t
    desc = qing.9.d
    
    fire_only_once = yes 
	is_triggered_only = yes
    
    option = {#agree
        name = qing.9.a
		if={
			limit={
				has_country_flag = QNG_xianjing_transition_tree
			}
			clr_country_flag = QNG_xianjing_transition_tree
			set_country_flag = QNG_eight_council_rebuilds_tree
			mark_focus_tree_layout_dirty = yes
			hidden_effect={
				add_ideas={
					QNG_burecratic_issues
					QNG_empresses_support
				}
			}
		}
    }
    
}

country_event = { #New Standard Army
    id = qing.10
    title = qing.10.t
    desc = qing.10.d
    
    fire_only_once = yes 
	is_triggered_only = yes
    
    option = {#ok
        name = qing.10.a
		delete_unit_template_and_units = {
			division_template = "Green Standard Army"
			disband = no #will refund equipment and manpower
		}
		delete_unit_template_and_units = {
			division_template = "Chinese Infantry"
			disband = yes #will refund equipment and manpower
		}
		load_oob=QNG_new_green_army
    }
    
}

country_event = { #creation of the local armies
	id = qing.11
	title = qing.11.t
	desc = qing.11.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#perfect
		name = qing.11.a
		add_stability = 0.1
		set_country_flag = QNG_warlord_armys_unlocked #this policy directly leads into the warlord era
		custom_effect_tooltip = QNG_vic_local_army_supress_revolts
	}
}

country_event = { #
	id = qing.12
	title = qing.12.t
	desc = qing.12.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#perfect
		name = qing.12.a
		if = {
			limit = {
				has_country_flag = QNG_eight_council_rebuilds_tree
			}
			clr_country_flag = QNG_eight_council_rebuilds_tree
			set_country_flag = QNG_eight_council_stands_strong
			mark_focus_tree_layout_dirty = yes
		}
	}
}

country_event = { #death of tongzhi
	id = qing.13
	title = qing.13.t
	desc = qing.13.d

	fire_only_once = yes
	is_triggered_only = yes
	major = yes
	
	immediate={
		if={
			limit={QNG_Tongzhi_Emperor = {is_country_leader = yes}
			}
			hidden_effect={
				retire_character = QNG_Tongzhi_Emperor
				QNG_Cixi_Empress={
					add_country_leader_role = {
							Promote_leader = yes
							Country_leader = {
								ideology = absolutism
								expire = "1908.1.1.1"
								traits = {
									
								}
							}
						}
					promote_character = {
						Ideology = absolutism
					}
					promote_character = yes
				}
			}
		}
	}
	
	option = {#
		name = qing.13.a
		trigger = { tag = QNG } 
		clr_country_flag = QNG_tongzhi_ruling_tree
		set_country_flag = QNG_guangxu_rengency_tree
		#load_focus_tree = qing_guangxu #doesn't exist
	}
}

country_event = { #leveied charges
	id = qing.14
	title = qing.14.t
	desc = qing.14.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#perfect
			name = qing.14.a
		set_country_flag = QNG_cixi_domininate
	}
}
country_event = { #final move
    id = qing.15
    title = qing.15.t
    desc = qing.15.d
    
    fire_only_once = yes 
	is_triggered_only = yes

	option = {#perfect
		name = qing.15.a
		set_country_flag = QNG_gong_domininate
	}
}
country_event = { #famine outbreak
	id = qing.16
	title = qing.16.t
	desc = qing.16.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#damn
		name = qing.16.a
		add_ideas = {QNG_mac_northern_famine}
		607={add_dynamic_modifier = { modifier = terrible_famine }}
		598={add_dynamic_modifier = { modifier = terrible_famine }}
		597={add_dynamic_modifier = { modifier = terrible_famine }}
		615={add_dynamic_modifier = { modifier = terrible_famine }}
		#southern hebei
		614={add_dynamic_modifier = { modifier = terrible_famine }}
		1151={add_dynamic_modifier = { modifier = terrible_famine }}
	}
}
country_event = { #big swords society
	id = qing.17
	title = qing.17.t
	desc = qing.17.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#ok
		name = qing.17.a
		set_country_flag = QNG_boxer_reb_active
	}
}
country_event = { #results of the treatment
	id = qing.18
	title = qing.18.t
	desc = qing.18.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#ok
		name = qing.18.a
		set_country_flag = QNG_rengent_cured
	}
}
#rail development
country_event = { #the suzhou proposal
	id = qing.19
	title = qing.19.t
	desc = qing.19.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#ok
		name = qing.19.a
		set_country_flag = QNG_suzhou_rail
	}
}
country_event = { #the hankou proposal
	id = qing.20
	title = qing.20.t
	desc = qing.20.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#ok
		name = qing.20.a
		set_country_flag = QNG_hankou_rail
	}
}
country_event = { #the wuhao proposal
	id = qing.21
	title = qing.21.t
	desc = qing.21.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#ok
		name = qing.21.a
		set_country_flag = QNG_wuhao_rail
	}
}

country_event = { #Pavilion of purple light
	id = qing.22
	title = qing.22.t
	desc = qing.22.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#ok
		name = qing.22.a
		add_political_power = 100
	}
}

country_event = { #
	id = qing.23
	title = qing.23.t
	desc = qing.23.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#ok
		name = qing.23.a
		if={
			limit={
				has_idea = QNG_empresses_support_2
			}
			swap_ideas={
				remove_idea = QNG_empresses_support_2
				add_idea = QNG_empresses_support_3
			}
		}
		else={
			swap_ideas={
				remove_idea = QNG_empresses_support_3
				add_idea = QNG_empresses_support_4
			}
		}
	}
}
country_event = { #
	id = qing.24
	title = qing.24.t
	desc = qing.24.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#ok
		name = qing.24.a
		if={
			limit={
				has_idea = QNG_empresses_support_2
			}
			swap_ideas={
				remove_idea = QNG_empresses_support_2
				add_idea = QNG_empresses_support_3
			}
		}
		else={
			swap_ideas={
				remove_idea = QNG_empresses_support_3
				add_idea = QNG_empresses_support_4
			}
		}
	}
}

country_event = { #Ending the tongzhi rengency
	id = qing.25
	title = qing.25.t
	desc = qing.25.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#ok
		name = qing.25.a
		hidden_effect={
			if={
				limit={
					has_country_flag = QNG_tongzhi_sushsan_tree
				}
				clr_country_flag = QNG_tongzhi_sushsan_tree
				remove_ideas = {QNG_empresses_support_4 QNG_sushans_party_3 QNG_rengency_council_tongzhi}
				remove_country_leader_role = {
					character = QNG_great_regency_council
					ideology = absolutism
				}
			}
			else={
				clr_country_flag = QNG_tongzhi_restoration_tree
				remove_country_leader_role = {
					character = QNG_Cixi_Empress
					ideology = absolutism
				}
			}
			set_country_flag = QNG_tongzhi_ruling_tree
			mark_focus_tree_layout_dirty = yes
			QNG_Tongzhi_Emperor = {
				add_country_leader_role = {
					Promote_leader = yes
					Country_leader = {
						ideology = absolutism
						expire = "1908.1.1.1"
						traits = {
								
						}
					}
				}
				promote_character = {
					Ideology = absolutism
				}
				promote_character = yes
			}
		}
	}
}

country_event = { #Ending the Guangxu rengency
	id = qing.26
	title = qing.26.t
	desc = qing.26.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#ok
		name = qing.26.a
		hidden_effect={
			remove_country_leader_role = {
				character = QNG_Cixi_Empress
				ideology = absolutism
			}
			clr_country_flag = QNG_guangxu_rengency_tree
			set_country_flag = QNG_guangxu_ruling_tree
			mark_focus_tree_layout_dirty = yes
			
			QNG_Guangxu_Emperor = {
				add_country_leader_role = {
					Promote_leader = yes
					Country_leader = {
						ideology = absolutism
						expire = "1908.1.1.1"
						traits = {
								
						}
					}
				}
				promote_character = {
					Ideology = absolutism
				}
				promote_character = yes
			}
		}
	}
}


country_event = { #The Beiyang Army
	id = qing.27
	title = qing.27.t
	desc = qing.27.d

	fire_only_once = yes
	is_triggered_only = yes

	option = {#ok
		name = qing.27.a
	}
}

country_event = { #Li Hongzhang proposal
	id = qing.28
	title = qing.28.t
	desc = qing.28.d
	fire_only_once = yes
	is_triggered_only = yes

	option = {#ok
		name = qing.28.a
	}
	option = {# nuh uh
		name = qing.28.b
	}
	
}

country_event = { #The crumbling empire 
	id = qing.29
	title = qing.29.t
	desc = qing.29.d 
	

	fire_only_once = yes
	is_triggered_only = yes 
	
	option = { #damn
		name = qing.29.a 
		complete_national_focus = QNG_focus_xianfeng_unlucky_reign
	}
}

country_event = { #Universal Prosperity
	id = qing.39
	title = qing.39.t
	desc = qing.39.d 
	
	fire_only_once = yes
	is_triggered_only = yes 
	
	option = { #damn
		name = qing.39.a 
		add_stability = 0.1
	}
}

country_event = { #Zeng Guofan 10 June 
	id = qing.30
	title = qing.30.t
	desc = qing.30.d 

	picture = GFX_report_event_zeng_guofan
	
	fire_only_once = yes 
	trigger = {
		tag = QNG
		date > 1857.6.1
	}
	immediate = {
		country_event = {id = qing.33 days = 200}
		country_Event = {id = qing.5 days = 1307}
	}
	
	option = { #damn 
		name = qing.30.a 
		add_political_power = -50
	}
}

country_event = { #capture of Nanking
	id = qing.31
	title = qing.31.t
	desc = qing.31.d
	fire_only_once = yes
	trigger = {
	controls_state = 1056
	tag = QNG
	}
	option = {# excellent
		name = qing.31.a
		set_province_name = { id = 11913 name = "Nanjing" }
		add_political_power = 25
	}
	
}

country_event = { #First Battle of Canton summary
	id = qing.32
	title = qing.32.t
	desc = qing.32.d 

	is_triggered_only = yes
	
	fire_only_once = yes
	trigger = { 
		tag = QNG
		always = yes
   }
	
	option = { #damn
		name = qing.32.a 
		add_war_support = 0.15
	}
}

country_event = { #Wuwu Examination Case 
	id = qing.33
	title = qing.33.t
	desc = qing.33.d 

	is_triggered_only = yes
	
	fire_only_once = yes
	trigger = { 
		tag = QNG
		always = yes
   }
	
	option = { #damn
		name = qing.33.a 
		add_stability = 0.05
	}
}

country_event = { #White hao army revolt
    id = qing_reb.1
    title = qing_reb.1.t
    desc = qing_reb.1.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		TAG = QNG
		date > 1858.1.18
		date < 1870.1.1
		has_country_flag = true_china
		has_idea = QNG_idea_han_nationalism
	}

    fire_only_once = yes
	immediate={
		hidden_effect={
			if={
				limit = {
					SIC = {
						exists = yes
						
					}
				}
				SIC={
					set_province_controller = 9939
					set_province_controller = 1474
					load_oob = "SIC_White_Hao"
				}
			}
			else={
				SIC={
					set_state_owner = 603
					set_cosmetic_tag = SIC_WH
					set_province_controller = 9939
					set_province_controller = 1474
					load_oob = "SIC_White_Hao"
					declare_war_on = {
						target = QNG
						type = annex_everything
					}
					set_country_flag = rebel_uprisisng
				}
			}
		}
	}
    option = { #More of them
        name = qing_reb.1.a
		trigger={tag = QNG}
    }
}

country_event = { #Shuntian revolt
    id = qing_reb.2
    title = qing_reb.2.t
    desc = qing_reb.2.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		TAG = QNG
		date > 1859.1.18
		date < 1870.1.1
		has_country_flag = true_china
		has_idea = QNG_idea_han_nationalism
	}

    fire_only_once = yes
	immediate={
		hidden_effect={
			SHU={
				set_state_owner = 605
				add_state_core = 605
				set_province_controller = 1395
				set_province_controller = 12705
				set_province_controller = 11972
				set_province_controller = 12819
				load_oob = "SHU_1859"
				declare_war_on = {
					target = QNG
					type = annex_everything
				}
				set_country_flag = rebel_uprisisng
			}
		}
	}
    option = { #even More of them
        name = qing_reb.2.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.2.b
		trigger={NOT={tag = QNG}}
		QNG={white_peace = SHU}
		SHU={
			set_cosmetic_tag = SHU_shuntain_clique
			load_focus_tree = CHI_warlords_1872	
			remove_ideas = {QNG_rebel_uprising}
			add_ideas = {CHI_rebel_administration}
			if={
				limit={
					ROOT={owns_state=973}
				}
				transfer_state = 973
				add_state_core = 973		
			}
			if={
				limit={
					ROOT={owns_state=601}
				}
				transfer_state = 601
				add_state_core = 601		
			}
		}
	}
}
country_event = { #Tianshun revolt
    id = qing_reb.3
    title = qing_reb.3.t
    desc = qing_reb.3.d

 	#picture = GFX_report_event_election_vote

    trigger = {
		TAG = QNG
		date > 1861.2.10
		date < 1870.1.1
		has_country_flag = true_china
		has_idea = QNG_idea_han_nationalism
	}

    fire_only_once = yes
	immediate={
		hidden_effect={
			ANH={
				set_state_owner = 606
				add_state_core = 606
				set_province_controller = 7094
				load_oob = "ANH_1861"
				declare_war_on = {
					target = QNG
					type = annex_everything
				}
				set_country_flag = rebel_uprisisng
			}
		}
	}
    option = { #even More of them
        name = qing_reb.3.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.3.b
		trigger={NOT={tag = QNG}}
		QNG={white_peace = ANH}
		ANH={
			load_focus_tree = CHI_warlords_1872
			remove_ideas = {QNG_rebel_uprising}
			add_ideas = {CHI_rebel_administration}
		}
	}
}
country_event = { #Tianshun 2nd revolt
    id = qing_reb.4
    title = qing_reb.4.t
    desc = qing_reb.4.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		TAG = QNG
		date > 1861.10.1
		date < 1870.1.1
		has_country_flag = true_china
		has_idea = QNG_idea_han_nationalism
	}

    fire_only_once = yes
	immediate={
		hidden_effect={
			if={
				limit = {
					ANH = {
						exists = yes
					}
				}
				ANH={
					set_province_controller = 12036
					set_province_controller = 11916
					load_oob = "ANH_2reb"
				}
			}
			else={
				ANH={
					set_state_owner = 606
					add_state_core = 606
					set_province_controller = 12036
					set_province_controller = 11916
					load_oob = "ANH_2reb"
					declare_war_on = {
						target = QNG
						type = annex_everything
					}
					set_country_flag = rebel_uprisisng
				}
				
			}
		}
	}
    option = { #even More of them
        name = qing_reb.4.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.4.b
		trigger={NOT={tag = QNG}}
		QNG={white_peace = ANH}
		ANH={
			load_focus_tree = CHI_warlords_1872
			remove_ideas = {QNG_rebel_uprising}
			add_ideas = {CHI_rebel_administration}
		}
	}
}
country_event = { #Tianshun 3rd revolt
    id = qing_reb.5
    title = qing_reb.5.t
    desc = qing_reb.5.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		TAG = QNG
		date > 1863.5.1
		date < 1870.1.1
		has_country_flag = true_china
		has_idea = QNG_idea_han_nationalism
	}

    fire_only_once = yes
	immediate={
		hidden_effect={
			if={
				limit = {
					ANH = {
						exists = yes
					}
				}
				ANH={
					set_province_controller = 10040
					set_province_controller = 4079
					set_province_controller = 12036
					set_province_controller = 11916
					load_oob = "ANH_1863"
				}
			}
			else={
				ANH={
					set_state_owner = 606
					add_state_core = 606
					set_province_controller = 10040
					set_province_controller = 4079
					set_province_controller = 12036
					set_province_controller = 11916
					load_oob = "ANH_1863"
					declare_war_on = {
						target = QNG
						type = annex_everything
					}
					set_country_flag = rebel_uprisisng
				}
			}
		}
	}
    option = { #even More of them
        name = qing_reb.5.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.5.b
		trigger={NOT={tag = QNG}}
		QNG={white_peace = ANH}
		ANH={
			load_focus_tree = CHI_warlords_1872
			remove_ideas = {QNG_rebel_uprising}
			add_ideas = {CHI_rebel_administration}
		}
	}
}

country_event = { #Taiping loses nanjing
    id = qing_reb.6
    title = qing_reb.6.t
    desc = qing_reb.6.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		tag = TAI
		1056={
			is_controlled_by = QNG
		}
	}

    fire_only_once = yes
	immediate={
		kill_country_leader = yes
		TAI_Hong_Tianguifu={
			add_country_leader_role = {
				Promote_leader = yes
				Country_leader = {
					ideology = other_ideology
					expire = "1891.12.31.1"
					traits = {
						inexperienced_monarch
					}
				 }
			}
			promote_character = yes
		}
	}
    option = { #
        name = qing_reb.6.a
		swap_ideas={
			remove_idea = QNG_rebel_uprising
			add_idea = QNG_rebel_uprising_2
		}
    }
}

country_event = { #Pugunhui revolt
    id = qing_reb.7
    title = qing_reb.7.t
    desc = qing_reb.7.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		TAG = QNG
		date > 1862.4.18
		date < 1865.1.1
		has_country_flag = true_china
		has_idea = QNG_idea_han_nationalism
	}

    fire_only_once = yes
	immediate={
		hidden_effect={
			TAW={
				set_state_owner = 524
				add_state_core = 524
				load_oob = "TAW_1862"
				declare_war_on = {
					target = QNG
					type = annex_everything
				}
				set_province_controller = 7214
				set_province_controller = 11959
				set_province_controller = 1091
				set_province_controller = 12068
				set_country_flag = rebel_uprisisng
			}
		}
	}
    option = { #even More of them
        name = qing_reb.7.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.7.b
		trigger={NOT={tag = QNG}}
		QNG={white_peace = TAW}
		if={
			limit={GXC={exists = yes}}
			GXC={puppet = TAW}
		}
		TAW = {
			remove_ideas = {QNG_rebel_uprising}
			add_ideas = {CHI_rebel_administration}
		}
	}
}

country_event = { #Bai Linga revolt
    id = qing_reb.8
    title = qing_reb.8.t
    desc = qing_reb.8.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		TAG = QNG
		date > 1861.3.1
		date < 1865.1.1
		has_country_flag = true_china
		has_idea = QNG_idea_han_nationalism
	}

    fire_only_once = yes
	immediate={
		hidden_effect={
			FEG={
				set_state_owner = 610
				add_state_core = 610
				load_oob = "FEG_1861"
				declare_war_on = {
					target = QNG
					type = annex_everything
				}
				set_province_controller = 934
				set_province_controller = 3934
				set_province_controller = 6898
				set_province_controller = 11855
				set_province_controller = 3881
				set_province_controller = 7633
				set_province_controller = 972
				set_country_flag = rebel_uprisisng
			}
		}
	}
    option = { #even More of them
        name = qing_reb.8.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.12.b
		trigger={NOT={tag = QNG}}
		QNG={white_peace = FEG}
		FEG={
			set_cosmetic_tag = FEG_bai_linga_clique
			load_focus_tree = CHI_warlords_1872	
			remove_ideas={QNG_rebel_uprising}
			add_ideas = {CHI_rebel_administration}
			transfer_state = 611
			add_state_core = 611
			transfer_state = 609
			add_state_core = 609
		}
	}
}

country_event = { #Ma 1st revolt
    id = qing_reb.9
    title = qing_reb.9.t
    desc = qing_reb.9.d

    #picture = GFX_report_event_election_vote

    trigger = {
  	#	TAG = QNG
  	#	date > 1862.1.1
  	#	date < 1865.1.1
  		has_country_flag = true_china
  	}

	  #mean_time_to_happen = { days = 20 }
    is_triggered_only = yes
    
    
	immediate={
		hidden_effect={
			XSM={
				set_state_owner = 604
				add_state_core = 604
				set_province_controller = 4888
				load_oob = "XSM_zhanao"
				declare_war_on = {
					target = QNG
					type = annex_everything
				}
				set_country_flag = rebel_uprisisng
			}
		}
	}
    option = { #even More of them
        name = qing_reb.9.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.9.b
		trigger={NOT={tag = QNG}}
		QNG={white_peace = XSM}
		XSM={
			set_cosmetic_tag = XSM_early_ma_clique #just the flag
			load_focus_tree = CHI_warlords_1872	
			remove_ideas={QNG_rebel_uprising}
			add_ideas = {CHI_rebel_administration}
			transfer_state = 604
			transfer_state = 1255
			add_state_core = 1255
			transfer_state = 616
			add_state_core = 616
			transfer_state = 1256
			add_state_core = 1256
		}
	}
}
country_event = { #Ma 2nd* revolt
    id = qing_reb.10
    title = qing_reb.10.t
    desc = qing_reb.10.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		#TAG = QNG
		#date > 1862.3.1
		#date < 1865.1.1
		has_country_flag = true_china
	}

	  #mean_time_to_happen = { days = 60 }
    is_triggered_only = yes
	immediate={
		hidden_effect={
			if={
				limit = {
					XSM = {
						exists = yes
					}
				}
				XSM={
					set_province_controller = 10854
					set_province_controller = 8081
					add_state_core = 1256
					load_oob = "XSM_hualong"
				}
			}
			else={
				XSM={
					set_state_owner = 1256
					add_state_core = 1256
					set_province_controller = 10854
					set_province_controller = 8081
					load_oob = "XSM_hualong"
					declare_war_on = {
						target = QNG
						type = annex_everything
					}
					set_country_flag = rebel_uprisisng
				}
			}
		}
	}
    option = { #even More of them
        name = qing_reb.10.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.10.b
		trigger={NOT={tag = QNG}}
		QNG={white_peace = XSM}
		XSM={
			set_cosmetic_tag = XSM_early_ma_clique #just the flag
			load_focus_tree = CHI_warlords_1872	
			remove_ideas={QNG_rebel_uprising}
			add_ideas = {CHI_rebel_administration}
			transfer_state = 604
			transfer_state = 1255
			add_state_core = 1255
			transfer_state = 616
			add_state_core = 616
			transfer_state = 1256
			add_state_core = 1256
		}
	}
}

country_event = { #Ma 3rd* revolt
    id = qing_reb.11
    title = qing_reb.11.t
    desc = qing_reb.11.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		TAG = QNG
		#date > 1862.3.1
		#date < 1865.1.1
		has_country_flag = true_china
	}

	  #mean_time_to_happen = { days = 200 }
    is_triggered_only = yes
	immediate={
		hidden_effect={
			if={
				limit = {
					XSM = {
						exists = yes
					}
				}
				XSM={
					set_province_controller = 10490
					set_province_controller = 12327
					load_oob = "XSM_guiyuan"
				}
			}
			else={
				XSM={
					set_state_owner = 604
					set_province_controller = 10490
					set_province_controller = 12327
					load_oob = "XSM_guiyuan"
					declare_war_on = {
						target = QNG
						type = annex_everything
					}
					set_country_flag = rebel_uprisisng
				}
			}
		}
	}
    option = { #even More of them
        name = qing_reb.11.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.11.b
		trigger={NOT={tag = QNG}}
		QNG={white_peace = XSM}
		XSM={
			set_cosmetic_tag = XSM_early_ma_clique #just the flag
			load_focus_tree = CHI_warlords_1872	
			remove_ideas={QNG_rebel_uprising}
			add_ideas = {CHI_rebel_administration}
			transfer_state = 604
			transfer_state = 1255
			add_state_core = 1255
			transfer_state = 616
			add_state_core = 616
			transfer_state = 1256
			add_state_core = 1256
		}
	}
	
}
country_event = { #Ma 4th revolt
    id = qing_reb.12
    title = qing_reb.12.t
    desc = qing_reb.12.d

	#    picture = GFX_report_event_election_vote

  trigger = {
		#TAG = QNG
		#date > 1865.3.1
		#date < 1868.1.1
		has_country_flag = true_china
	}

	  # mean_time_to_happen = { days = 60 }
    is_triggered_only = yes
	immediate={
		hidden_effect={
			if={
				limit = {
					XSM = {
						exists = yes
					}
				}
				XSM={
					set_state_owner = 1255
					add_state_core = 1255
					set_province_controller = 12596
					set_province_controller = 12820
					set_province_controller = 1778
					set_province_controller = 7971
					set_province_controller = 2028
					load_oob = "XSM_wenlu"
				}
			}
			else={
				XSM={
					set_state_owner = 1255
					add_state_core = 1255
					set_province_controller = 12596
					set_province_controller = 12820
					set_province_controller = 1778
					set_province_controller = 7971
					set_province_controller = 2028
					load_oob = "XSM_wenlu"
					declare_war_on = {
						target = QNG
						type = annex_everything
					}
					set_country_flag = rebel_uprisisng
				}
			}
		}
	}
    option = { #even More of them
        name = qing_reb.11.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.12.b
		trigger={NOT={tag = QNG}}
		QNG={white_peace = XSM}
		XSM={
			set_cosmetic_tag = XSM_early_ma_clique #just the flag
			load_focus_tree = CHI_warlords_1872	
			remove_ideas={QNG_rebel_uprising}
			add_ideas = {CHI_rebel_administration}
			transfer_state = 604
			transfer_state = 1255
			add_state_core = 1255
			transfer_state = 616
			add_state_core = 616
			transfer_state = 1256
			add_state_core = 1256
		}
	}
}
country_event = { #Gelaohui revolt
    id = qing_reb.13
    title = qing_reb.13.t
    desc = qing_reb.13.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		TAG = QNG
		#date > 1862.1.1
		#date < 1868.1.1
		has_country_flag = true_china
	}

	#mean_time_to_happen = { days = 90 }
    is_triggered_only = yes
	immediate={
		hidden_effect={
			YUL={
				set_cosmetic_tag = SHX_Gelaohui
				set_state_owner = 1222
				add_state_core = 1222
				set_province_controller = 517
				set_province_controller = 4939
				set_province_controller = 3745
				load_oob = "SHX_Gelaohui"
				declare_war_on = {
					target = QNG
					type = annex_everything
				}
				if={
					limit={
						ZHI={exists = yes}
					}
					declare_war_on = {
						target = ZHI
						type = annex_everything
					}
				}
				set_country_flag = rebel_uprisisng
			}
		}
	}
    option = { #even More of them
        name = qing_reb.13.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.13.b
		trigger={NOT={tag = QNG}}
		QNG={white_peace = YUL}
		YUL={
			set_cosmetic_tag = SHX_gelaohui_clique
			load_focus_tree = CHI_warlords_1872	
			remove_ideas={QNG_rebel_uprising}
			add_ideas = {CHI_rebel_administration}
			transfer_state = 622
			add_state_core = 622
			transfer_state = 283
			add_state_core = 283
			transfer_state = 1226
			add_state_core = 1226
			transfer_state = 807
			add_state_core = 807
			if={
				limit={
					ZHI={exists=yes}
				}
				white_peace = ZHI
			}
		}
	}
}
country_event = { #hui revolt
    id = qing_reb.14
    title = qing_reb.14.t
    desc = qing_reb.14.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		TAG = QNG
		#date > 1862.2.1
		#date < 1868.1.1
		has_country_flag = true_china
	}

	#mean_time_to_happen = { days = 60 }
    is_triggered_only = yes
	immediate={
		hidden_effect={
			ZHI={
				set_cosmetic_tag = ZHI_hui
				set_state_owner = 620
				add_state_core = 620
				set_province_controller = 8072
				set_province_controller = 7019
				set_province_controller = 12408
				set_province_controller = 4295
				set_province_controller = 4167
				set_province_controller = 10257
				set_province_controller = 4256
				set_province_controller = 7406
				load_oob = "ZHI_Hui"
				declare_war_on = {
					target = QNG
					type = annex_everything
				}
				if={
					limit={
						YUL={exists = yes}
					}
					declare_war_on = {
						target = YUL
						type = annex_everything
					}
				}
				set_country_flag = rebel_uprisisng
			}
		}
	}
    option = { #let us fight
        name = qing_reb.14.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.14.b
		trigger={NOT={tag = QNG}}
		QNG={white_peace = ZHI}
		ZHI={
			set_cosmetic_tag = ZHI_hui_clique
			load_focus_tree = CHI_warlords_1872	
			remove_ideas={QNG_rebel_uprising}
			add_ideas = {CHI_rebel_administration}
			white_peace = YUL
			transfer_state = 1223
			add_state_core = 1223
		}
	}
}

country_event = { #Dungan revolt
    id = qing_reb.15
    title = qing_reb.15.t
    desc = qing_reb.15.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		#TAG = QNG
		#date > 1864.2.1
		#date < 1868.1.1
		has_country_flag = true_china
	}

	#mean_time_to_happen = { days = 60 }
    is_triggered_only = yes
	immediate={
		hidden_effect={
			SIK={
				set_cosmetic_tag = SIK_dungan
				set_state_owner = 287
				add_state_core = 287
				set_state_controller = 287
				set_province_controller = 5042
				set_province_controller = 8112
				set_province_controller = 10885
				
				set_state_owner = 619
				set_province_controller = 7790
				set_province_controller = 1970
				
				set_province_controller = 5087
				
				set_province_controller = 12119
				
				set_state_owner = 617
				set_province_controller = 4828
				set_province_controller = 7949
				set_province_controller = 1703
				set_province_controller = 4682
				set_province_controller = 7702
				
				set_province_controller = 10545
				set_province_controller = 4709
				set_province_controller = 10674
				load_oob = "SIK_dungan_1"
				create_country_leader = {
					name = "Tuo Ming"
					desc = "POLITICS_TEMP_DESC"
					picture = "Portrait_SIK_Tuo_Ming.dds"
					expire = 1891.12.31
					ideology = despotism
				}
				set_country_flag = rebel_uprisisng
				if={
					limit={ROOT={tag = QNG}}
					declare_war_on = {
						target = QNG
						type = annex_everything
					}
					if={
						limit={
							YUL={exists = yes}
						}
						declare_war_on = {
							target = YUL
							type = annex_everything
						}
					}
				}
			}
		}
	}
    option = { #let us fight
        name = qing_reb.15.a
		trigger={tag = QNG}
    }
	option = { #we must consolidate what we have
        name = qing_reb.15.b
		trigger={NOT={tag = QNG}}
				SIK={
					load_focus_tree = CHI_warlords_1872	
					set_cosmetic_tag = SIK_dungan_clique
					remove_ideas={QNG_rebel_uprising}
					add_ideas = {CHI_rebel_administration}
					transfer_state = 287
					transfer_state = 619
					add_state_core = 619
					transfer_state = 1253
					add_state_core = 1253
					transfer_state = 1254
					add_state_core = 1254
					transfer_state = 1225
					add_state_core = 1225
					transfer_state = 617
					add_state_core = 617
					transfer_state = 1252
					add_state_core = 1252
					transfer_state = 618
					add_state_core = 618
					transfer_state = 947
					add_state_core = 947
					if={
						limit={
							ROOT={owns_state=945}
						}
						transfer_state = 945
						add_state_core = 945
							
					}
					if={
						limit={
							ROOT={owns_state=946}
						}
						transfer_state = 946
						add_state_core = 946
							
					}
					if={
						limit={
							ROOT={owns_state=943}
						}
						transfer_state = 943
						add_state_core = 943
							
					}
					if={
						limit={
							ROOT={owns_state=944}
						}
						transfer_state = 944
						add_state_core = 944
							
					}
					set_country_flag = rebel_uprisisng
				}
    }
}

country_event = { #Ma Zhenlong revolt
    id = qing_reb.16
    title = qing_reb.16.t
    desc = qing_reb.16.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		#TAG = QNG
		#date > 1864.2.1
		#date < 1868.1.1
		has_country_flag = true_china
	}

	  #mean_time_to_happen = { days = 60 }
    is_triggered_only = yes
	immediate={
		hidden_effect={
			MAN={
				set_cosmetic_tag = MAN_ma_zhe
				set_state_owner = 715
				add_state_core = 715
				set_state_owner = 716
				add_state_core = 716
				set_state_owner = 328
				add_state_core = 328
				set_province_controller = 916
				set_province_controller = 4642
				set_province_controller = 930
				set_province_controller = 887
				set_province_controller = 3849
				set_province_controller = 9885
				set_province_controller = 11771
				set_province_controller = 6951
				set_province_controller = 11815
				set_province_controller = 3934
				set_province_controller = 934
				set_province_controller = 6837
				set_province_controller = 9781
				set_province_controller = 892
				set_province_controller = 3895
				set_province_controller = 3839
				set_province_controller = 3913
				set_province_controller = 1567
				set_province_controller = 7663
				set_province_controller = 11744
				set_province_controller = 4503
				set_province_controller = 7652
				set_province_controller = 7523
				set_province_controller = 9782
				set_province_controller = 7591
				set_province_controller = 9928
				set_province_controller = 987
				set_province_controller = 6837
				load_oob = "MAN_Ma_Zhe"
				declare_war_on = {
					target = QNG
					type = annex_everything
				}
				create_country_leader = {
					name = "Ma Shazi"
					desc = "POLITICS_TEMP_DESC"
					picture = "Portrait_MAN_Ma_Shazi.dds"
					expire = 1891.12.31
					ideology = despotism
				}
				add_ideas={
					QNG_rebel_uprising
				}
				set_country_flag = rebel_uprisisng
			}
		}
	}
    option = { #let us fight
        name = qing_reb.16.a
		trigger={tag = QNG}
    }
}

country_event = { #Qing shattered
    id = qing_reb.17
    title = qing_reb.17.t
    desc = qing_reb.17.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		TAG = QNG
		#OR ={
		#	surrender_progress > 0.60
		#	NOT={controls_state = 608}
		#}
		date < 1885.1.1
	}

	#mean_time_to_happen = { days = 2 }
    is_triggered_only = yes
	immediate={
		hidden_effect={
			#Qing retreats to Manchuria 
			set_cosmetic_tag = QNG_manchurian_rump_state
			if={
				limit={
					has_idea = QNG_idea_arrow_incident
				}
				remove_ideas={QNG_idea_arrow_incident}
			}
			#revolve warlords first
			#miao
			if={
				limit={
					SIC={
						exists = yes
						NOT={has_cosmetic_tag = SIC_White_Hao}
					}
				}
				white_peace = SIC
			}
			SIC={
				transfer_state = 603
				set_cosmetic_tag = SIC_miao_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				clr_country_flag = rebel_uprisisng
				load_focus_tree = CHI_warlords_1872	
			}
			#Nian
			if={
				limit={
					NIE={exists = yes}
				}
				white_peace = NIE
			}
			NIE = {
				set_cosmetic_tag = NIE_nian_clique
				remove_ideas = { QNG_rebel_uprising }
				add_ideas = { CHI_rebel_administration CHI_bandit_state }
				transfer_state = 597
				add_state_core = 597
				transfer_state = 1232
				add_state_core = 1232
				transfer_state = 1151
				add_state_core = 1151
				transfer_state = 614
				add_state_core = 614
				clr_country_flag = rebel_uprising
				595 = {
					set_victory_points = {
						province = 7071
						value = 2
					}
				}
				if = {
					limit = {
						ROOT = { owns_state = 595 }
					}
					transfer_state = 595
					add_state_core = 595
				}
				if = {
					limit = {
						ROOT = { owns_state = 1168 }
					}
					transfer_state = 1168
					add_state_core = 1168
				}
				if = {
					limit = {
						ROOT = { owns_state = 1167 }
					}
					transfer_state = 1167
					add_state_core = 1167
				}
				load_focus_tree = CHI_warlords_1872
			}
			#Ma
			if={
				limit={
					XSM={exists = yes}
				}
				white_peace = XSM
			}
			XSM={
				set_cosmetic_tag = XSM_early_ma_clique #just the flag
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 604
				add_state_core = 604
				transfer_state = 1255
				add_state_core = 1255
				transfer_state = 616
				add_state_core = 616
				transfer_state = 1256
				add_state_core = 1256
				clr_country_flag = rebel_uprisisng
				load_focus_tree = CHI_warlords_1872	
			}
			#Dungan
			if={
				limit={
					SIK={exists = yes}
				}
				white_peace = SIK
			}
			SIK={
				set_cosmetic_tag = SIK_dungan_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 287
				add_state_core = 287
				transfer_state = 619
				add_state_core = 619
				transfer_state = 1253
				add_state_core = 1253
				transfer_state = 1254
				add_state_core = 1254
				transfer_state = 1225
				add_state_core = 1225
				transfer_state = 617
				add_state_core = 617
				add_state_core = 1252
				transfer_state = 947
				add_state_core = 947
				if={
					limit={
						ROOT={owns_state=945}
					}
					transfer_state = 945
					add_state_core = 945
						
				}
				if={
					limit={
						ROOT={owns_state=946}
					}
					transfer_state = 946
					add_state_core = 946
							
				}
				if={
					limit={
						ROOT={owns_state=943}
					}
					transfer_state = 943
					add_state_core = 943
							
				}
				clr_country_flag = rebel_uprisisng
				load_focus_tree = CHI_warlords_1872	
			}
			#Ma Zhenlong
			if={
				limit={
					MAN={exists = yes}
				}
				white_peace = MAN
			}
			MAN={
				set_cosmetic_tag = MAN_ma_zhenlong_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 1025
				add_state_core = 1025
				transfer_state = 716
				add_state_core = 716
				clr_country_flag = rebel_uprisisng
				load_focus_tree = CHI_warlords_1872	
			}
			#Hui
			if={
				limit={
					ZHI={exists = yes}
				}
				white_peace = ZHI
				ZHI={white_peace = YUL}
			}
			ZHI={
				set_cosmetic_tag = ZHI_hui_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 1223
				add_state_core = 1223
				transfer_state = 807
				add_state_core = 807
				clr_country_flag = rebel_uprisisng
				load_focus_tree = CHI_warlords_1872	
			}
			#Gelaohui
			if={
				limit={
					YUL={exists = yes}
				}
				white_peace = YUL
			}
			YUL={
				set_cosmetic_tag = YUL_gelaohui_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 1222
				add_state_core = 1222
				transfer_state = 283
				add_state_core = 283
				if={
					limit={
						SIK={exists=yes}
					}
					white_peace = SIK
				}
				clr_country_flag = rebel_uprisisng
				load_focus_tree = CHI_warlords_1872	
			}
			##resolve non-rebellion cliques
			#Sinkiang (2 electric boglaloo)
			MEN={
				set_cosmetic_tag = MEN_sinkang_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 618
				add_state_core = 618
				clr_country_flag = rebel_uprisisng
				if={
					limit={
						ROOT={owns_state=944}
					}
					transfer_state = 944
					add_state_core = 944
							
				}
				load_focus_tree = CHI_warlords_1872	
			}
			#Xiang Army
			delete_unit_template_and_units = {
				division_template = "Xiang Army"
				disband = no #will refund equipment and manpower
			}
			HNA={
				set_cosmetic_tag = HNA_xiang_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 602
				add_state_core = 602
				clr_country_flag = rebel_uprisisng
				load_oob = "HNA_xiang_army"
				load_focus_tree = CHI_warlords_1872	
			}
			#Shanxi
			SHX={
				set_cosmetic_tag = SHX_shanxi_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 615
				add_state_core = 615
				clr_country_flag = rebel_uprisisng
				load_focus_tree = CHI_warlords_1872	
			}
			#yunnan
			YUN={
				set_cosmetic_tag = YUN_yunnan_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 325
				add_state_core = 325
				clr_country_flag = rebel_uprisisng
				load_focus_tree = CHI_warlords_1872	
			}
			#Yi
			XIN={
				set_cosmetic_tag = XIN_yi_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 601
				add_state_core = 601
				transfer_state = 1152
				add_state_core = 1152
				transfer_state = 973
				add_state_core = 973
				clr_country_flag = rebel_uprisisng
				load_focus_tree = CHI_warlords_1872	
			}
			#Ba
			WUH={
				set_cosmetic_tag = WUH_ba_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 620
				add_state_core = 620
				clr_country_flag = rebel_uprisisng
				load_focus_tree = CHI_warlords_1872	
			}
			#Ordos (this is called I____ league, but the spelling is so inconsisant and information is so hard to find, just calling it the modern name)
			YSS={
				set_cosmetic_tag = YSS_ordos_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 1226
				add_state_core = 1226
				transfer_state = 622
				add_state_core = 622
				clr_country_flag = rebel_uprisisng
				load_focus_tree = CHI_warlords_1872	
			}
			#tibet declares independance
			TIB={add_state_core = 1157}
			release = TIB
			#mongolia declares independance
			MON={
				add_ideas = {CHI_rebel_administration}
				load_focus_tree = CHI_warlords_1872	
				if={
					limit={
						ROOT={owns_state=621}
					}
					add_state_core = 621
				}	
				if={
					limit={
						ROOT={owns_state=1294}
					}
					add_state_core = 1294
				}	
				if={
					limit={
						ROOT={owns_state=612}
					}
					add_state_core = 612
				}					
			}
			release = MON
			if={
				limit={
					owns_state=329
				}
				TAN={
					add_state_core = 329
					set_politics = {
						ruling_party = radical_democracy
					}
					set_cosmetic_tag = TAN_uryankhay_republic
					inherit_technology = ROOT
					set_popularities = {
						anarchism = 0
						ideology_social_liberalism = 0
						ideology_radical_socialism = 0
						social_egalitarianism = 0
						centrism = 0
						traditional_conservatism = 0
						radical_democracy = 100
						chauvinist_populism = 0
						autocracy = 0
						fundamentalism = 0
					}
				}
				release = TAN
			}
			
			
			#Kumul becomes indpendant
			release = KML
			
			608={#he who holds bejing, holds the empire
				if={#Taiping
					limit={TAI={controls_state = PREV}}
					TAI={save_event_target_as = new_CHI_emperor}
				}
				#ming Claiments
				else_if={#Dacheng
					limit={GXC={controls_state = PREV}}
					GXC={save_event_target_as = new_CHI_emperor}
				}
				else_if={#White Hao
					limit={
						SIC={
							has_cosmetic_tag = SIC_White_Hao
							controls_state = PREV
						}
					}
					SIC={save_event_target_as = new_CHI_emperor}
				}
				else_if={#Baguahui
					limit={TAW={controls_state = PREV}}
					TAW={save_event_target_as = new_CHI_emperor}
				}
				#new empires
				else_if={#Shuntain
					limit={SHU={controls_state = PREV}}
					SHU={save_event_target_as = new_CHI_emperor}
				}
				else_if={#Tianshun
					limit={ANH={controls_state = PREV}}
					ANH={save_event_target_as = new_CHI_emperor}
				}
				else_if={#Yanling
					limit={YAL={controls_state = PREV}}
					YAL={save_event_target_as = new_CHI_emperor}
				}
				else_if={
					limit={TAI={exists = yes}}
					TAI={save_event_target_as = new_CHI_emperor}
					ROOT={set_country_flag = contested_heavenly_mandate}
				}
				else={
					ROOT={set_country_flag = qing_reduced}
				}
			}

			if={#Shuntain exists
				limit={
					SHU={
						exists=yes
					}
				}
				white_peace = SHU
			}
			SHU={
				set_cosmetic_tag = SHU_shuntain_clique
				load_focus_tree = CHI_warlords_1872	
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				transfer_state = 605
				add_state_core = 605		
				clr_country_flag = rebel_uprisisng
			}
			if={#Tianshun exists
				limit={
					ANH={
						exists=yes
					}
				}
				white_peace = ANH
				
			}
			ANH={
				set_cosmetic_tag = ANH_tianshun_clique
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				load_focus_tree = CHI_warlords_1872	
				transfer_state = 606
				add_state_core = 606	
				transfer_state = 607
				add_state_core = 607				
				clr_country_flag = rebel_uprisisng
			}
			if={#Baguahui exists
				limit={
					TAW={
						exists=yes
					}
				}
				white_peace = TAW
			}
			TAW={
				remove_ideas={QNG_rebel_uprising}
				add_ideas = {CHI_rebel_administration}
				load_focus_tree = CHI_warlords_1872	
				clr_country_flag = rebel_uprisisng
				transfer_state = 524
				add_state_core = 524
			}
			if={#Heavenly kingdom exists
				limit={
					TAI={
						exists=yes
					}
				}
				white_peace = TAI
			}
			TAI={
				remove_ideas={QNG_rebel_uprising}
				add_ideas={CHI_idea_insufficient_army CHI_idea_new_mandate}
				load_focus_tree = CHI_new_mandate_1872
				if={
					limit={
						ROOT={owns_state=595}
					}
					transfer_state = 595
					add_state_core = 595
				}
				if={
					limit={
						ROOT={owns_state=596}
					}
					transfer_state = 596
					add_state_core = 596
				}
				if={
					limit={
						ROOT={owns_state=613}
					}
					transfer_state = 613
					add_state_core = 613
					
				}
				if={
					limit={
						ROOT={owns_state=602}
					}
					transfer_state = 602
					add_state_core = 602
				}
				if={
					limit={
						ROOT={owns_state=598}
					}
					transfer_state = 598
					add_state_core = 598
				}
				clr_country_flag = rebel_uprisisng
			}
			if={#Panthay exists
				limit={
					PTH={
						exists=yes
					}
				}
				white_peace = PTH
			}
			PTH={
				set_cosmetic_tag = PTH_pingnan_guo
				remove_ideas={QNG_rebel_uprising}
				transfer_state = 974
				add_state_core = 974
				load_focus_tree = CHI_warlords_1872	
				clr_country_flag = rebel_uprisisng
			}
			BRM={
				transfer_state = 775
			}
			if={#Dacheng exists
				limit={
					GXC={
						exists=yes
					}
				}
				white_peace = GXC
			}
			GXC={
				set_cosmetic_tag = GXC_ming#declares ming anyway
				remove_ideas={QNG_rebel_uprising}
				add_ideas={CHI_idea_insufficient_army CHI_idea_new_mandate}
				load_focus_tree = CHI_new_mandate_1872
				transfer_state = 592
				add_state_core = 592
				transfer_state = 593
				add_state_core = 593
				
				if={
					limit={
						YAL={
							exists = no
							owns_state = 594
						}
					}
					transfer_state = 594
					add_state_core = 594	
					transfer_state = 728
					add_state_core = 728
					transfer_state = 591
					add_state_core = 591
				}
				if={
					limit={
						TAW={
							exists = yes
						}
					}
					ROOT={white_peace = TAW}
					puppet = TAW
					TAW={country_event = {id = qing_reb.18 days = 5}}#Under the ming
				}
				if={
					limit={
						SIC={
							exists = yes
						}
					}
					ROOT={white_peace = SIC}
					puppet = SIC
					SIC={country_event = {id = qing_reb.18 days = 5}}#Under the ming
				}
				clr_country_flag = rebel_uprisisng
			}
			

			if={#Wu Lingyun exists
				limit={
					YAL={
						exists=yes
						owns_state = 594
					}
				}
				white_peace = YAL
				YAL={
					set_cosmetic_tag = YAL_wu_lingyun_clique
					remove_ideas={QNG_rebel_uprising}	
					transfer_state = 728
					add_state_core = 728
					transfer_state = 591
					add_state_core = 591
					transfer_state = 594
					add_state_core = 594
					clr_country_flag = rebel_uprisisng
					load_focus_tree = CHI_warlords_1872
				}
			}
			else={
				GXC={
					transfer_state = 728
					add_state_core = 728
					transfer_state = 591
					add_state_core = 591
				}
			}
			
			if={#resolve the new empire
				limit={
					event_target:new_CHI_emperor = {
						exists = yes
					}
				}
				white_peace = event_target:new_CHI_emperor
				clr_country_flag = true_china
				event_target:new_CHI_emperor={
					country_event = {id = qing_reb.19}
					set_country_flag = QNG_heavenly_mandate
					set_country_flag = true_china
					load_focus_tree = CHI_new_mandate_1872
					add_ideas={CHI_idea_new_mandate}
					if={
						limit={tag= SHU}
						set_cosmetic_tag = ANH_shuntain_empire
						add_ideas={CHI_idea_insufficient_army}
						annex_country = {
							target = XIN
							transfer_troops = yes
						}
					}
					else_if={
						limit={tag= ANH}
						set_cosmetic_tag = ANH_tianshun_empire
						add_ideas={CHI_idea_insufficient_army}
					}
					else_if={
						limit={tag= TAI}
						set_cosmetic_tag = TAI_heavenly_empire
					}
					else_if={
						limit={tag= PTH}
						set_cosmetic_tag = PTH_new_han_empire
						add_ideas={CHI_idea_insufficient_army}
					}
					else_if={
						limit={tag= YAL}
						set_cosmetic_tag = YAL_empire
						add_ideas={CHI_idea_insufficient_army}
					}
					else_if={
						limit={
							OR={
								tag= GXC
								tag= TAW
								tag= SIC
							}
						}
						set_cosmetic_tag = GXC_ming_true
						add_ideas={CHI_idea_insufficient_army}
					}					
				}
			}
			if={
				limit={TAW={has_war_with = QNG}}
				TAW={
					load_focus_tree = CHI_warlords_1872	
					#set_cosmetic_tag = ZHI_hui_clique
					remove_ideas={QNG_rebel_uprising}
					clr_country_flag = rebel_uprisisng
				}
				white_peace = TAW
			}
			
		}
	}
    option = { #
        name = qing_reb.17.a
    }
}

country_event = { #Ming Declares you a vassal
    id = qing_reb.18
    title = qing_reb.18.t
    desc = qing_reb.18.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #we are always loyal to ming
        name = qing_reb.18.a
		ai_chance = {
			factor = 90
		}
    }
	option = { #they are not the true ming yet
        name = qing_reb.18.b
		ai_chance = {
			factor = 10
		}
    }
}

country_event = { #you art emperor now
    id = qing_reb.19
    title = qing_reb.19.t
    desc = {
		text = qing_reb.19.d 
		trigger={
			NOT={tag= event_target:new_CHI_emperor}
		}
	}
	desc = {
		text = qing_reb.19.d_a
		trigger={
			tag= event_target:new_CHI_emperor
		}
	}
	major = yes

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
	immediate={
		hidden_effect={
			#add_ideas={QNG_new_mandate}
			if={
				limit={
					NOT={tag=PTH}
					PTH={exists = yes}
				}#if panthay is independant, can ask to join peacefully in exchange for rights
				country_event = {id = qing_reb.20 days = 3}
			}
		}
	}
    option = { #it is our time 
        name = qing_reb.19.a
		trigger={
			tag= event_target:new_CHI_emperor
		}
		if={
			limit={
				is_ai = no
			}
			set_variable={super_event_displayed = 28}
		}
    }
	option = { #Curse the False Emperor
        name = qing_reb.19.b
		trigger={
			tag= QNG
		}
		if={
			limit={
				is_ai = no
			}
			set_variable={super_event_displayed = 28}
		}
    }
	option = { #
        name = qing_reb.19.c
		trigger={
			NOT={
				tag= QNG
				tag= event_target:new_CHI_emperor
			}
		}
		if={
			limit={
				is_ai = no
			}
			set_variable={super_event_displayed = 28}
		}
    }
}

country_event = { #Question of Shi Dakai
    id = qing_reb.20
    title = qing_reb.20.t
    desc = qing_reb.20.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #Sideline him
        name = qing_reb.20.a
		ai_chance = {
			factor = 90
		}
		retire_character = TAI_Shi_Dakai
		set_country_flag = TAI_shi_dakai_removed
		remove_ideas={QNG_idea_TAI_shi_dakai}
    }
	option = { #We have nothing to fear from him
        name = qing_reb.20.b
		ai_chance = {
			factor = 10
		}
		set_country_flag = TAI_shi_dakai_stays
		add_stability = -0.1
    }
}

country_event = { #taiping dies, lower the xiang army
    id = qing_reb.21
    title = qing_reb.21.t
    desc = qing_reb.21.d

	#    picture = GFX_report_event_election_vote

    trigger = {
		TAG = QNG
		TAI={exists = no}
		has_template = "Xiang Army"
	}

    fire_only_once = yes
	immediate={
		set_country_flag = xiang_army_unavailable
		delete_unit_template_and_units = {
			division_template = "Xiang Army"
		}
	}
    option = { #ok
        name = qing_reb.21.a
    }
}

country_event = { #demand tribute
    id = qing_reb.22
    title = qing_reb.22.t
    desc = qing_reb.22.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #we are always loyal to ming
        name = qing_reb.22.a
		ai_chance = {
			factor = 90
		}
		FROM={}
    }
	option = { #they are not the true ming yet
        name = qing_reb.22.b
		ai_chance = {
			factor = 10
		}
    }
}

country_event = { #TAI offers a trading port for support
    id = qing_reb.25
    title = qing_reb.25.t
    desc = qing_reb.25.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #a wedge to open china with
        name = qing_reb.25.a
		ai_chance = {
			factor = 75
		}
		TAI={country_event = {id=qing_reb.26}}
		set_country_flag = TAI_owes_shanghai_port
		add_political_power = -50
    }
	option = { #we prefer our deals with qing
        name = qing_reb.25.b
		ai_chance = {
			factor = 25
		}
		TAI={country_event = {id=qing_reb.27}}
    }
}
country_event = { #offer agreed upon
    id = qing_reb.26
    title = qing_reb.26.t
    desc = qing_reb.26.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #perfect
        name = qing_reb.26.a
		add_equipment_to_stockpile = {
			type = infantry_equipment
			amount = 1000
			producer = FROM
		}
    }

}
country_event = { #offer rejected
    id = qing_reb.27
    title = qing_reb.27.t
    desc = qing_reb.27.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #damn
        name = qing_reb.27.a
		ai_chance = {
			factor = 75
		}
		
    }

}
country_event = { #strike on shanghai
    id = qing_reb.29
    title = qing_reb.29.t
    desc = qing_reb.29.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #Besige the city
        name = qing_reb.29.a
		ai_chance = {
			factor = 100
		}
		add_manpower = -2000
		QNG={country_event = {id = qing_reb.30 days = 2}}
    }

}
country_event = { #Countering the strike
    id = qing_reb.30
    title = qing_reb.30.t
    desc = qing_reb.30.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #Besige the city
        name = qing_reb.30.a
		ai_chance = {
			factor = 100
		}
		add_manpower = -2000
		hidden_effect = {
		country_event = {id = qing_reb.31 days = 1}
		}
	}
}
country_event = { #ever victorius army formed
    id = qing_reb.31
    title = qing_reb.31.t
    desc = qing_reb.31.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
	immediate={
		QNG={
			load_oob = QNG_ever_victorious_army
			add_equipment_to_stockpile = {
				type = infantry_equipment_rifle_1
				amount = 500
				producer = USA
			}
			add_equipment_to_stockpile = {
				type = cannon_equipment_0
				amount = 150
				producer = USA
			}
			set_country_flag = QNG_ever_victorius_army

			generate_character = {
                token_base = frederick_townsend_ward
                name = "Frederick Townsend Ward"
                portraits = {
                    army = {
                        large = "GFX_Portrait_QNG_Frederick_Townsend_Ward"
						small = "GFX_Portrait_EUROPE_Generic_Army_1_small"
                    }
                }
                corps_commander = {
                    traits = { brilliant_strategist }
                    skill = 3
					attack_skill = 3
					defense_skill = 2
					planning_skill = 4
					logistics_skill = 3
                }
			}
		}
	}
    option = { #oops
        name = qing_reb.31.a
		ai_chance = {
			factor = 100
		}
	TAI={country_event = {id = qing_reb.32}}
    }

}
country_event = { #fook
    id = qing_reb.32
    title = qing_reb.32.t
    desc = qing_reb.32.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #perfect
        name = qing_reb.32.a
		ai_chance = {
			factor = 100
		}
		add_political_power = -25
    }

}
country_event = { #Equipment Cache captured
    id = qing_reb.33
    title = qing_reb.33.t
    desc = qing_reb.33.d

	    picture = GFX_report_event_second_opium_war_tianjin_treaty
	trigger={
		OR={
			has_idea = QNG_rebel_uprising
			has_idea = QNG_rebel_uprising_2
			has_idea = QNG_idea_banner_armies
		}
		has_war = yes
	}
	mean_time_to_happen={
		days = 45
	}
    option = { #perfect
        name = qing_reb.33.a
		ai_chance = {
			factor = 100
		}
					add_equipment_to_stockpile={
					type = uniform_equipment_0
					amount = 1000
					producer = QNG
					}
				add_equipment_to_stockpile={
					type = infantry_equipment_pike_and_shot_0
					amount = 4000
					producer = QNG
		}
	}
}

country_event = { #request for recognition - TODO
    id = qing_reb.34
    title = qing_reb.34.t
    desc = qing_reb.34.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #perfect
        name = qing_reb.34.a
		ai_chance = {
			factor = 100
		}
    }

}

country_event = { #Dreams of Transoxina
    id = qing_reb.35
    title = qing_reb.35.t
    desc = qing_reb.35.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #perfect
        name = qing_reb.35.a
		ai_chance = {
			factor = 100
		}
    }

}
country_event = { #Deligation from Dungan Clique Arrives
    id = qing_reb.36
    title = qing_reb.36.t
    desc = qing_reb.36.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #Agree
        name = qing_reb.36.a
		ai_chance = {
			factor = 70
		}
		SIK={country_event = {id = qing_reb.42}}
		set_country_flag = SIK_agree_to_transoxiana
    }
	option = { #Refuse
        name = qing_reb.36.a
		ai_chance = {
			factor = 30
		}
		SIK={country_event = {id = qing_reb.41}}
    }

}
news_event = { #formation of tranxoniana
    id = qing_reb.37
    title = qing_reb.37.t
    desc = qing_reb.37.d
	
	major = yes

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #ok
        name = qing_reb.37.a
		ai_chance = {
			factor = 100
		}
    }

}

country_event = { #education reforms
    id = qing_reb.38
    title = qing_reb.38.t
    desc = qing_reb.38.d

	# #    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #open schools to all
        name = qing_reb.38.a
		ai_chance = {
			factor = 20
		}
    }
	option = { #continue confushion traditions
        name = qing_reb.38.b
		ai_chance = {
			factor = 20
		}
    }
	option = { #modern western teachers
        name = qing_reb.38.c
		ai_chance = {
			factor = 20
		}
    }

}

country_event = { #unifaction of taiwan
    id = qing_reb.39
    title = qing_reb.39.t
    desc = qing_reb.39.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #perfect
        name = qing_reb.39.a
		ai_chance = {
			factor = 100
		}
    }

}

country_event = { #shatter china
    id = qing_reb.40
    title = qing_reb.40.t
    desc = qing_reb.40.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #fully shattered
        name = qing_reb.40.a
		hidden_effect={
			QNG={
				country_event = {id= qing_reb.17}
			}
		}
    }
	 option = { #not the minors
        name = qing_reb.40.b
		
		#QNG={country_event = {id= qing_reb.17}}
    }

}

country_event = { #refused
    id = qing_reb.41
    title = qing_reb.41.t
    desc = qing_reb.41.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #take them
        name = qing_reb.41.a
		ai_chance = {
			factor = 95
		}
		FROM={
			every_owned_state={
				ROOT={add_state_claim = PREV}
			}
		}
		declare_war_on = {
			target = FROM
			type = annex_everything
		}
    }
	option = { #give up the notion
        name = qing_reb.41.b
		ai_chance = {
			factor = 5
		}
    }

}
country_event = { #they agree
    id = qing_reb.42
    title = qing_reb.42.t
    desc = qing_reb.42.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #perfect
        name = qing_reb.42.a
		puppet = FROM
		ai_chance = {
			factor = 100
		}
    }

}


country_event = { #Dungan revolt
    id = qing_reb.43
    title = qing_reb.43.t
    desc = qing_reb.43.d

	#    picture = GFX_report_event_election_vote

    #trigger = {
		#TAG = CHI
		#date > 1895.2.1
		#date < 1896.1.1
	  #}
	  

	  # mean_time_to_happen = { days = 60 }
    is_triggered_only = yes
	immediate={
		hidden_effect={
			if={
				limit = {
					XSM={exists = no}
				}
				XSM={
					set_cosmetic_tag = SIK_dungan
					set_state_owner = 283
					add_state_core = 283
					set_state_controller = 283
					
					set_politics = {
						ruling_party = fundamentalism
					}

					set_popularities = {
							anarchism = 0
							ideology_social_liberalism = 0
							ideology_radical_socialism = 0
							social_egalitarianism = 0
							centrism = 0
							traditional_conservatism = 0
							radical_democracy = 0
							chauvinist_populism = 0
							autocracy = 31
							fundamentalism = 69
					}
					
					load_oob = "SIK_dungan_2"
					create_country_leader = {
						name = "Ma Yonglin"
						desc = "POLITICS_TEMP_DESC"
						picture = "Portrait_SIK_Ma_Yonglin.dds"
						expire = 1898.06.30
						ideology = islamist
					}
					set_country_flag = rebel_uprisisng
					declare_war_on = {
						target = QNG
						type = annex_everything
					}
				}
			}
		}
	}
    option = { #let us fight
        name = qing_reb.43.a
    }
}

country_event = { #death of Zhu Heling
    id = qing_reb.44
    title = qing_reb.44.t
    desc = qing_reb.44.d

	#    picture = GFX_report_event_election_vote
	trigger = {
		TAG = GXC
		date < 1869.1.1
		date > 1875.1.1
		has_country_leader = {
			name = "Zhu Heling"
			ruling_only = yes
		}
	}

	mean_time_to_happen = { days = 60 }
    fire_only_once = yes
    option = { #perfect
        name = qing_reb.44.a
		retire_country_leader = yes
		create_country_leader = {
			name = "Zhu Chengrui"
			desc = "POLITICS_ZHU_CHENGRUI_DESC"
			picture = "Portrait_Zhu_Chengrui.dds"
			expire = "1900.1.1"
			ideology = despotism
			traits = {
						
			}
		}
		ai_chance = {
			factor = 100
		}
    }

}
country_event = { #demand independance
    id = qing_reb.45
    title = qing_reb.45.t
    desc = qing_reb.45.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #perfect
        name = qing_reb.45.a
		ai_chance = {
			factor = 50
		}
    }
	option = { #perfect
        name = qing_reb.45.b
		ai_chance = {
			factor = 50
		}
    }

}
country_event = { #TAW offers a deal
    id = qing_reb.46
    title = qing_reb.46.t
    desc = qing_reb.46.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
    option = { #accept
        name = qing_reb.46.a
		ai_chance = {
			factor = 25
			modifier = {
				factor = 100
				FROM={is_ai = no}
			}
		}
		FROM={
			set_country_flag = PAW_accepted
		}
    }
	option = { #decline
        name = qing_reb.46.b
		ai_chance = {
			factor = 75
		}
    }

}
country_event = { #PAW accepts
    id = qing_reb.47
    title = qing_reb.47.t
    desc = qing_reb.47.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
	option = { #ok
        name = qing_reb.47.a
    }

}
country_event = { #PAW declines
    id = qing_reb.48
    title = qing_reb.48.t
    desc = qing_reb.48.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
	option = { #ok
        name = qing_reb.48.a
		add_political_power = -50
    }

}
news_event = { #Unifaction of Taiwan
    id = qing_reb.49
    title = qing_reb.49.t
    desc = qing_reb.49.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
	
	option = { #great
        name = qing_reb.49.a
		trigger={
			tag = TAW
		}
		ai_chance = {
			factor = 25
		}
		PAW={
			every_owned_state = {
				remove_core_of = PAW
				add_core_of = TAW
			}
		}
		annex_country = {
			target = PAW
			transfer_troops = yes
		}
		set_cosmetic_tag = TAW_formosan_republic
    }
	option = { #ok
        name = qing_reb.49.b
		ai_chance = {
			factor = 25
		}
    }

}
country_event = { #establishment of Pingnan Guo
    id = qing_reb.50
    title = qing_reb.50.t
    desc = qing_reb.50.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only=yes
	option = { #ok
        name = qing_reb.48.a
		add_political_power = -50
    }

}

country_event = { #Equipment Cache captured
    id = qing_reb.51
    title = qing_reb.51.t
    desc = qing_reb.51.d

	#    picture = GFX_report_event_election_vote
	is_triggered_only = yes
    option = { #perfect
        name = qing_reb.51.a
		ai_chance = {
			factor = 100
		}
		every_country={
			add_equipment_to_stockpile = {
				type = uniform_equipment_0
				amount = -200000
				producer = EZO
			}
		}
    }
}

country_event = { #Rebels losing momentum
	id = qing_reb.52
	title = qing_reb.52.t
	desc = qing_reb.52.d 
	
	picture = GFX_report_event_election_vote

	trigger = {
		has_country_flag = rebel_uprisisng
		has_war_with = QNG
		date > 1865.1.1
		date < 1875.1.1 
	}

	mean_time_to_happen = { days = 700 }

	option = {
		ai_chance={ base = 100 }
		name = qing_reb.52.a
		rebels_lose_momentum = yes 
	}
}
country_event = { #taiping introduction
	id = qing_reb.53
	title = qing_reb.53.t
	desc = qing_reb.53.d 
	
	#picture = GFX_report_event_election_vote
	is_triggered_only = yes
	
	option = {
		name = qing_reb.53.a
	}
}

country_event = { #disbanding ever victorious army
	id = qing_reb.54
	title = qing_reb.54.t
	desc = qing_reb.54.d 
	
	#picture = GFX_report_event_election_vote
	is_triggered_only = yes
	
	option = {
		name = qing_reb.54.a
		delete_unit = {
			division_template = "Ever Victorius Army"
		}
		set_division_template_lock = {
			division_template = "Ever Victorius Army"
			is_locked = no
		}
		add_timed_idea = {
			idea = QNG_inspiration_from_the_ever_victorious_army
			days = 365
		}
	}
}
	


country_event = { #Ye Mingchen’s remains return to China
	id = qing.201
	title = qing.201.t
	desc = qing.201.d

	#picture = 
	is_triggered_only = yes

	fire_only_once = yes
	option = { #this is sad
		name = qing.201.a
	}
}

country_event = { #Xinyou Coup part 1 3rd september
	id = qing.202
	title = qing.202.t 
	desc = qing.202.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.202.a 
		#prepare for the coup 
		hidden_effect = { 
				country_event = {id = qing.203 days = 2}
		}
	}
}

country_event = { #Xinyou Coup part 2 5th september 
	id = qing.203
	title = qing.203.t 
	desc = qing.203.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.203.a 
		hidden_effect = {  #ask prince gong for help 
			country_event = {id = qing.204 days = 0}
		}
	}
}

country_event = { #Xinyou Coup part 3 5th september
	id = qing.204
	title = qing.204.t 
	desc = qing.204.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 

	option = { #Prince Gong accepts 
		name = qing.204.a 
		hidden_effect = { 
			country_event = {id = qing.206 days = 58}
		}
	}
 
	option = { #Prince Gong declines
		name = qing.204.b 
		hidden_effect = {   
			country_event = {id = qing.205 days = 58}
		}
	}

	option = { #Prince Gong demands more (Prince gong regent path)
		name = qing.204.c
		hidden_effect = {  
			country_event = {id = qing.206 days = 58}
			set_country_flag = QNG_prince_gong1_flag
		}
	}
}

country_event = { #Xinyou Coup part 4 #Sushun path 2nd november
	id = qing.205
	title = qing.205.t 
	desc = qing.205.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.205.a 
		#Plot found out 
		complete_national_focus = QNG_focus_hold_funeral_from_chengde_beijing
		clr_country_flag = QNG_xianfeng_dies_flag
		set_country_flag = QNG_sushun_council_flag
		mark_focus_tree_layout_dirty = yes
		hidden_effect = {
			add_ideas={
				QNG_burecratic_issues
				QNG_empresses_support
			}
		}
	}
}

country_event = { #Xinyou Coup part 5 #Cixi path 2nd november
	id = qing.206
	title = qing.206.t 
	desc = qing.206.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.206.a 
		country_event = {id = qing.7 days = 1}
	}
}

country_event = { #Xinyou Coup part 6 #Prince Gong path 3rd November
	id = qing.207
	title = qing.207.t 
	desc = qing.207.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.207.a 
		#Counter-coup Cixi 
		hidden_effect={
			QNG={
				if={
					limit={
						has_country_flag = QNG_Cixi_1_flag
						has_country_flag = QNG_prince_gong1_flag
					}
					complete_national_focus = QNG_focus_hold_funeral_from_chengde_beijing
					clr_country_flag = QNG_Cixi_1_flag
					clr_country_flag = QNG_prince_gong1_flag 
					set_country_flag = QNG_prince_gong_flag
					mark_focus_tree_layout_dirty = yes
				}
			}
		}
	}
}

country_event = { #Education Mission to USA rahhhhhhhhhh
	id = qing.208
	title = qing.208.t 
	desc = qing.208.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.208.a
		hidden_effect = {
			country_event = {id = qing.209 days = 305}
		}
	}
}

country_event = { #Education Mission to USA rahhhhhhhhhh 2
	id = qing.209
	title = qing.209.t 
	desc = qing.209.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.209.a
		hidden_effect = {
		country_event = {id = qing.210 days = 1096}
		}
	}
}

country_event = { #Education Mission to USA rahhhhhhhhhh 3
	id = qing.210
	title = qing.210.t 
	desc = qing.210.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.210.a
		hidden_effect = {
		country_event = {id = qing.211 days = 2170}
		}
	}
}

country_event = { #Education Mission to USA rahhhhhhhhhh 4
	id = qing.211
	title = qing.211.t 
	desc = qing.211.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.211.a
		country_event = {id = qing.212 days = 208}
	}
}

country_event = { #Education Mission to USA rahhhhhhhhhh 5
	id = qing.212
	title = qing.212.t 
	desc = qing.212.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.212.a
		#recruit_character = QNG_advisor_zhan_tianyou  ### Must be done within the history file with a blank character file, then add roles in an event like this one
		#recruit_character = QNG_cai_tinggan
		#recruit_character = QNG_liang_cheng
		add_ideas = { id = QNG_idea_perks_of_the_education_mission_to_USA days = 1825}
	}
}

country_event = { #Dealing with Prince Gong 
	id = qing.213
	title = qing.213.t 
	desc = qing.213.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 

	option = { #Spare Prince Gong 
		name = qing.213.a 
		add_political_power = -250
		add_stability = -0.2
	}
 
	option = { #Assassinate Prince Gong 
		name = qing.213.b 
		hidden_effect = {   
			country_event = {id = qing.214 days = 10}
		}
	}

	option = { #Reconcile with Prince Gong 
		name = qing.213.c
		add_political_power = -350
		add_stability = -0.1
	}
}

country_Event = { #Prince Gong assassination 
	id = qing.214
	title = qing.214.t 
	desc = qing.214.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.214.a #nice 
		retire_character = QNG_advisor_prince_gong
	}
}

country_Event = { #Fate of Sushun 
	id = qing.215
	title = qing.215.t 
	desc = qing.215.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.215.a #execution rahhhhhhhhhhh
		retire_character = QNG_advisor_shushun
		add_political_power = 100
	}

	option = {
		name = qing.215.b #Exile them 
		retire_character = QNG_advisor_shushun
		add_stability = 0.05
	}
}

country_Event = { #Fate of Empress Dowagers
	id = qing.216
	title = qing.216.t 
	desc = qing.216.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.216.a #execution rahhhhhhhhhhh
		retire_character = QNG_advisor_cixi 
		add_political_power = 100
	}

	option = {
		name = qing.215.a #Exile them execution 
		retire_character = QNG_advisor_cixi 
		add_stability = 0.05
	}
}

country_Event = { #Tongzhi's marriage 1
	id = qing.217
	title = qing.217.t 
	desc = qing.217.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.217.a #lets get it started 
		country_event = {id = qing.218 days = 0}
	}
}

country_Event = { #Tongzhi's marriage 2 
	id = qing.218
	title = qing.218.t 
	desc = qing.218.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.218.a #lets pick Lady Arute 
		if={
			limit={
				has_country_flag =  QNG_tongzhi_child_cixi_flag 
			}
			hidden_effect = {
					country_event = {id = qing.219 days = 1}
			}
		}

		else={
			set_country_flag = QNG_empress_xiaozheyi_flag
			country_event = {id = qing.221 days = 10}
		}
	}

	option = {
		name = qing.218.b #we will pick Lady Fuca 
		if={
			limit={
				has_country_flag =  QNG_tongzhi_child_cixi_flag 
			}
			hidden_effect = {
					country_event = {id = qing.220 days = 1}
			}
		}

		else={
			set_country_flag = QNG_empress_shushen_flag
			country_event = {id = qing.221 days = 10}
		}
	}
}

country_Event = { #Tongzhi's marriage 3 Cixi opposition 
	id = qing.219
	title = qing.219.t 
	desc = qing.219.d 

	#picture = 
	is_triggered_only = yes 

	option = {
		name = qing.219.a #Our decision to pick Lady Arute will still stand 
		add_political_power = -150
		set_country_flag = QNG_empress_xiaozheyi_flag
		country_event = {id = qing.221 days = 10}
		ai_chance = {
			factor = 0
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}
	}

	option = {
		name = qing.219.b #fine we will pick Lady Fuca 
		hidden_effect = {
			country_event = {id = qing.220 days = 1}
		}
	}
}

country_Event = { #Tongzhi's marriage 4 Ci'an opposition 
	id = qing.220
	title = qing.220.t 
	desc = qing.220.d 

	#picture = 
	is_triggered_only = yes 

	option = {
		name = qing.220.a #Our decision to pick Lady fuca will still stand 
		add_political_power = -100
		set_country_flag = QNG_empress_shushen_flag
		country_event = {id = qing.221 days = 10}
	}

	option = {
		name = qing.220.b #fine we will pick Lady Arute 
		hidden_effect = {
			country_event = {id = qing.219 days = 1}
		}
	}
}



country_Event = { #Tongzhi's marriage 5
	id = qing.221
	title = qing.221.t 
    desc = {
        text = qing.221.arute 
        trigger = {
            has_country_flag = QNG_empress_xiaozheyi_flag
        }
    }
    desc = {
        text = qing.221.fuca
        trigger = {
            has_country_flag = QNG_empress_shushen_flag
        }
    }

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.221.a #perfect 
	}
}

country_Event = { #Tongzhi taking the reigns of power 
	id = qing.222
	title = qing.222.t 
	desc = qing.222.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.222.a #lets go!!
		set_country_flag = QNG_tongzhi_flag 
		clr_country_flag = QNG_tongzhi_child_cixi_flag
		clr_country_flag = QNG_tongzhi_child_gong_flag
		clr_country_flag = QNG_tongzhi_child_sushun_flag
		mark_focus_tree_layout_dirty = yes 
	}
}

country_Event = { #Tongzhi restores the summer palace plan backfires 
	id = qing.223
	title = qing.223.t 
	desc = qing.223.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.223.a #bruh 
		add_ideas = QNG_heavy_opposition
	}
}

country_Event = { #intervention from cixi/sushun/prince gong 
	id = qing.224
	title = {text = qing.224.gong
        trigger = {
            has_completed_focus = QNG_focus_reformer_behind_the_scenes
        }
    }
	title = {text = qing.224.cixi
        trigger = {
            has_completed_focus = QNG_focus_power_empress_dowager
        }
    }
	title = {text = qing.224.sushun 
		trigger = {
             has_completed_focus = QNG_focus_assist_tongzhi_reign
        }
    }
    desc = {
        text = qing.224.gong 
        trigger = {
             has_completed_focus = QNG_focus_reformer_behind_the_scenes
        }
    }
    desc = {
        text = qing.224.cixi
        trigger = {
            has_completed_focus = QNG_focus_power_empress_dowager
        }
    }
	desc = {
        text = qing.224.sushun 
        trigger = {
            has_completed_focus = QNG_focus_assist_tongzhi_reign
        }
    }

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.224.a #fine... we will back down 
		add_stability = -0.05
	}
}

country_Event = { #Tongzhi dies 
	id = qing.225
	title = qing.225.t 
	desc = qing.225.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.223.a #what now?
		clr_country_flag = QNG_tongzhi_flag
		set_country_flag = QNG_tongzhi_dead_flag
		mark_focus_tree_layout_dirty = yes 
	}
}

country_Event = { #Guangxu chosen as new emperor 
	id = qing.226
	title = qing.226.t 
	desc = qing.226.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.226.a #alright 
		set_country_flag = QNG_guangxu_child_flag
		mark_focus_tree_layout_dirty = yes 
	}
}

country_Event = { #Guangxu comes of age 
	id = qing.227
	title = qing.227.t 
	desc = qing.227.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 

	option = {
		name = qing.227.a #alright, we will extend the regency by 2 years 
		add_political_power = 75
	}

	option = {
		name = qing.227.b #there's no point extending the regency, guangxu can rule after his marriage 
		set_country_flag = QNG_early_guangxu_rule_flag
	}
}

country_Event = { #Guangxu takes power 
	id = qing.228
	title = qing.228.t 
	desc = qing.228.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.226.a #alright 
		clr_country_flag = QNG_guangxu_child_flag
		clr_country_flag = QNG_tongzhi_dead_flag
		set_country_flag = QNG_guangxu_flag 
		mark_focus_tree_layout_dirty = yes 
	}
}

country_Event = { #death of prince yixuan  
	id = qing.229
	title = qing.229.t 
	desc = qing.229.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.229.a #sad 
		set_country_flag = QNG_prince_yixuan_died_flag
		retire_character = QNG_yixuan_prince_chun
	}
}

country_Event = { #western diplomats pressure us to deal with anti-christian chinese 
	id = qing.230
	title = qing.230.t 
	desc = qing.230.d 

	#picture = 
	is_triggered_only = yes 

	fire_only_once = yes 
	option = {
		name = qing.230.a #we will deal with them 
		set_country_flag = QNG_guangxu_defend_christians_flag
	}
}

country_Event = { #Northern Famine starts 
	id = qing.240
	title = qing.240.t 
	desc = qing.240.d 

	#picture = 
	is_triggered_only = yes 

	option = {
		name = qing.240.a #bruh 
		add_political_power = -100
		set_country_flag = QNG_northern_famine_flag
		mark_focus_tree_layout_dirty = yes 
		add_ideas = {QNG_mac_northern_famine}
		607={add_dynamic_modifier = { modifier = terrible_famine }}
		598={add_dynamic_modifier = { modifier = terrible_famine }}
		597={add_dynamic_modifier = { modifier = terrible_famine }}
		615={add_dynamic_modifier = { modifier = terrible_famine }}
		#southern hebei
		614={add_dynamic_modifier = { modifier = terrible_famine }}
		1151={add_dynamic_modifier = { modifier = terrible_famine }}
		hidden_effect = {
			country_event = {id = qing.241 days = 1460}
		}
		
	}
}

country_Event = { #Northern Famine ends 
	id = qing.241
	title = qing.241.t 
	desc = qing.241.d 

	#picture = 
	is_triggered_only = yes 

	option = {
		name = qing.241.a #finally 
		remove_ideas = {QNG_mac_northern_famine_4}
		add_timed_idea = {idea = QNG_mac_northern_famine_5 days = 450}
		clr_country_flag = QNG_northern_famine_flag
		mark_focus_tree_layout_dirty = yes 
	}
}

country_event = { # chinese concession of Incheon
    id = qing.242
    title = qing.242.t 
    desc = qing.242.d 

    #picture = 
    is_triggered_only = yes 

    option = {
        name = qing.242.a # agree 
        1019 = {
            add_dynamic_modifier = { 
                modifier = chinese_concession_of_incheon 
            }
        }
    }

    option = {
        name = qing.242.b # outrageous!
        QNG = {
            country_event = { id = qing.243 days = 0 }
            set_country_flag = QNG_joseon_declines_incheon_flag
        }
    }
}

country_event = { # chinese concession of Incheon reply 
	id = qing.243
    is_triggered_only = yes 
    fire_only_once = yes 

    title = { 
        text = qing.243.t.yes
        trigger = { 
            NOT = { has_country_flag = QNG_joseon_declines_incheon_flag } 
        }
    }
    title = { 
        text = qing.243.t.no
        trigger = { 
            has_country_flag = QNG_joseon_declines_incheon_flag 
        }
    }    
    
    desc = { 
        text = qing.243.d.yes
        trigger = { 
            NOT = { has_country_flag = QNG_joseon_declines_incheon_flag } 
        }
    }
    desc = { 
        text = qing.243.d.no
        trigger = { 
            has_country_flag = QNG_joseon_declines_incheon_flag 
        }
    }

    #picture = 

    option = { 
        name = qing.243.a # nice 
        add_political_power = 75
        trigger = { 
            NOT = { has_country_flag = QNG_joseon_declines_incheon_flag } 
        }
    }
    option = { 
        name = qing.243.b # outrageous 
        add_political_power = -75
        trigger = { 
            has_country_flag = QNG_joseon_declines_incheon_flag 
        }
    } 
}	

country_event = { # chinese-korea treaty of 1882
	id = qing.244
	title = qing.244.t 
	desc = qing.244.d 

	#picture = 
	is_triggered_only = yes 

	option = {
		name = qing.244.a # agree 
		set_country_flag = QNG_1882_accepted_flag
		QNG = {
			set_autonomy = {
				target = KOR
				autonomous_state = autonomy_dominion
				freedom_level = 0.79
			}
			country_event = { id = qing.245 days = 0 }
		}
	}

	option = {
		name = qing.244.b # outrageous!
		QNG = {
			country_event = { id = qing.245 days = 0 }
			set_country_flag = QNG_1882_declined_flag
		}
	}
}

country_event = { 
    id = qing.245
    is_triggered_only = yes 
    fire_only_once = yes 

    title = { 
        trigger = { NOT = { has_country_flag = QNG_1882_declined_flag } } 
        text = qing.245.t.yes 
    }
    title = { 
        trigger = { has_country_flag = QNG_1882_declined_flag } 
        text = qing.245.t.no 
    }    
    
    desc = { 
        trigger = { NOT = { has_country_flag = QNG_1882_declined_flag } } 
        text = qing.245.d.yes 
    }
    desc = { 
        trigger = { has_country_flag = QNG_1882_declined_flag } 
        text = qing.245.d.no 
    }

    #picture = 

    option = { 
        name = qing.245.a #nice 
        add_political_power = 75 
        trigger = { NOT = { has_country_flag = QNG_1882_declined_flag } } 
    }
    option = { 
        name = qing.245.b #outrageous 
        add_political_power = -75 
        trigger = { has_country_flag = QNG_1882_declined_flag } 
    } 
}