﻿namespace = el_landed_contract_find_sec

#choice of adventurer
el_landed_contract_find_sec.0001 = {
	hidden = yes
	type = character_event
	trigger = {
		scope:el_employer = { is_alive = yes }
		scope:el_adventurer_fin = { is_alive = yes }
	}
	on_trigger_fail = {
		trigger_event = el_landed_contract_find_sec.0006 
	}
	immediate = {
		scope:el_adventurer_fin = {
			if = {
				limit = { scope:el_employer = { is_alive = yes } }
				current_travel_plan ?= { pause_travel_plan = yes }
			}
			else_if = {
				limit = { scope:el_employer = { is_alive = no } }
				start_travel_plan = {
					destination = scope:el_adventurer_fin.domicile.domicile_location
					return_trip = no
				}
			}
		}
		scope:el_employer = {
			if = { 
				limit = { is_alive = yes }
				add_character_flag = {
					flag = el_is_employing_adventurer
					days = 365
				}
			}				
		}
	}
	option = {
		duel = {
			skills = { intrigue }
			value = high_skill_rating
			#succed
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				el_landed_camp_purpose_bonus_more_modifier = { CAMP_PURPOSE = camp_purpose_brigands }
				el_landed_education_bonus_more_modifier = { SKILL = intrigue }
				el_landed_intelect_bonus_more_modifier = { SCOPE = el_adventurer_fin }
				el_landed_find_sec_lifestile_schemer_bonus_more_modifier = yes
				trigger_event = {
					id = el_landed_contract_find_sec.0007
					days = 39
				}
				scope:el_employer = {			
					add_character_flag = {
						flag = el_landed_find_sec_success
						days = 39
					}						
					trigger_event =  {
						id = el_landed_contract_find_sec.0002
						days = { 30 36 }
					}
				}
			}
			#fail
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				el_landed_camp_purpose_bonus_less_modifier = { CAMP_PURPOSE = camp_purpose_brigands }
				el_landed_education_bonus_less_modifier = { SKILL = intrigue }
				el_landed_intelect_bonus_less_modifier = { SCOPE = el_adventurer_fin }
				el_landed_find_sec_lifestile_schemer_bonus_less_modifier = yes
				trigger_event = {
					id = el_landed_contract_find_sec.0007
					days = 39
				}
				if = {
					limit = {
						scope:el_landed_find_sec_char_fin != scope:el_employer
					}
					scope:el_employer = {
						trigger_event =  {
							id = el_landed_contract_find_sec.0003
							days = { 30 36 }
						}
					}
				}
				else = {
					scope:el_employer = {
						trigger_event =  {
							id = el_landed_contract_find_sec.0002
							days = { 30 36 }
						}
					}
				}					
			}
		}
		ai_chance = {
				base = 100
		}
	}
}

#tutor succeed
el_landed_contract_find_sec.0002 = {
	type = character_event
	theme = landless_adventurer
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					el_landed_find_secret_exists = yes
				}
				desc = el_landed_contract_find_sec.0002.t
			}
			desc = el_landed_contract_find_sec.0003.t
		}
	}
	desc = {	
		first_valid = {
			triggered_desc = {
				trigger = {
					el_landed_find_secret_exists = yes
					scope:el_landed_find_sec_char_fin != scope:el_employer
				}
				desc = el_landed_contract_find_sec.0002.desc
			}
			triggered_desc = {
				trigger = {
					el_landed_find_secret_exists = no
					scope:el_landed_find_sec_char_fin != scope:el_employer					
				}
				desc = el_landed_contract_find_sec.0002.desc.bis
			}
			triggered_desc = {
				trigger = {
					el_landed_find_secret_exists = yes				
				}
				desc = el_landed_contract_find_sec.0002.desc.own
			}
			desc = el_landed_contract_find_sec.0002.desc.bis.own
		}
	}
	override_background = { 
		trigger = { el_landed_find_secret_exists = yes }
		reference = corridor_night 
	}
	override_background = { 
		trigger = { el_landed_find_secret_exists = no }
		reference = corridor_day
	}
	window = big_event_window
	left_portrait = {
		character = scope:el_landed_tardet
		triggered_animation = {
			trigger = {
				el_landed_find_secret_exists = yes
			}
			animation = paranoia   
		}
		triggered_animation = {
			trigger = {
				el_landed_find_secret_exists = no
			}
			animation = throne_room_conversation_1  
			camera = camera_event_scheme_left
		}
		
	}
	lower_center_portrait = {
		character = scope:el_landed_find_sec_char_fin
		trigger = {
			exists = scope:el_landed_courtier
		}
	}
	center_portrait = {
		character = scope:el_landed_tardet2
		trigger = {
			el_landed_find_secret_exists = no
		}
		animation = throne_room_conversation_4
		camera = camera_event_scheme_right
	}
	#success
	right_portrait = {
		character = scope:el_adventurer_fin
		triggered_animation = {
			trigger = {
				el_landed_find_secret_exists = yes
			}
			animation = scheme  
		}
		triggered_animation = {
			trigger = {
				el_landed_find_secret_exists = no
			}
			animation = sadness  
		}
	}
	trigger = {
		scope:el_employer = { is_alive = yes }
		scope:el_adventurer_fin = { is_alive = yes }
	}
	on_trigger_fail = {
		trigger_event = el_landed_contract_find_sec.0006
	}	
	immediate = {
		scope:el_employer = { 
			if = {
				limit = { has_character_flag = el_landed_check_death }
				remove_character_flag = el_landed_check_death 
			}
			random_owned_story = {
				type = el_landed_story_find_sec
				remove_variable = el_landed_story_success_ui
				set_variable = {
					name = el_landed_story_success_ui
					value = 100
				}
			}
		}
		if = {
			limit = {
				has_character_flag = el_landed_find_sec_success
			}
			hidden_effect = {
				el_landed_contract_find_sec_suceed_effect = yes
			}	
			remove_character_flag = el_landed_find_sec_success
		}
		scope:el_adventurer_fin = { 
			if = {
				limit = {
					el_landed_find_secret_exists = yes
				}					
				add_character_flag = use_stealth_clothes 
			}
		}
		if = {
			limit = {
				el_landed_find_secret_exists = yes
			}
			if = {
				limit = {
					exists = scope:el_landed_courtier
				}
				scope:el_landed_courtier = { save_scope_as = el_landed_tardet }
			}
			else = {
				scope:el_landed_find_sec_char_fin = { save_scope_as = el_landed_tardet }
			}
		}
		else = {
			if = {
				limit = {
					scope:el_landed_find_sec_char_fin != scope:el_employer
				}
				scope:el_landed_find_sec_char_fin = { save_scope_as = el_landed_tardet2 }
				scope:el_landed_find_sec_char_fin = {
					random_courtier_or_guest = {
						limit = {
							is_adult = yes
						}
						save_scope_as = el_landed_tardet
					}
				}
			}
			else = {
				scope:el_landed_find_sec_char_fin = {
					random_courtier_or_guest = {
						limit = {
							is_adult = yes
						}
						save_scope_as = el_landed_tardet
					}
					random_courtier_or_guest = {
						limit = {
							is_adult = yes
							this != scope:el_landed_tardet
						}
						save_scope_as = el_landed_tardet2
					}
				}
			}
		}			
	}
	option = {
		name = el_landed_contract_find_sec.0002.a
		trigger = {
			el_landed_find_secret_exists = yes
		}
		show_as_tooltip = {
			scope:el_landed_find_sec_secret_1 = { reveal_to = scope:el_employer }
		}
		scope:el_adventurer_fin = {
			start_travel_plan = {
				destination = scope:el_employer.capital_province
				on_arrival_event = el_landed_contract_find_sec.0024
			}
		}		
	}
	option = {
		name = el_landed_contract_find_sec.0002.a.bis
		trigger = {
			el_landed_find_secret_exists = no
		}
		scope:el_adventurer_fin = {
			start_travel_plan = {
				destination = scope:el_employer.capital_province
				on_arrival_event = el_landed_contract_find_sec.0024
			}
		}		
	}
	after = {
		scope:el_adventurer_fin = {
			if = {
				limit = { has_character_flag = use_stealth_clothes }		
				remove_character_flag = use_stealth_clothes
			}
		}
		if = {
			limit = { scope:el_employer = { is_alive = no } }
			scope:el_adventurer_fin = {
				current_travel_plan ?= { resume_travel_plan = yes }
			}
		}
	}			
}

#train fail
el_landed_contract_find_sec.0003 = {
	type = character_event
	theme = landless_adventurer
	title = el_landed_contract_find_sec.0003.t
	desc = el_landed_contract_find_sec.0003.desc
	override_background = { reference = corridor_day }
	window = big_event_window
	left_portrait = {
		character = scope:el_adventurer_fin
		animation = fear   
	}
	#success
	right_portrait = {
		character = scope:el_guard
		animation = throne_room_two_handed_passive_1  
		camera = camera_event_scheme_far_right  
	}
	trigger = {
		scope:el_employer = { is_alive = yes }
		scope:el_adventurer_fin = { is_alive = yes }
	}
	on_trigger_fail = {
		trigger_event = el_landed_contract_find_sec.0006
	}	
	immediate = {
		scope:el_employer = { 
			if = {
				limit = { has_character_flag = el_landed_check_death }
				remove_character_flag = el_landed_check_death 
			}
			random_owned_story = {
				type = el_landed_story_find_sec
				remove_variable = el_landed_story_success_ui
				set_variable = {
					name = el_landed_story_success_ui
					value = 0
				}
			}
		}
		scope:el_adventurer_fin = {
			increase_wounds_no_death_effect = { REASON = fight }
		}
		scope:el_landed_find_sec_char_fin = {
			if = {
				limit = { is_alive = yes }
				add_character_flag = {
					flag = el_landed_find_sec_cant_be_find_sec
					days = 1825
				}
			}
		}
		if = {
			limit = {
				scope:el_landed_find_sec_char_fin = {
					exists = court_position:bodyguard_court_position
				}			
			}
			scope:el_landed_find_sec_char_fin = {
				court_position:bodyguard_court_position = { save_scope_as = el_guard }
			}
		}
		else_if = {
			limit = {
				scope:el_landed_find_sec_char_fin = {
					any_knight = {
						count > 0
						is_landed = no
					}
				}
			}
			scope:el_landed_find_sec_char_fin = {
				random_knight = {
					limit = {
						is_landed = no
					}
					save_scope_as = el_guard
				}
			}
		}
		else = {
			create_character = {
				template = el_guard_template
				gender = male
				location = scope:el_adventurer_fin.location
				rite = scope:el_adventurer_fin.location.rite
				culture = scope:el_adventurer_fin.location.culture
				save_scope_as = el_guard
			}
			hidden_effect = {
				scope:el_landed_find_sec_char_fin = { add_courtier = scope:el_guard }
			}
			scope:el_guard = { add_character_flag = need_vanish }
			
		}
		scope:el_guard = {
			add_character_flag = need_military_outfit
			add_character_flag = ttk_pwhd_compat
		}		
	}		
	option = {
		name = el_landed_contract_find_sec.0003.a
		scope:el_adventurer_fin = {
			start_travel_plan = {
				destination = scope:el_employer.capital_province
				on_arrival_event = el_landed_contract_find_sec.0025
			}
		}
	}
	after = {
		scope:el_guard = {
			remove_character_flag = need_military_outfit
			remove_character_flag = ttk_pwhd_compat
			if = {
				limit = {
					has_character_flag = need_vanish
				}
				hidden_effect = {
					death = {
						death_reason = death_vanished 
					}
				}
			}
		}
		if = {
			limit = { scope:el_employer = { is_alive = no } }
			scope:el_adventurer_fin = {
				current_travel_plan ?= { resume_travel_plan = yes }
			}
		}
	}	
}

#succeed contract
el_landed_contract_find_sec.0004 = {
	type = character_event
	theme = landless_adventurer
	title = el_landed_contract_find_sec.0004.t
	desc = el_landed_contract_find_sec.0004.desc
	#window = big_event_window
	override_background = { reference = throne_room }
	left_portrait = {
		character = scope:el_employer
		animation = admiration 
		}
	right_portrait = {
		character = scope:el_adventurer_fin
		animation = idle 
		}
	trigger = {
		scope:el_adventurer_fin = {
			is_alive = yes
		}
	}
	on_trigger_fail = {
		scope:el_employer = {
			remove_character_flag = el_is_employing_adventurer
			remove_character_flag = el_landed_propose_find_sec 
		}
	}	
	immediate = {
		set_variable = {
			name = el_landed_cant_use_find_sec
			value = yes
			days = 730
		}
	}		
	option = {
		name = el_landed_contract_find_sec.0004.a
		pay_short_term_gold = {
			target = scope:el_adventurer_fin
			gold = el_landed_medium_gold_value
		}
		scope:el_adventurer_fin = {
			#add_contact = scope:el_employer
			if = {
				limit = { has_variable = el_gallowsbait }
				add_trait = gallowsbait
			}
			add_prestige = medium_prestige_gain
			domicile = { change_provisions = minor_provisions_value }
		}

	}
	option = {
		name = el_landed_contract_find_sec.0004.b
		add_prestige = medium_prestige_loss
		scope:el_adventurer_fin = {
			if = {
				limit = { has_variable = el_gallowsbait }
				add_trait = gallowsbait
			}
			add_prestige = medium_prestige_gain		
			add_opinion = {
				target = scope:el_employer
				modifier = el_landed_refuse_payment
			}
			if = {
			limit = {
				NOT = { has_relation_rival = scope:el_employer }
			}
			set_relation_rival = {
				target = scope:el_employer
				reason = el_landed_refuse_payment_rival
			}
			}
			else_if = {
				limit = {
					has_relation_rival = scope:el_employer
					NOT = { has_relation_nemesis = scope:el_employer }
				}
				set_relation_nemesis = {
					target = scope:el_employer 
					reason = el_landed_refuse_payment_rival
				}
			}
		}
	}
	after = {
		scope:el_adventurer_fin = {
			remove_character_flag = is_in_task_contract_event_chain
			start_travel_plan = {
				destination = scope:el_adventurer_fin.domicile.domicile_location
				return_trip = no
			}
		}
		scope:el_employer = {
			remove_character_flag = el_is_employing_adventurer
			remove_character_flag = el_landed_propose_find_sec 
			random_owned_story = {
				type = el_landed_story_find_sec
				end_story = yes
			}
		}
	}		
}

#fail contract
el_landed_contract_find_sec.0005 = {
	type = character_event
	theme = landless_adventurer
	title = el_landed_contract_find_sec.0005.t
	desc = el_landed_contract_find_sec.0005.desc
	#window = big_event_window
	override_background = { reference = throne_room }
	left_portrait = {
		character = scope:el_employer
		animation = disapproval 
		}
	right_portrait = {
		character = scope:el_adventurer_fin
		animation = disbelief 
		}
	trigger = {
		scope:el_adventurer_fin = {
			is_alive = yes
		}
	}
	on_trigger_fail = {
		scope:el_employer = {
			remove_character_flag = el_is_employing_adventurer
			remove_character_flag = el_landed_propose_find_sec 
		}
	}	
	immediate = {
		set_variable = {
			name = el_landed_cant_use_find_sec
			value = yes
			days = 730
		}
	}		
	option = {
		name = el_landed_contract_find_sec.0005.a
		scope:el_adventurer_fin = {
			if = {
				limit = { has_personality_dominant_trigger = yes }
				add_stress = medium_stress_impact_gain
			}	
		}
		scope:el_employer = {
			if = {
				limit = { has_personality_dominant_trigger = yes }
				add_stress = medium_stress_impact_gain
			}	
		}
	}
	
	after = {
		scope:el_adventurer_fin = {
			remove_character_flag = is_in_task_contract_event_chain
			start_travel_plan = {
				destination = scope:el_adventurer_fin.domicile.domicile_location
				return_trip = no
			}
		}
		scope:el_employer = {
			remove_character_flag = el_is_employing_adventurer
			remove_character_flag = el_landed_propose_find_sec 
			random_owned_story = {
				type = el_landed_story_find_sec
				end_story = yes
			}
		}
	}
}

#clear if dead
el_landed_contract_find_sec.0006 = {
	hidden = yes
		immediate = {		
		scope:el_employer = {
			remove_character_flag = el_is_employing_adventurer
		}
		scope:el_adventurer_fin = {
			if = {
				limit = { is_alive = yes }
				remove_character_flag = is_in_task_contract_event_chain
				if = {
					limit = { current_travel_plan ?= { is_paused  = yes } }
					current_travel_plan ?= { resume_travel_plan = yes }
				}
			}
		}
	}
}

#clear if employer dead
el_landed_contract_find_sec.0007 = {
	hidden = yes
	immediate = {
		if = {
			limit = { scope:el_employer = { is_alive = no }}
			scope:el_employer = {
			}
			scope:el_adventurer_fin = {
				if = {
					limit = { is_alive = yes }
					remove_character_flag = is_in_task_contract_event_chain
					if = {
						limit = { current_travel_plan ?= { is_paused  = yes } }
						current_travel_plan ?= { resume_travel_plan = yes }
					}
				}
			}
		}
	}
}

#choice of target
el_landed_contract_find_sec.0010 = {
	type = character_event
	theme = landless_adventurer
	title = el_landed_contract_find_sec.0010.t
	desc = el_landed_contract_find_sec.0010.desc
	#window = big_event_window
	override_background = { reference = throne_room }
	left_portrait = {
		character = scope:el_employer 
		animation = thinking
		}
	right_portrait = {
		character = scope:el_adventurer_fin
		animation = idle
		}
	trigger = {
		scope:el_employer = { is_alive = yes }
		scope:el_adventurer_fin = { is_alive = yes }
	}
	on_trigger_fail = {
		trigger_event = el_landed_contract_find_sec.0006 
	}
	widget = {
		gui = "event_window_el_landed_character_ruler_title"
		container = "custom_widgets_container"
	}
	immediate = {
		add_character_flag = {
				flag = el_is_employing_adventurer
				days = 365
		}
		every_ruler = {
			limit = {
				top_liege != scope:el_employer.top_liege
				is_landed = yes
				top_liege = {						
					is_landed = yes
					OR = {
						AND = {
							NOT = { scope:el_employer = { has_hook = prev } }
							NOT = { has_character_flag = el_landed_find_sec_cant_be_find_sec }
							highest_held_title_tier >= tier_county
							capital_province = { squared_distance = { target = scope:el_employer.capital_province value < el_squared_distance_max_travel } }
						}
						any_vassal_or_below = {
							NOT = { scope:el_employer = { has_hook = prev } }
							NOT = { has_character_flag = el_landed_find_sec_cant_be_find_sec }
							is_landed = yes
							highest_held_title_tier >= tier_county
							capital_province = { squared_distance = { target = scope:el_employer.capital_province value < el_squared_distance_max_travel } }
						}
					}
				}
			}
			root = {
				add_to_variable_list = {
					name = el_landed_target_list_bis
					target = prev.top_liege
				}
			}
		}
		top_liege ?= {
			if = {
				limit = {
					any_vassal_or_below = {
						this != scope:el_employer
						NOT = { scope:el_employer = { has_hook = prev } }
						NOT = { has_character_flag = el_landed_find_sec_cant_be_find_sec }
						is_landed = yes
						highest_held_title_tier >= tier_county
						capital_province = { squared_distance = { target = scope:el_employer.capital_province value < el_squared_distance_max_travel } }
					}
				}
				root = {
					add_to_variable_list = {
						name = el_landed_target_list_bis
						target = prev
					}
				}
			}
		}
		scope:el_employer = {
			if = {
				limit = {
					any_courtier = {
						count > 0
						NOT = { scope:el_employer = { has_hook = prev } }
					}
				}
				root = {
					add_to_variable_list = {
						name = el_landed_target_list_bis
						target = prev
					}
				}
			}
		}
		ordered_in_list = {
			variable = el_landed_target_list_bis
			order_by = el_landed_order_select_find_sec_value
			min = 0
			max = 100
			root = {
				add_to_variable_list = {
					name = el_landed_target_list
					target = prev
				}
			}
		}			
		ordered_in_list = {
			variable = el_landed_target_list
			save_scope_as = el_landed_find_sec_fin
		}
		set_variable = {
			name = el_landed_target
			value = scope:el_landed_find_sec_fin
		}		
	}
	option = {
		name = el_landed_contract_find_sec.0010.a
		custom_tooltip = el_landed_trigger.0001.a.t.gen
		custom_tooltip = el_landed_trigger.0001.a.tt.gen
		if = {
			limit = { has_variable = el_landed_target  }
			var:el_landed_target = {save_scope_as = el_landed_find_sec_fin }
		}
		clear_variable_list = el_landed_target_list 
		clear_variable_list = el_landed_target_list_bis
		remove_variable = el_landed_target
		scope:el_employer = {
			trigger_event = el_landed_contract_find_sec.0011
		}
	}
	option = {
		name = el_landed_contract_find_sec.choose.another.c
		custom_tooltip = el_landed_contract_find_sec.choose.another.c.tt
		clear_variable_list = el_landed_target_list 
		clear_variable_list = el_landed_target_list_bis
		remove_variable = el_landed_target
		scope:el_employer = {
			trigger_event = el_landed_pre_event.0004
		}
	}
}


#choice of target
el_landed_contract_find_sec.0011 = {
	type = character_event
	theme = landless_adventurer
	title = el_landed_contract_find_sec.0011.t
	desc = el_landed_contract_find_sec.0011.desc
	#window = big_event_window
	override_background = { reference = throne_room }
	left_portrait = {
		character = scope:el_employer 
		animation = thinking
		}
	right_portrait = {
		character = scope:el_adventurer_fin
		animation = idle
		}
	trigger = {
		scope:el_employer = { is_alive = yes }
		scope:el_adventurer_fin = { is_alive = yes }
	}
	on_trigger_fail = {
		trigger_event = el_landed_contract_find_sec.0006 
	}
	widget = {
		gui = "event_window_el_landed_character_ruler_title"
		container = "custom_widgets_container"
	}
	immediate = {
		scope:el_landed_find_sec_fin = {
			if = {
				limit = {
					this = scope:el_employer
				}
				root = {
					add_to_variable_list = {
						name = el_landed_target_list_bis
						target = prev
					}
				}
			}
			if = {
				limit = {
					this != scope:el_employer
					NOT = { scope:el_employer = { has_hook = prev } }
					NOT = { has_character_flag = el_landed_find_sec_cant_be_find_sec }
					capital_province = { squared_distance = { target = scope:el_employer.capital_province value < el_squared_distance_max_travel } }
					is_landed = yes
					highest_held_title_tier >= tier_county
				}
				root = {
					add_to_variable_list = {
						name = el_landed_target_list_bis
						target = prev
					}
				}
			}
			every_vassal_or_below = {
				limit = {
					this != scope:el_employer
					NOT = { scope:el_employer = { has_hook = prev } }
					NOT = { has_character_flag = el_landed_find_sec_cant_be_find_sec }
					capital_province = { squared_distance = { target = scope:el_employer.capital_province value < el_squared_distance_max_travel } }
					is_landed = yes
					highest_held_title_tier >= tier_county
					NOT = {
						root = {
							is_target_in_variable_list = {
								name = el_landed_target_list_bis
								target = prev
							}
						}
					}
				}
				root = {
					add_to_variable_list = {
						name = el_landed_target_list_bis
						target = prev
					}
				}
			}
			
		}
		ordered_in_list = {
			variable = el_landed_target_list_bis
			order_by = el_landed_order_select_find_sec_value
			min = 0
			max = 100
			root = {
				add_to_variable_list = {
					name = el_landed_target_list
					target = prev
				}
			}
		}	
		ordered_in_list = {
			variable = el_landed_target_list
			save_scope_as = el_landed_find_sec_char_fin
		}
		set_variable = {
			name = el_landed_target
			value = scope:el_landed_find_sec_char_fin
		}		
	}
	option = {
		name = el_landed_contract_find_sec.0011.a
		custom_tooltip = el_landed_trigger.0001.a.t.gen
		custom_tooltip = el_landed_trigger.0001.a.tt.gen
		if = {
			limit = { has_variable = el_landed_target  }
			var:el_landed_target = {save_scope_as = el_landed_find_sec_char_fin }
		}
		scope:el_landed_find_sec_char_fin = {
			capital_province ?= {
				save_scope_as = el_land_find_sec_location_2
			}
		}
		clear_variable_list = el_landed_target_list 
		clear_variable_list = el_landed_target_list_bis
		remove_variable = el_landed_target
		scope:el_adventurer_fin = {
			if = {
				limit = { 
					scope:el_landed_find_sec_char_fin != scope:el_employer
				}
				start_travel_plan = {
					destination = scope:el_land_find_sec_location_2
					on_arrival_event =  el_landed_contract_find_sec.0001
				}
			}
			else = {
				scope:el_landed_find_sec_char_fin = {
					capital_county = {
						random_county_province = {
							limit = {
								this != scope:el_land_find_sec_location_2
							}
							save_scope_as = el_land_find_sec_location_2
						}
					}
				}
				start_travel_plan = {
					destination = scope:el_land_find_sec_location_2
					on_arrival_event =  el_landed_contract_find_sec.0001
				}
			}
		}		
	}
	option = {
		name = el_landed_contract_find_sec.back
		custom_tooltip = el_landed_contract_find_sec.back.tt
		clear_variable_list = el_landed_target_list 
		clear_variable_list = el_landed_target_list_bis
		remove_variable = el_landed_target
		scope:el_employer = {
			trigger_event = el_landed_contract_find_sec.0010
		}
	}
}


el_landed_contract_find_sec.0020 = {
	hidden = yes
	trigger = {
		scope:el_employer = { is_alive = yes }
		scope:el_adventurer_fin = { is_alive = yes }
	}
	on_trigger_fail = {
		trigger_event = el_landed_contract_find_sec.0007
	}
	immediate = {
		scope:el_employer = {
			trigger_event = el_landed_contract_find_sec.0010
		}
	}
}

el_landed_contract_find_sec.0024 = {
	hidden = yes
	immediate = {
		if = {
			limit = { scope:el_employer = { is_alive = no } }
			start_travel_plan = {
				destination = scope:el_adventurer_fin.domicile.domicile_location
				return_trip = no
			}
		}
		else_if = {
			limit = { scope:el_employer = { is_alive = yes } }
			if = {
				limit = {
					el_landed_find_secret_exists = yes
				}
				scope:el_employer = {
					trigger_event = el_landed_contract_find_sec.0004
				}
			}
			else_if = {
				limit = {
					el_landed_find_secret_exists = no
				}
				scope:el_employer = {
					trigger_event = el_landed_contract_find_sec.0005
				}
			}
		}
	}
}

el_landed_contract_find_sec.0025 = {
	hidden = yes
	immediate = {
		if = {
			limit = { scope:el_employer = { is_alive = no } }
			start_travel_plan = {
				destination = scope:el_adventurer_fin.domicile.domicile_location
				return_trip = no
			}
		}
		else_if = {
			limit = { scope:el_employer = { is_alive = yes } }
			scope:el_employer = {
				trigger_event = el_landed_contract_find_sec.0005
			}
		}
	}
}