namespace = Plus

########################################
# Mod-Specific Crusade Events
#
# reserved: Plus.400 to Plus.429
#
# Written by Rylock
########################################

# Who to give crusade land to
character_event = {
	id = Plus.400
	desc = EVTDESC_Plus_400
	picture = GFX_evt_crusaders
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA_Plus_400" #To my son
		ai_chance = {
			factor = 100
		}
		trigger = {
			OR = {
				ai = no
				NOT = { religion_group = muslim }
			}
			any_child = {
				is_alive = yes
				is_adult = yes
				prisoner = no
				is_ruler = no
				is_female = no
				religion = ROOT
				is_liege_or_above = ROOT
				health = 4.0
				NOR = {
					trait = incapable
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
		}
		prestige = 500
		random_child = {
			limit = {
				is_alive = yes
				is_adult = yes
				prisoner = no
				is_ruler = no
				is_female = no
				religion = ROOT
				is_liege_or_above = ROOT
				health = 4.0
				NOR = {
					trait = incapable
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
			add_character_modifier = { name = new_land_timer duration = 1 hidden = yes }
			tooltip = {
				character_event = { id = Plus.400 tooltip = CUSTOMTOOLTIP3 }
			}
			custom_tooltip = { text = HOLYTRUCETOOLTIP }
			hidden_tooltip = {
				set_character_flag = centralize_without_penalties
				if = {
					limit = { religion_group = christian }
					add_trait = crusader
				}
				if = {
					limit = { religion_group = muslim }
					add_trait = mujahid
				}
				if = {
					limit = {
						NOR = {
							religion_group = christian
							religion_group = muslim
						}
					}
					add_trait = holy_crusader
				}
				event_target:current_title = {
					ROOT = {
						random_demesne_title = {
							limit = {
								OR = {
									tier = COUNT
									tier = BARON
								}
								NOT = { has_title_flag = previous_holding }
							}
							if = {
								limit = {
									kingdom = { title = k_byzantium }
									ROOT = { religion = catholic }
									e_latin_empire = { has_holder = no }
								}
								e_latin_empire = {
									gain_title = PREVPREVPREVPREV
									copy_title_laws = PREVPREVPREV
									add_law = crown_authority_3
								}
							}
							if = {
								limit = {
									kingdom = { title = k_nikaea }
									ROOT = { religion_group = muslim }
									k_rum = { has_holder = no }
								}
								k_rum = {
									gain_title = PREVPREVPREVPREV
									copy_title_laws = PREVPREVPREV
									add_law = crown_authority_3
								}
							}
							kingdom = {
								destroy_landed_title = yes
								gain_title = PREVPREVPREVPREV
								copy_title_laws = PREVPREVPREV
								add_law = crown_authority_3
							}
						}
						any_demesne_title = {
							limit = { NOT = { has_title_flag = previous_holding } }
							gain_title = PREVPREVPREV
						}
					}
				}
				if = {
					limit = { is_feudal = no }
					switch_to_feudal_effect = yes
				}
				wealth = 500
				prestige = 500
				piety = 100
				add_character_modifier = { name = "holy_truce_timer" duration = 3650 }
				set_character_flag = move_capital
				hidden_tooltip = { character_event = { id = Plus.402 } }
				clr_character_flag = centralize_without_penalties
				set_defacto_liege = THIS
				pf_liege_change_effect = yes
			}
		}
		hidden_tooltip = {
			any_demesne_title = { clr_title_flag = previous_holding }
			any_vassal = { clr_character_flag = previous_vassal }
		}
	}
	option = {
		name = "EVTOPTE_Plus_400" #To my brother
		ai_chance = {
			factor = 100
		}
		trigger = {
			OR = {
				ai = no
				NOT = { religion_group = muslim }
			}
			any_sibling = {
				is_adult = yes
				prisoner = no
				is_ruler = no
				is_female = no
				religion = ROOT
				is_liege_or_above = ROOT
				is_alive = yes
				health = 4.0
				NOR = {
					trait = incapable
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOR = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
		}
		prestige = 500
		random_sibling = {
			limit = {
				is_adult = yes
				prisoner = no
				is_ruler = no
				is_female = no
				religion = ROOT
				is_liege_or_above = ROOT
				is_alive = yes
				health = 4.0
				NOR = {
					trait = incapable
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 45 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
			add_character_modifier = { name = new_land_timer duration = 1 hidden = yes }
			tooltip = {
				character_event = { id = Plus.400 tooltip = CUSTOMTOOLTIP3 }
			}
			custom_tooltip = { text = HOLYTRUCETOOLTIP }
			hidden_tooltip = {
				set_character_flag = centralize_without_penalties
				if = {
					limit = { religion_group = christian }
					add_trait = crusader
				}
				if = {
					limit = { religion_group = muslim }
					add_trait = mujahid
				}
				if = {
					limit = {
						NOR = {
							religion_group = christian
							religion_group = muslim
						}
					}
					add_trait = holy_crusader
				}
				event_target:current_title = {
					ROOT = {
						random_demesne_title = {
							limit = {
								OR = {
									tier = COUNT
									tier = BARON
								}
								NOT = { has_title_flag = previous_holding }
							}
							if = {
								limit = {
									kingdom = { title = k_byzantium }
									ROOT = { religion = catholic }
									e_latin_empire = { has_holder = no }
								}
								e_latin_empire = {
									gain_title = PREVPREVPREVPREV
									copy_title_laws = PREVPREVPREV
									add_law = crown_authority_3
								}
							}
							if = {
								limit = {
									kingdom = { title = k_nikaea }
									ROOT = { religion_group = muslim }
									k_rum = { has_holder = no }
								}
								k_rum = {
									gain_title = PREVPREVPREVPREV
									copy_title_laws = PREVPREVPREV
									add_law = crown_authority_3
								}
							}
							kingdom = {
								destroy_landed_title = yes
								gain_title = PREVPREVPREVPREV
								copy_title_laws = PREVPREVPREV
								add_law = crown_authority_3
							}
						}
						any_demesne_title = {
							limit = { NOT = { has_title_flag = previous_holding } }
							gain_title = PREVPREVPREV
						}
					}
				}
				if = {
					limit = { is_feudal = no }
					switch_to_feudal_effect = yes
				}
				wealth = 500
				prestige = 500
				piety = 100
				add_character_modifier = { name = "holy_truce_timer" duration = 3650 }
				set_character_flag = move_capital
				hidden_tooltip = { character_event = { id = Plus.402 } }
				clr_character_flag = centralize_without_penalties
				set_defacto_liege = THIS
				pf_liege_change_effect = yes
			}

		}
		hidden_tooltip = {
			any_demesne_title = { clr_title_flag = previous_holding }
			any_vassal = { clr_character_flag = previous_vassal }
		}
	}
	option = {
		name = "EVTOPTC_Plus_400" #To a capable relative
		ai_chance = {
			factor = 10
		}
		trigger = {
			OR = {
				ai = no
				NOT = { religion_group = muslim }
			}
			any_dynasty_member = {
				is_adult = yes
				prisoner = no
				piety = 0
				is_ruler = no
				is_female = no
				religion = ROOT
				is_close_relative = ROOT
				is_liege_or_above = ROOT
				is_alive = yes
				health = 4.0
				reverse_opinion = { who = ROOT value = 0 }
				NOR = {
					is_child_of = ROOT
					sibling = ROOT
					trait = incapable
					trait = lunatic
					trait = imbecile
					trait = inbred
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
		}
		prestige = 500
		random_dynasty_member = {
			limit = {
				is_adult = yes
				prisoner = no
				piety = 0
				is_ruler = no
				is_female = no
				religion = ROOT
				is_close_relative = ROOT
				is_liege_or_above = ROOT
				is_alive = yes
				health = 4.0
				reverse_opinion = { who = ROOT value = 0 }
				NOR = {
					is_child_of = ROOT
					sibling = ROOT
					trait = incapable
					trait = lunatic
					trait = imbecile
					trait = inbred
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
			add_character_modifier = { name = new_land_timer duration = 1 hidden = yes }
			tooltip = {
				character_event = { id = Plus.400 tooltip = CUSTOMTOOLTIP3 }
			}
			custom_tooltip = { text = HOLYTRUCETOOLTIP }
			hidden_tooltip = {
				set_character_flag = centralize_without_penalties
				if = {
					limit = { religion_group = christian }
					add_trait = crusader
				}
				if = {
					limit = { religion_group = muslim }
					add_trait = mujahid
				}
				if = {
					limit = {
						NOR = {
							religion_group = christian
							religion_group = muslim
						}
					}
					add_trait = holy_crusader
				}
				event_target:current_title = {
					ROOT = {
						random_demesne_title = {
							limit = {
								OR = {
									tier = COUNT
									tier = BARON
								}
								NOT = { has_title_flag = previous_holding }
							}
							if = {
								limit = {
									kingdom = { title = k_byzantium }
									ROOT = { religion = catholic }
									e_latin_empire = { has_holder = no }
								}
								e_latin_empire = {
									gain_title = PREVPREVPREVPREV
									copy_title_laws = PREVPREVPREV
									add_law = crown_authority_3
								}
							}
							if = {
								limit = {
									kingdom = { title = k_nikaea }
									ROOT = { religion_group = muslim }
									k_rum = { has_holder = no }
								}
								k_rum = {
									gain_title = PREVPREVPREVPREV
									copy_title_laws = PREVPREVPREV
									add_law = crown_authority_3
								}
							}
							kingdom = {
								destroy_landed_title = yes
								gain_title = PREVPREVPREVPREV
								copy_title_laws = PREVPREVPREV
								add_law = crown_authority_3
							}
						}
						any_demesne_title = {
							limit = { NOT = { has_title_flag = previous_holding } }
							gain_title = PREVPREVPREV
						}
					}
				}
				if = {
					limit = { is_feudal = no }
					switch_to_feudal_effect = yes
				}
				wealth = 500
				prestige = 500
				piety = 100
				add_character_modifier = { name = "holy_truce_timer" duration = 3650 }
				set_character_flag = move_capital
				hidden_tooltip = { character_event = { id = Plus.402 } }
				clr_character_flag = centralize_without_penalties
				set_defacto_liege = THIS
				pf_liege_change_effect = yes
			}
		}
		hidden_tooltip = {
			any_demesne_title = { clr_title_flag = previous_holding }
			any_vassal = { clr_character_flag = previous_vassal }
		}
	}
	option = {
		name = "EVTOPTC_Plus_400" #To a capable relative
		ai_chance = {
			factor = 10
		}
		trigger = {
			OR = {
				ai = no
				NOT = { religion_group = muslim }
			}
			any_dynasty_member = {
				is_adult = yes
				prisoner = no
				piety = 0
				is_ruler = no
				is_female = no
				religion = ROOT
				is_liege_or_above = ROOT
				is_alive = yes
				health = 4.0
				reverse_opinion = { who = ROOT value = 0 }
				OR = {
					is_friend = ROOT
					is_smart_trigger = yes
					diplomacy = 10
					martial = 10
				}
				NOR = {
					is_child_of = ROOT
					sibling = ROOT
					trait = incapable
					trait = lunatic
					trait = imbecile
					trait = inbred
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
			NOT = {
				any_dynasty_member = {
					is_adult = yes
					prisoner = no
					piety = 0
					is_ruler = no
					is_female = no
					religion = ROOT
					is_close_relative = ROOT
					is_liege_or_above = ROOT
					is_alive = yes
					health = 4.0
					reverse_opinion = { who = ROOT value = 0 }
					NOR = {
						is_child_of = ROOT
						sibling = ROOT
						trait = incapable
						trait = lunatic
						trait = imbecile
						trait = inbred
						any_spouse = { is_ruler = yes }
						any_heir_title = {
							is_primary_holder_title = yes
							holder_scope = { character = ROOT }
						}
					}
					OR = {
						NOT = { age = 30 }
						any_child = {
							is_alive = yes
							is_female = no
							is_ruler = no
							NOT = {
								any_heir_title = {
									is_primary_holder_title = yes
									holder_scope = { character = ROOT }
								}
							}
						}
					}
				}
			}
		}
		prestige = 500
		random_dynasty_member = {
			limit = {
				is_adult = yes
				prisoner = no
				piety = 0
				is_ruler = no
				is_female = no
				religion = ROOT
				is_liege_or_above = ROOT
				is_alive = yes
				health = 4.0
				reverse_opinion = { who = ROOT value = 0 }
				OR = {
					is_friend = ROOT
					is_smart_trigger = yes
					diplomacy = 10
					martial = 10
				}
				NOR = {
					is_child_of = ROOT
					sibling = ROOT
					trait = incapable
					trait = lunatic
					trait = imbecile
					trait = inbred
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
			add_character_modifier = { name = new_land_timer duration = 1 hidden = yes }
			tooltip = {
				character_event = { id = Plus.400 tooltip = CUSTOMTOOLTIP3 }
			}
			custom_tooltip = { text = HOLYTRUCETOOLTIP }
			hidden_tooltip = {
				set_character_flag = centralize_without_penalties
				if = {
					limit = { religion_group = christian }
					add_trait = crusader
				}
				if = {
					limit = { religion_group = muslim }
					add_trait = mujahid
				}
				if = {
					limit = {
						NOR = {
							religion_group = christian
							religion_group = muslim
						}
					}
					add_trait = holy_crusader
				}
				event_target:current_title = {
					ROOT = {
						random_demesne_title = {
							limit = {
								OR = {
									tier = COUNT
									tier = BARON
								}
								NOT = { has_title_flag = previous_holding }
							}
							if = {
								limit = {
									kingdom = { title = k_byzantium }
									ROOT = { religion = catholic }
									e_latin_empire = { has_holder = no }
								}
								e_latin_empire = {
									gain_title = PREVPREVPREVPREV
									copy_title_laws = PREVPREVPREV
									add_law = crown_authority_3
								}
							}
							if = {
								limit = {
									kingdom = { title = k_nikaea }
									ROOT = { religion_group = muslim }
									k_rum = { has_holder = no }
								}
								k_rum = {
									gain_title = PREVPREVPREVPREV
									copy_title_laws = PREVPREVPREV
									add_law = crown_authority_3
								}
							}
							kingdom = {
								destroy_landed_title = yes
								gain_title = PREVPREVPREVPREV
								copy_title_laws = PREVPREVPREV
								add_law = crown_authority_3
							}
						}
						any_demesne_title = {
							limit = { NOT = { has_title_flag = previous_holding } }
							gain_title = PREVPREVPREV
						}
					}
				}
				if = {
					limit = { is_feudal = no }
					switch_to_feudal_effect = yes
				}
				wealth = 500
				prestige = 500
				piety = 100
				add_character_modifier = { name = "holy_truce_timer" duration = 3650 }
				set_character_flag = move_capital
				hidden_tooltip = { character_event = { id = Plus.402 } }
				clr_character_flag = centralize_without_penalties
				set_defacto_liege = THIS
				pf_liege_change_effect = yes
			}
		}
		hidden_tooltip = {
			any_demesne_title = { clr_title_flag = previous_holding }
			any_vassal = { clr_character_flag = previous_vassal }
		}
	}
	option = {
		name = "EVTOPTF_Plus_400" #To a valiant retainer
		ai_chance = {
			factor = 1
		}
		trigger = {
			OR = {
				ai = no
				NOT = { religion_group = muslim }
			}
			OR = {
				NOT = {
					any_dynasty_member = {
						is_adult = yes
						prisoner = no
						piety = 0
						is_ruler = no
						is_female = no
						religion = ROOT
						is_liege_or_above = ROOT
						is_alive = yes
						health = 4.0
						reverse_opinion = { who = ROOT value = 0 }
						OR = {
							is_close_relative = ROOT
							is_friend = ROOT
							is_smart_trigger = yes
							diplomacy = 10
							martial = 10
						}
						NOR = {
							age = 45
							is_child_of = ROOT
							sibling = ROOT
							trait = incapable
							trait = lunatic
							trait = imbecile
							trait = inbred
							any_spouse = { is_ruler = yes }
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
				NOT = {
					any_sibling = {
						is_adult = yes
						prisoner = no
						is_ruler = no
						is_female = no
						religion = ROOT
						is_liege_or_above = ROOT
						is_alive = yes
						health = 4.0
						NOR = {
							trait = incapable
							any_spouse = { is_ruler = yes }
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
						OR = {
							NOT = { age = 30 }
							any_child = {
								is_alive = yes
								is_female = no
								is_ruler = no
								NOR = {
									any_heir_title = {
										is_primary_holder_title = yes
										holder_scope = { character = ROOT }
									}
								}
							}
						}
					}
				}
				NOT = {
					any_child = {
						is_alive = yes
						is_adult = yes
						prisoner = no
						is_ruler = no
						is_female = no
						religion = ROOT
						is_liege_or_above = ROOT
						health = 4.0
						NOR = {
							trait = incapable
							any_spouse = { is_ruler = yes }
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
						OR = {
							NOT = { age = 30 }
							any_child = {
								is_alive = yes
								is_female = no
								is_ruler = no
								NOT = {
									any_heir_title = {
										is_primary_holder_title = yes
										holder_scope = { character = ROOT }
									}
								}
							}
						}
					}
				}
			}
		}
		prestige = 500
		custom_tooltip = { text = CUSTOMTOOLTIP36 }
		hidden_tooltip = {
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ROOT
				female = no
				age = 25
				attributes = {
					martial = 10
					diplomacy = 10
				}
			}
			new_character = {
				add_character_modifier = { name = new_land_timer duration = 1 hidden = yes }
				tooltip = {
					character_event = { id = Plus.400 tooltip = CUSTOMTOOLTIP3 }
				}
				custom_tooltip = { text = HOLYTRUCETOOLTIP }
				hidden_tooltip = {
					set_character_flag = centralize_without_penalties
					if = {
						limit = { religion_group = christian }
						add_trait = crusader
					}
					if = {
						limit = { religion_group = muslim }
						add_trait = mujahid
					}
					if = {
						limit = {
							NOR = {
								religion_group = christian
								religion_group = muslim
							}
						}
						add_trait = holy_crusader
					}
					event_target:current_title = {
						ROOT = {
							random_demesne_title = {
								limit = {
									OR = {
										tier = COUNT
										tier = BARON
									}
									NOT = { has_title_flag = previous_holding }
								}
								if = {
									limit = {
										kingdom = { title = k_byzantium }
										ROOT = { religion = catholic }
										e_latin_empire = { has_holder = no }
									}
									e_latin_empire = {
										gain_title = PREVPREVPREVPREV
										copy_title_laws = PREVPREVPREV
										add_law = crown_authority_3
									}
								}
								if = {
									limit = {
										kingdom = { title = k_nikaea }
										ROOT = { religion_group = muslim }
										k_rum = { has_holder = no }
									}
									k_rum = {
										gain_title = PREVPREVPREVPREV
										copy_title_laws = PREVPREVPREV
										add_law = crown_authority_3
									}
								}
								kingdom = {
									destroy_landed_title = yes
									gain_title = PREVPREVPREVPREV
									copy_title_laws = PREVPREVPREV
									add_law = crown_authority_3
								}
							}
							any_demesne_title = {
								limit = { NOT = { has_title_flag = previous_holding } }
								gain_title = PREVPREVPREV
							}
						}
					}
					if = {
						limit = { is_feudal = no }
						switch_to_feudal_effect = yes
					}
					wealth = 500
					prestige = 500
					piety = 100
					add_character_modifier = { name = "holy_truce_timer" duration = 3650 }
					set_character_flag = move_capital
					hidden_tooltip = { character_event = { id = Plus.402 } }
					clr_character_flag = centralize_without_penalties
					set_defacto_liege = THIS
					pf_liege_change_effect = yes
				}
			}
		}
		hidden_tooltip = {
			any_demesne_title = { clr_title_flag = previous_holding }
			any_vassal = { clr_character_flag = previous_vassal }
		}
	}
	option = {
		name = "EVTOPTD_Plus_400" #To myself
		ai_chance = {
			factor = 100000
		}
		trigger = {
			OR = {
				ai = no
				independent = yes
				is_feudal = yes
			}
			OR = {
				ai = no
				AND = {
					independent = no
					lower_tier_than = king
				}
				any_demesne_title = {
					tier = COUNT
					NOT = { has_title_flag = previous_holding }
					location = {
						any_neighbor_province = {
							OR = {
								county = { has_title_flag = previous_holding }
								owner = { is_liege_or_above = ROOT }
							}
						}
					}
				}
			}
		}
		if = {
			limit = { independent = no }
			custom_tooltip = { text = CUSTOMTOOLTIP42 }
		}
		if = {
			limit = { independent = yes }
			custom_tooltip = { text = CUSTOMTOOLTIP43 }
		}
		wealth = 500
		custom_tooltip = { text = HOLYTRUCETOOLTIP }
		hidden_tooltip = {
			if = {
				limit = { independent = no }
				liege = {
					ROOT = {
						any_vassal = {
							limit = { has_character_flag = previous_vassal }
							clr_character_flag = previous_vassal
							set_defacto_liege = PREVPREV
							pf_liege_change_effect = yes
						}
						any_demesne_title = {
							limit = {
								is_titular = no
								is_landless_type_title = no
								has_title_flag = previous_holding
							}
							clr_title_flag = previous_holding
							gain_title = PREVPREV
						}
					}
				}
				set_character_flag = move_capital
				set_defacto_liege = ROOT
				pf_liege_change_effect = yes
			}
			add_character_modifier = { name = new_land_timer duration = 1 hidden = yes }
			set_character_flag = centralize_without_penalties
			if = {
				limit = { religion_group = christian }
				add_trait = crusader
			}
			if = {
				limit = { religion_group = muslim }
				add_trait = mujahid
			}
			if = {
				limit = {
					NOR = {
						religion_group = christian
						religion_group = muslim
					}
				}
				add_trait = holy_crusader
			}
			event_target:current_title = {
				ROOT = {
					random_demesne_title = {
						limit = {
							OR = {
								tier = COUNT
								tier = BARON
							}
							NOT = { has_title_flag = previous_holding }
						}
						if = {
							limit = {
								kingdom = { title = k_byzantium }
								ROOT = { religion = catholic }
								e_latin_empire = { has_holder = no }
							}
							e_latin_empire = {
								gain_title = PREVPREV
								copy_title_laws = PREVPREVPREV
								add_law = crown_authority_3
							}
						}
						if = {
							limit = {
								kingdom = { title = k_nikaea }
								ROOT = { religion_group = muslim }
								k_rum = { has_holder = no }
							}
							k_rum = {
								gain_title = PREVPREV
								copy_title_laws = PREVPREVPREV
								add_law = crown_authority_3
							}
						}
						kingdom = {
							destroy_landed_title = yes
							gain_title = PREVPREV
							copy_title_laws = PREVPREVPREV
							add_law = crown_authority_3
							if = {
								limit = { ROOT = { has_character_flag = move_capital } }
								capital_scope = {
									county = {
										ROOT = { capital = PREV }
									}
								}
							}
						}
					}
				}
			}
			add_character_modifier = { name = "crusade_block_timer" duration = 3650 }
			hidden_tooltip = { character_event = { id = Plus.402 } }
			clr_character_flag = centralize_without_penalties
			clr_character_flag = move_capital
		}
	}
}

# Crusade participant requests a fief for relative
character_event = {
	id = Plus.401
	desc = EVTDESC_Plus_401
	picture = GFX_evt_crusaders
	
	is_triggered_only = yes

	option = {
		name = "EVTOPTA_Plus_401" #Request a fief for my son
		ai_chance = {
			factor = 100
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = proud
			}
		}
		prestige = 50
		trigger = {
			any_child = {
				is_alive = yes
				is_adult = yes
				prisoner = no
				piety = 0
				is_ruler = no
				is_female = no
				religion = ROOT
				is_liege_or_above = ROOT
				health = 4.0
				NOR = {
					trait = incapable
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
		}
		random_child = {
			limit = {
				is_alive = yes
				is_adult = yes
				prisoner = no
				piety = 0
				is_ruler = no
				is_female = no
				religion = ROOT
				is_liege_or_above = ROOT
				health = 4.0
				NOR = {
					trait = incapable
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
			custom_tooltip = { text = CUSTOMTOOLTIP41 }
			opinion = { who = ROOT modifier = opinion_grateful years = 20 }
			add_character_modifier = { modifier = wants_crusade_fief_timer duration = 5 hidden = yes }
		}
	}
	option = {
		name = "EVTOPTB_Plus_401" #Request a fief for my brother
		ai_chance = {
			factor = 50
			modifier = {
				factor = 2
				trait = proud
			}
		}
		trigger = {
			any_sibling = {
				is_adult = yes
				prisoner = no
				piety = 0
				is_ruler = no
				is_female = no
				religion = ROOT
				is_liege_or_above = ROOT
				is_alive = yes
				health = 4.0
				reverse_opinion = { who = ROOT value = 0 }
				NOR = {
					trait = incapable
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
		}
		prestige = 50
		random_sibling = {
			limit = {
				is_adult = yes
				prisoner = no
				piety = 0
				is_ruler = no
				is_female = no
				religion = ROOT
				is_liege_or_above = ROOT
				is_alive = yes
				health = 4.0
				reverse_opinion = { who = ROOT value = 0 }
				NOR = {
					trait = incapable
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
			custom_tooltip = { text = CUSTOMTOOLTIP41 }
			opinion = { who = ROOT modifier = opinion_grateful years = 20 }
			add_character_modifier = { modifier = wants_crusade_fief_timer duration = 5 hidden = yes }
		}
	}
	option = {
		name = "EVTOPTC_Plus_401" #Request a fief for a relative
		ai_chance = {
			factor = 25
			modifier = {
				factor = 2
				trait = proud
			}
		}
		trigger = {
			any_realm_character = {
				dynasty = ROOT
				is_adult = yes
				prisoner = no
				piety = 0
				is_ruler = no
				is_female = no
				religion = ROOT
				is_liege_or_above = ROOT
				is_alive = yes
				health = 4.0
				reverse_opinion = { who = ROOT value = 0 }
				OR = {
					is_friend = ROOT
					is_smart_trigger = yes
					diplomacy = 12
					martial = 12
				}
				NOR = {
					is_child_of = ROOT
					sibling = ROOT
					trait = incapable
					trait = lunatic
					trait = imbecile
					trait = inbred
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
		}
		prestige = 25
		random_realm_character = {
			limit = {
				dynasty = ROOT
				is_adult = yes
				prisoner = no
				piety = 0
				is_ruler = no
				is_female = no
				religion = ROOT
				is_liege_or_above = ROOT
				is_alive = yes
				health = 4.0
				reverse_opinion = { who = ROOT value = 0 }
				OR = {
					is_friend = ROOT
					is_smart_trigger = yes
					diplomacy = 12
					martial = 12
				}
				NOR = {
					is_child_of = ROOT
					sibling = ROOT
					trait = incapable
					trait = lunatic
					trait = imbecile
					trait = inbred
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
			custom_tooltip = { text = CUSTOMTOOLTIP41 }
			opinion = { who = ROOT modifier = opinion_grateful years = 20 }
			add_character_modifier = { modifier = wants_crusade_fief_timer duration = 5 hidden = yes }
		}
	}
	option = {
		name = "EVTOPTF_Plus_400" #To a valiant retainer
		ai_chance = {
			factor = 5
		}
		trigger = {
			any_courtier = {
				OR = {
					trait = crusader
					trait = mujahid
					trait = holy_crusader
					is_friend = ROOT
				}
				is_adult = yes
				prisoner = no
				piety = 0
				is_ruler = no
				is_female = no
				religion = ROOT
				is_alive = yes
				health = 4.0
				reverse_opinion = { who = ROOT value = 0 }
				OR = {
					is_friend = ROOT
					is_smart_trigger = yes
					diplomacy = 12
					martial = 12
				}
				NOR = {
					is_child_of = ROOT
					sibling = ROOT
					trait = incapable
					trait = lunatic
					trait = imbecile
					trait = inbred
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
			NOT = {
				any_realm_character = {
					dynasty = ROOT
					is_adult = yes
					prisoner = no
					piety = 0
					is_ruler = no
					is_female = no
					religion = ROOT
					is_liege_or_above = ROOT
					is_alive = yes
					health = 4.0
					reverse_opinion = { who = ROOT value = 0 }
					OR = {
						is_friend = ROOT
						is_smart_trigger = yes
						diplomacy = 12
						martial = 12
					}
					NOR = {
						is_child_of = ROOT
						sibling = ROOT
						trait = incapable
						trait = lunatic
						trait = imbecile
						trait = inbred
						any_spouse = { is_ruler = yes }
						any_heir_title = {
							is_primary_holder_title = yes
							holder_scope = { character = ROOT }
						}
					}
					OR = {
						NOT = { age = 30 }
						any_child = {
							is_alive = yes
							is_female = no
							is_ruler = no
							NOT = {
								any_heir_title = {
									is_primary_holder_title = yes
									holder_scope = { character = ROOT }
								}
							}
						}
					}
				}
			}
		}
		prestige = 10
		random_courtier = {
			limit = {
				OR = {
					trait = crusader
					trait = mujahid
					trait = holy_crusader
					is_friend = ROOT
				}
				is_adult = yes
				prisoner = no
				piety = 0
				is_ruler = no
				is_female = no
				religion = ROOT
				is_alive = yes
				health = 4.0
				reverse_opinion = { who = ROOT value = 0 }
				OR = {
					is_friend = ROOT
					is_smart_trigger = yes
					diplomacy = 12
					martial = 12
				}
				NOR = {
					is_child_of = ROOT
					sibling = ROOT
					trait = incapable
					trait = lunatic
					trait = imbecile
					trait = inbred
					any_spouse = { is_ruler = yes }
					any_heir_title = {
						is_primary_holder_title = yes
						holder_scope = { character = ROOT }
					}
				}
				OR = {
					NOT = { age = 30 }
					any_child = {
						is_alive = yes
						is_female = no
						is_ruler = no
						NOT = {
							any_heir_title = {
								is_primary_holder_title = yes
								holder_scope = { character = ROOT }
							}
						}
					}
				}
			}
			custom_tooltip = { text = CUSTOMTOOLTIP41 }
			opinion = { who = ROOT modifier = opinion_grateful years = 20 }
			add_character_modifier = { modifier = wants_crusade_fief_timer duration = 5 hidden = yes }
		}		
	}
	option = {
		name = "EVTOPTD_Plus_401" #No, our victory belongs to God
		ai_chance = {
			factor = 5
			modifier = {
				factor = 5
				trait = zealous
			}
			modifier = {
				factor = 5
				trait = content
			}
		}
		piety = 25
	}
}

# Grant fiefs to crusade participants
character_event = {
	id = Plus.402
	desc = EVTDESC_Plus_402
	picture = GFX_evt_crusaders
	
	is_triggered_only = yes
	
	trigger = {
		OR = {
			has_character_flag = move_capital
			any_independent_ruler = {
				any_realm_character = {
					has_character_modifier = wants_crusade_fief_timer
				}
			}
		}
	}

	immediate = {
		if = {
			limit = { has_character_flag = move_capital }
			if = {
				limit = {
					primary_title = {
						capital_scope = {
							owner = { character = ROOT }
							is_capital = no
						}
					}
				}
				primary_title = {
					capital_scope = {
						county = {
							ROOT = { capital = PREV }
						}
					}
				}
			}
			clr_character_flag = move_capital
		}
		capital_scope = {
			duchy = { save_event_target_as = capital_duchy }
		}
		any_independent_ruler = {
			limit = {
				any_realm_character = {
					religion = ROOT
					has_character_modifier = wants_crusade_fief_timer
				}
			}
			any_realm_character = {
				limit = {
					religion = ROOT
					has_character_modifier = wants_crusade_fief_timer
				}
				if = {
					limit = {
						ROOT = {
							NOT = { demesne_efficiency = 1.00 }
							any_demesne_title = {
								tier = COUNT
								is_feudal = yes
								NOR = {
									has_title_flag = previous_holding
									any_direct_de_jure_vassal_title = { is_holy_site = ROOT }
									duchy = { title = event_target:capital_duchy }
									kingdom = { capital_scope = { county = { title = PREVPREVPREV } } }
									location = {
										OR = {
											province_id = 774
											province_id = 802
											province_id = 796
										}
									}
								}
							}
						}
					}
					liege = { primary_title = { save_event_target_as = liege_title } }
					save_event_target_as = wants_fief
					add_character_modifier = { name = new_land_timer duration = 1 hidden = yes }
					event_target:liege_title = {
						ROOT = {
							random_demesne_title = {
								limit = {
									tier = COUNT
									is_feudal = yes
									NOR = {
										has_title_flag = previous_holding
										any_direct_de_jure_vassal_title = { is_holy_site = ROOT }
										duchy = { title = event_target:capital_duchy }
										kingdom = { capital_scope = { county = { title = PREVPREVPREV } } }
										location = {
											OR = {
												province_id = 774
												province_id = 802
												province_id = 796
											}
										}
									}
								}
								grant_title_no_opinion  = event_target:wants_fief
								any_direct_de_jure_vassal_title = {
									limit = { holder_scope = { character = ROOT } }
									grant_title_no_opinion  = event_target:wants_fief
								}
								copy_title_laws = PREVPREV
								event_target:wants_fief = {
									if = {
										limit = { religion_group = christian }
										add_trait = crusader
									}
									if = {
										limit = { religion_group = muslim }
										add_trait = mujahid
									}
									if = {
										limit = {
											NOR = {
												religion_group = christian
												religion_group = muslim
											}
										}
										add_trait = holy_crusader
									}
									opinion = {
										who = ROOT
										modifier = loyal_vassal
										years = 100
									}
									recalc_succession = yes
								}
							}
						}
					}
				}
				remove_character_modifier = wants_crusade_fief_timer
			}
		}
		any_demesne_title = { clr_title_flag = previous_holding }
		any_vassal = { clr_character_flag = previous_vassal }
		hidden_tooltip = {
			recalc_succession = yes
			character_event = { id = Plus.349 days = 1 }
			any_vassal = { character_event = { id = Plus.349 days = 1 } }
		}
	}

	option = {
		name = "OK"
	}
}

