#namespace = flag_province_p_event
#province_event = {
#	id = flag_province_p_event.250001
#	desc = flag_province_p_event.250001.desc
#	picture = "GFX_evt_garden"
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		location = {
#			set_province_flag = keep_it
#			add_province_modifier = { name = "keep_it" duration = -1 }
#		}
#	}
#	
#	option = {
#		name = flag_province_p_event.250001.opta
#		ai_chance = { factor = 0 }
#	}
#}
#
#namespace = unflag_province_p_event
#province_event = {
#	id = unflag_province_p_event.250001
#	desc = unflag_province_p_event.250001.desc
#	picture = "GFX_evt_carriage"
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		location = {
#			clr_province_flag = keep_it
#			remove_province_modifier = keep_it
#		}
#	}
#	
#	option = {
#		name = unflag_province_p_event.250001.opta
#		ai_chance = { factor = 0 }
#	}
#}
#
#namespace = flag_province_marshal
#province_event = {
#	id = flag_province_marshal.250001
#	desc = flag_province_marshal.250001.desc
#	picture = "GFX_evt_garden"
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		random_vassal = {
#			limit = { has_job_title = job_marshal }
#			location = {
#				set_province_flag = keep_it
#				add_province_modifier = { name = "keep_it" duration = -1 }
#			}
#		}
#		random_courtier  = {
#			limit = { has_job_title = job_marshal }
#			location = {
#				set_province_flag = keep_it
#				add_province_modifier = { name = "keep_it" duration = -1 }
#			}
#		}
#	}
#	
#	option = {
#		name = flag_province_marshal.250001.opta
#		ai_chance = { factor = 0 }
#	}
#}
#
#namespace = unflag_province_marshal
#province_event = {
#	id = unflag_province_marshal.250001
#	desc = unflag_province_marshal.250001.desc
#	picture = "GFX_evt_carriage"
#	
#	is_triggered_only = yes
#	
#	immediate = {
#		random_vassal = {
#			limit = { has_job_title = job_marshal }
#			location = {
#				clr_province_flag = keep_it
#				remove_province_modifier = keep_it
#			}
#		}
#		random_courtier  = {
#			limit = { has_job_title = job_marshal }
#			location = {
#				clr_province_flag = keep_it
#				remove_province_modifier = keep_it
#			}
#		}
#	}
#	
#	option = {
#		name = unflag_province_marshal.250001.opta
#		ai_chance = { factor = 0 }
#	}
#}

namespace = vassalize_all
character_event = {
	id = vassalize_all.250001
	desc = vassalize_all.250001.desc
	picture = "GFX_evt_council"
	
	is_triggered_only = yes
	
	immediate = {
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						NOT = { tier = count }
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_title = {
						limit = {
							OR = {
								AND = {
									is_feudal = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_republic = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
								AND = {
									is_feudal = no
									is_theocracy = yes
									tier = baron
									NOT = { tier = count }
									is_capital = no
								}
							}
						}
						grant_title = PREVPREV
					}
				}
			}
		}
		########## Start of Counties
		if = {
			limit = {
				any_demesne_province = {
					NOT = { has_province_flag = keep_it }
				}
				any_demesne_province = {
					has_province_flag = keep_it
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_province = {
						limit = {
							NOT = {	has_province_flag = keep_it }
						}
						county = {
							grant_title = PREVPREVPREV
						}
					}
				}
			}
		}
		if = {
			limit = {
				any_demesne_province = {
					NOT = { has_province_flag = keep_it }
				}
				any_demesne_province = {
					has_province_flag = keep_it
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_province = {
						limit = {
							NOT = {	has_province_flag = keep_it }
						}
						county = {
							grant_title = PREVPREVPREV
						}
					}
				}
			}
		}
		if = {
			limit = {
				any_demesne_province = {
					NOT = { has_province_flag = keep_it }
				}
				any_demesne_province = {
					has_province_flag = keep_it
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_province = {
						limit = {
							NOT = {	has_province_flag = keep_it }
						}
						county = {
							grant_title = PREVPREVPREV
						}
					}
				}
			}
		}
		if = {
			limit = {
				any_demesne_province = {
					NOT = { has_province_flag = keep_it }
				}
				any_demesne_province = {
					has_province_flag = keep_it
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_province = {
						limit = {
							NOT = {	has_province_flag = keep_it }
						}
						county = {
							grant_title = PREVPREVPREV
						}
					}
				}
			}
		}
		if = {
			limit = {
				any_demesne_province = {
					NOT = { has_province_flag = keep_it }
				}
				any_demesne_province = {
					has_province_flag = keep_it
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_province = {
						limit = {
							NOT = {	has_province_flag = keep_it }
						}
						county = {
							grant_title = PREVPREVPREV
						}
					}
				}
			}
		}
		if = {
			limit = {
				any_demesne_province = {
					NOT = { has_province_flag = keep_it }
				}
				any_demesne_province = {
					has_province_flag = keep_it
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_province = {
						limit = {
							NOT = {	has_province_flag = keep_it }
						}
						county = {
							grant_title = PREVPREVPREV
						}
					}
				}
			}
		}
		if = {
			limit = {
				any_demesne_province = {
					NOT = { has_province_flag = keep_it }
				}
				any_demesne_province = {
					has_province_flag = keep_it
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_province = {
						limit = {
							NOT = {	has_province_flag = keep_it }
						}
						county = {
							grant_title = PREVPREVPREV
						}
					}
				}
			}
		}
		if = {
			limit = {
				any_demesne_province = {
					NOT = { has_province_flag = keep_it }
				}
				any_demesne_province = {
					has_province_flag = keep_it
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_province = {
						limit = {
							NOT = {	has_province_flag = keep_it }
						}
						county = {
							grant_title = PREVPREVPREV
						}
					}
				}
			}
		}
		if = {
			limit = {
				any_demesne_province = {
					NOT = { has_province_flag = keep_it }
				}
				any_demesne_province = {
					has_province_flag = keep_it
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_province = {
						limit = {
							NOT = {	has_province_flag = keep_it }
						}
						county = {
							grant_title = PREVPREVPREV
						}
					}
				}
			}
		}
		if = {
			limit = {
				any_demesne_province = {
					NOT = { has_province_flag = keep_it }
				}
				any_demesne_province = {
					has_province_flag = keep_it
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_republic = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = no
						is_theocracy = yes
						tier = baron
						is_capital = no
					}
				}
				NOT = {
					any_demesne_title = {
						is_feudal = yes
						tier = baron
						is_capital = no
					}
				}
			}
			create_character = {
				random_traits = yes
				dynasty = random
				female = no
				religion = ROOT
				culture = ROOT
			}
			new_character = {
				set_defacto_liege = ROOT 
				remove_trait = ambitious
				liege = {
					random_demesne_province = {
						limit = {
							NOT = {	has_province_flag = keep_it }
						}
						county = {
							grant_title = PREVPREVPREV
						}
					}
				}
			}
		}
	}
	
	option = {
		name = vassalize_all.250001.opta
	}
}