diff --git a/events/courtier_guest_management_events/courtier_guest_management_events.txt b/events/courtier_guest_management_events/courtier_guest_management_events.txt new file mode 100644 index 00000000..18ea7105 --- /dev/null +++ b/events/courtier_guest_management_events/courtier_guest_management_events.txt @@ -0,0 +1,1335 @@ +namespace = courtier_guest_management + +#COURTIERS/GUESTS LEAVING +# 0001 - Courtier is planning to leave +# 0102 - Courtier with claim is wanting to leave +# 0500 - Guests leaves +# 0999 - Maintenance - Force move to pool + +#GUESTS ARRIVING +# 1001 - Guest arriving, message if they're great + +#POOL CHARACTERS +# 2001 - "Develops" the character and gives those without location a location +# 2002 - Pool repopulation + +#COURTIERS AND GUESTS DOING STUFF +# 3001 - Sets relationships and other secrets + + + + + + +############################ +# COURTIERS/GUESTS LEAVING # +############################ + +#Courtier is planning to leave +courtier_guest_management.0001 = { + hidden = yes + + trigger = { + any_in_list = { + list = characters + is_child_of = scope:liege + } + } + + immediate = { + #Send message about child about to leave + every_in_list = { + list = characters + limit = { is_child_of = scope:liege } + + save_scope_as = child + scope:liege = { + send_interface_message = { + type = character_preparing_to_leave + title = courtier_guest_management.0001.t + desc = courtier_guest_management.desc + left_icon = scope:child + } + } + } + } +} + +# this = claimed title scope +# CLAIMANT = claimant +# RULER = ruler for claimant +scripted_trigger useful_courtier_claim_can_declare_for = { + neighboring_useful_courtier_or_guest_claim_trigger = { RULER = $RULER$ } + save_temporary_scope_as = claim_title + $RULER$ = { + can_declare_war = { + defender = scope:claim_title.holder + claimant = $CLAIMANT$ + casus_belli = claim_cb + target_titles = { scope:claim_title } + } + } +} + +#Courtier is leaving +courtier_guest_management.0101 = { + hidden = yes + + immediate = { + #Liege gets "last chance to make them stay"-event for claimants + if = { + limit = { + scope:liege = { is_ai = no } + any_in_list = { + list = characters + save_temporary_scope_as = check_character + any_claim = { + useful_courtier_claim_can_declare_for = { + CLAIMANT = scope:check_character + RULER = scope:liege + } + } + } + } + random_in_list = { + list = characters + limit = { + save_temporary_scope_as = check_character + any_claim = { + useful_courtier_claim_can_declare_for = { + CLAIMANT = scope:check_character + RULER = scope:liege + } + tier = tier_kingdom + } + } + alternative_limit = { + save_temporary_scope_as = check_character + any_claim = { + useful_courtier_claim_can_declare_for = { + CLAIMANT = scope:check_character + RULER = scope:liege + } + tier = tier_duchy + } + } + alternative_limit = { + save_temporary_scope_as = check_character + any_claim = { + useful_courtier_claim_can_declare_for = { + CLAIMANT = scope:check_character + RULER = scope:liege + } + tier = tier_county + } + } + save_scope_as = courtier + scope:liege = { trigger_event = courtier_guest_management.0102 } + } + } + else = { + move_to_pool_effect = yes + } + } +} + + +#Courtier with claim is wanting to leave +courtier_guest_management.0102 = { #by Mathilda Bjarnehed + type = character_event + title = courtier_guest_management.0102.t + desc = courtier_guest_management.0102.desc + left_portrait = scope:courtier + right_portrait = scope:courtier_claim + theme = crown + override_background = { + reference = courtyard + } + + trigger = { + scope:courtier = { + any_claim = { + useful_courtier_claim_can_declare_for = { + CLAIMANT = scope:courtier + RULER = scope:liege + } + } + is_pool_character = no + } + } + + immediate = { + #For text + scope:courtier = { + random_claim = { + limit = { + useful_courtier_claim_can_declare_for = { + CLAIMANT = scope:courtier + RULER = scope:liege + } + tier = tier_empire + } + alternative_limit = { + useful_courtier_claim_can_declare_for = { + CLAIMANT = scope:courtier + RULER = scope:liege + } + tier = tier_kingdom + } + alternative_limit = { + useful_courtier_claim_can_declare_for = { + CLAIMANT = scope:courtier + RULER = scope:liege + } + tier = tier_duchy + } + alternative_limit = { + useful_courtier_claim_can_declare_for = { + CLAIMANT = scope:courtier + RULER = scope:liege + } + tier = tier_county + } + save_scope_as = courtier_claim + } + } + + capital_province = { barony = { save_scope_as = capital } } + } + + #Yes, I promise + option = { + name = courtier_guest_management.0102.a + + show_as_tooltip = { + random_list = { + desc = courtier_guest_management.0102.a.rl.desc + 1 = { + show_chance = no + desc = courtier_guest_management.0102.a.stay + custom_tooltip = courtier_guest_management.0102.a.stay.tt + } + 1 = { + show_chance = no + desc = courtier_guest_management.0102.a.leave + scope:courtier = { select_and_move_to_pool_effect = yes } + } + } + } + + hidden_effect = { + scope:courtier = { + add_character_flag = { + flag = courtier_staying_for_claim + years = 1 + } + trigger_event = { + id = courtier_guest_management.0103 + years = 1 + } + } + } + } + + #No, I cannot + option = { + name = courtier_guest_management.0102.b + + scope:courtier = { select_and_move_to_pool_effect = yes } + } +} + +#Did liege fulfill their promise to courtier claimant? +courtier_guest_management.0103 = { + hidden = yes + + trigger = { + exists = scope:liege + is_courtier_of = scope:liege + NOT = { + scope:liege = { + any_character_war = { + casus_belli = { + any_target_title = { + scope:courtier = { has_claim_on = prev } + } + } + } + } + } + } + + immediate = { + select_and_move_to_pool_effect = yes + } +} + + +#Guest leaves +courtier_guest_management.0500 = { + hidden = yes + + immediate = { + if = { # Warning if they take your kids with them + limit = { + NOT = { has_character_flag = guest_has_given_warning_about_leaving } + #To double check that they actually can leave + is_pool_guest_of = scope:host + scope:host = { is_ai = no } + any_traveling_family_member = { + count = all + guest_allowed_to_leave_trigger = yes + } + OR = { + AND = { + OR = { + has_trait = bastard + has_trait = wild_oat + } + any_parent = { this = scope:host } + } + any_traveling_family_member = { + OR = { + has_trait = bastard + has_trait = wild_oat + } + any_parent = { this = scope:host } + } + scope:host = { + any_known_secret = { + OR = { + secret_type = secret_disputed_heritage + secret_type = secret_unmarried_illegitimate_child + } + OR = { + secret_target = { + this = root + is_adult = no + } + secret_target = { + save_temporary_scope_as = target_check + root = { + any_traveling_family_member = { + this = scope:target_check + is_adult = no + } + } + } + } + } + } + } + } + scope:host = { + send_interface_message = { + type = character_preparing_to_leave + title = courtier_guest_management.0500.t + desc = courtier_guest_management.0500.desc + left_icon = root + } + } + add_character_flag = { + flag = guest_has_given_warning_about_leaving + days = 35 + } + trigger_event = { + id = courtier_guest_management.0500 + days = { 25 30 } #You get about a month to decide if you wanna keep them around! + } + } + else = { + if = { + limit = { + has_character_flag = guest_has_given_warning_about_leaving + } + remove_character_flag = guest_has_given_warning_about_leaving + + # Now a month out of date, so lets update it + select_pool_to_move_to_effect = yes + } + move_to_pool_effect = yes + } + } +} + +# Maintenance - Force move to pool +courtier_guest_management.0999 = { + hidden = yes + + immediate = { + select_and_move_to_pool_effect = yes + } +} + + + +################### +# GUESTS ARRIVING # +################### + +#Guest arriving, message if they're great +scripted_trigger courtier_guest_management_1001_exceptional_claimant_trigger = { + any_claim = { neighboring_useful_courtier_or_guest_claim_trigger = { RULER = scope:host } } +} + +scripted_trigger courtier_guest_management_1001_exceptional_marriage_candidate_trigger = { + save_temporary_scope_as = marriage_candidate + guest_marriage_candidate_trigger = yes + age > 14 + OR = { + num_of_good_genetic_traits = 3 + AND = { + num_of_good_genetic_traits = 2 + OR = { + has_trait = beauty_good_3 + has_trait = intellect_good_3 + has_trait = physique_good_3 + } + } + scope:host = { + can_marry_character_trigger = { CHARACTER = scope:marriage_candidate } + marriage_between_characters_unlocks_alliance_of_min_tier_trigger = { + MY_CHARACTER = scope:host + THEIR_CHARACTER = scope:marriage_candidate + TIER = scope:host.highest_held_title_tier + } + } + dynasty ?= { dynasty_prestige_level >= high_dynasty_prestige_level } + has_useful_potential_spouse_claim_trigger = { RULER = scope:host } + calc_true_if = { + amount >= 2 + num_of_good_genetic_traits = 2 + AND = { + num_of_good_genetic_traits = 1 + OR = { + has_trait = beauty_good_2 + has_trait = intellect_good_2 + has_trait = physique_good_2 + } + } + dynasty ?= { dynasty_prestige_level > medium_dynasty_prestige_level } + } + calc_true_if = { + amount >= 3 + dynasty ?= { dynasty_prestige_level > low_dynasty_prestige_level } + num_of_good_genetic_traits = 1 + diplomacy >= high_skill_rating + martial >= high_skill_rating + stewardship >= high_skill_rating + intrigue >= high_skill_rating + learning >= high_skill_rating + } + } + NOR = { + num_of_bad_genetic_traits > 1 + is_lowborn = yes + } +} + +scripted_trigger courtier_guest_management_1001_exceptional_commander_trigger = { + guest_commander_candidate_trigger = { HOST = scope:host } + number_of_commander_traits >= 1 + martial >= very_high_skill_rating +} + +scripted_trigger courtier_guest_management_1001_exceptional_vassal_trigger = { + guest_vassal_candidate_trigger = yes + opinion = { + target = scope:host + value >= medium_positive_opinion + } + calc_true_if = { + amount >= 2 + OR = { + has_trait = content + has_trait = trusting + has_trait = humble + } + martial >= high_skill_rating + stewardship >= high_skill_rating + } +} + +scripted_trigger courtier_guest_management_1001_exceptional_knight_trigger = { + guest_knight_candidate_trigger = { HOST = root } + prowess >= very_high_skill_rating +} + +scripted_trigger courtier_guest_management_1001_exceptional_physician_trigger = { + guest_physician_candidate_trigger = yes + OR = { + has_trait = lifestyle_mystic + has_trait = lifestyle_physician + has_trait = lifestyle_herbalist + } + learning >= high_skill_rating +} + + + +courtier_guest_management.1001 = { + hidden = yes + + immediate = { + scope:guest = { + every_traveling_family_member = { + add_to_temporary_list = guest_arrival_list + } + } + + # To update Adventure Inspiration to make sure that the target destination isn't in the realm they just arrived to. If it is we remove it and make them pick a new destination! + every_in_list = { + list = guest_arrival_list + limit = { + inspiration ?= { has_inspiration_type = adventure_inspiration } + exists = var:adventure_destination #They know where they want to go + } + get_adventure_inspiration_start_location = { ADVENTURER = this } + if = { + limit = { + scope:host = { + any_sub_realm_county = { + this = scope:location.county + } + } + } + remove_variable = adventure_destination + if = { + limit = { + adventure_inspiration_average_skill_value >= high_inspiration_skill + } + set_adventure_location_effect = { + BASE_SCOPE = this + NO_DESTINATION = yes + } + } + else = { + set_adventure_location_effect = { + BASE_SCOPE = this + NO_DESTINATION = no + } + } + } + } + + ###DEVELOPMENT EFFECT### + #Because the characters spend so little time in the pool, we also run it now + + every_in_list = { # Very performance-intensive, so we restrict it as much as possible at this step. + list = guest_arrival_list + limit = { + is_adult = yes + is_lowborn = no + is_physically_able = yes + } + pool_character_development_effect = yes + if = { + limit = { + gold >= 1000 + } + purge_excess_wanderer_riches_effect = yes + } + } + + ###EXCEPTIONAL GUEST TOAST### + if = { + limit = { scope:host = { is_ai = no } } #This is just interface messages, AI doesn't care + + every_in_list = { + list = guest_arrival_list + limit = { + courtier_guest_management_1001_exceptional_claimant_trigger = yes + } + save_scope_as = exceptional_guest + + #CLAIMANT MESSAGE + if = { + limit = { courtier_guest_management_1001_exceptional_claimant_trigger = yes } + random_claim = { + limit = { + neighboring_useful_courtier_or_guest_claim_trigger = { RULER = scope:host } + tier = tier_kingdom + scope:host.highest_held_title_tier > tier_kingdom + } + alternative_limit = { + neighboring_useful_courtier_or_guest_claim_trigger = { RULER = scope:host } + tier = tier_duchy + scope:host.highest_held_title_tier > tier_duchy + } + alternative_limit = { + neighboring_useful_courtier_or_guest_claim_trigger = { RULER = scope:host } + tier = tier_county + scope:host.highest_held_title_tier > tier_county + } + save_scope_as = guest_claim + } + scope:host = { + send_interface_toast = { + type = msg_notable_guest + left_icon = scope:exceptional_guest + right_icon = scope:guest_claim + title = courtier_guest_management.1001.t + desc = courtier_guest_management.1001.claimant.desc + } + } + } + } + } + } +} + +################### +# POOL CHARACTERS # +################### + +#This events gives pool characters relations, skills, traits and secrets. If they lack a location, they're given a location. +courtier_guest_management.2001 = { + hidden = yes + trigger = { + is_pool_character = yes # Can cease to be in the pool between it queuing and executing + } + + immediate = { + #Am I lost in the void? + if = { + limit = { NOT = { exists = location } } + + #Oops, no good! Go someplace. (family is also moved with this effect) + fallback_move_to_pool_effect = yes + } + + #Don't I have the "last_visited_ruler" variable? (= it ran out or I'm from some weird source that doesn't set var) + if = { + limit = { NOT = { exists = var:last_visited_ruler } } + + if = { # If character is prune-able, prune. + limit = { + pool_character_is_pruneable_trigger = yes + } + if = { + limit = { + culture = { + has_cultural_tradition = tradition_diasporic + } + is_adult = yes + is_lowborn = no + age < 40 + } + random_list = { + 20 = { + save_scope_as = minority_leader + if = { + limit = { + player_heir ?= { + this != root + is_adult = yes + } + } + player_heir = { + save_scope_as = laamp_heir + save_scope_as = laamp_inheritor + custom_tooltip = become_landless_minority_decision_title_scope_tt + } + } + else_if = { + limit = { top_liege != this } + liege = { + save_scope_as = laamp_liege + save_scope_as = laamp_inheritor + custom_tooltip = become_landless_minority_decision_title_scope_tt + } + } + else = { + custom_tooltip = become_landless_minority_decision_title_created_tt + if = { + limit = { + NOT = { exists = scope:laamp_inheritor } + } + hidden_effect_new_object = { + create_character = { + template = laamp_inheritor_template + culture = root.culture + faith = root.faith + dynasty = generate + location = root.capital_province + after_creation = { + save_scope_as = laamp_inheritor + add_character_flag = new_laamp_inheritor + } + } + } + } + } + create_landless_minority_title_tooltip_effect = yes + show_as_tooltip = { + add_prestige = medium_prestige_gain + add_character_modifier = { + modifier = ep3_voluntary_laamp_character_modifier + years = 5 + } + } + trigger_event = { id = ep3_laamps.1030 } + # Debug tracking + if = { + limit = { + is_ai = yes + debug_only = yes + } + if = { + limit = { exists = global_var:ai_voluntary_laamp_count } + change_global_variable = { + name = ai_voluntary_laamp_count + add = 1 + } + } + else = { + set_global_variable = { + name = ai_voluntary_laamp_count + value = 1 + } + } + debug_log = "AI became adventurer voluntarily" + debug_log_scopes = yes + } + stress_impact = { + craven = minor_stress_impact_gain + content = minor_stress_impact_gain + lazy = minor_stress_impact_gain + } + } + 50 = { + } + 30 = { + death = { death_reason = death_accident } + } + } + } + else_if = { + limit = { age < 65 } + death = { death_reason = death_accident } + } + else = { + death = { death_reason = death_old_age } + } + } + else = { # Otherwise, go somewhere else. + fallback_move_to_pool_effect = yes + } + } + + if = { + limit = { is_alive = yes } #Because we might just have killed you and then 🎵nothing else matters🎵 + + #Develop + random = { # Very performance-intensive, so we restrict it as much as possible at this step. + chance = 50 + if = { + limit = { + static_group_filter = { + group = random_dev_blocker + match = 0.8 + } + is_adult = yes + is_lowborn = no + is_physically_able = yes + } + pool_character_development_effect = yes + } + } + if = { + limit = { + gold >= 1000 + } + purge_excess_wanderer_riches_effect = yes + } + + #Is my pool full? Then move + if = { + limit = { + location = { + exists = province_owner + local_pool_is_full_trigger = yes + } + } + + location.province_owner = { + random_neighboring_and_across_water_top_liege_realm_owner = { + limit = { + capital_province ?= { local_pool_is_full_trigger = no } + } + capital_province = { save_scope_as = destination } + } + } + + if = { + limit = { exists = scope:destination } + every_traveling_family_member = { + limit = { NOT = { is_in_pool_at = scope:destination } } + move_to_pool_at = scope:destination + } + } + else = { + fallback_move_to_pool_effect = yes + } + } + } + + } +} + +#################################### +# COURTIERS AND GUESTS DOING STUFF # +#################################### + +scripted_trigger courtier_guest_management_3001_best_friend_trigger = { + opinion = { + target = scope:current_character + value >= high_positive_opinion + } + reverse_opinion = { + target = scope:current_character + value >= high_positive_opinion + } +} + +scripted_trigger courtier_guest_management_3001_soulmate_trigger = { + opinion = { + target = scope:current_character + value >= high_positive_opinion + } + reverse_opinion = { + target = scope:current_character + value >= high_positive_opinion + } +} + +scripted_trigger courtier_guest_management_3001_nemesis_trigger = { + opinion = { + target = scope:current_character + value <= high_negative_opinion + } + reverse_opinion = { + target = scope:current_character + value <= high_negative_opinion + } +} + +scripted_trigger courtier_guest_management_3001_interesting_trigger = { + OR = { + is_lowborn = no + has_trait = intellect_good + has_trait = physique_good + has_trait = beauty_good + diplomacy >= high_skill_rating + martial >= high_skill_rating + stewardship >= high_skill_rating + intrigue >= high_skill_rating + learning >= high_skill_rating + is_witch_trigger = yes + is_deviant_trigger = yes + } +} + +courtier_guest_management.3001 = { + hidden = yes + + immediate = { + every_courtier_or_guest = { + limit = { + age >= childhood_education_start_age + NOT = { has_trait = incapable } + } + add_to_list = courtiers_and_guests + } + + #Am I a player? Extra fun stuff + if = { + limit = { is_ai = no } + + save_scope_as = root_scope + random_list = { + 2 = { #Seduce + modifier = { + OR = { + has_trait = lustful + has_trait = seducer + has_focus = intrigue_temptation_focus + } + add = 3 + } + random_in_list = { + list = courtiers_and_guests + limit = { + save_temporary_scope_as = instigating_courtier + are_characters_sensible_lovers_trigger = { INSTIGATING_LOVER = scope:instigating_courtier TARGET_OF_LOVE = scope:root_scope } + can_start_scheme = { + type = seduce + target_character = root + } + } + weight = { + base = 100 + opinion_modifier = { + opinion_target = root + multiplier = 5 + } + compatibility_modifier = { + compatibility_target = root + multiplier = 20 + } + ai_value_modifier = { + ai_sociability = 1 + } + modifier = { + has_relation_potential_lover = root + add = 500 + } + + modifier = { + add = { + value = attraction + divide = high_positive_attraction + multiply = 50 + } + } + modifier = { + has_trait = lustful + factor = 1.5 + } + } + start_scheme = { + type = seduce + target_character = root + } + } + } + 2 = { #Romance + modifier = { + OR = { + has_trait = gallant + has_focus = martial_chivalry_focus + } + add = 3 + } + random_in_list = { + list = courtiers_and_guests + limit = { + save_temporary_scope_as = instigating_courtier + are_characters_sensible_and_appropriate_open_lovers_trigger = { INSTIGATING_LOVER = scope:instigating_courtier TARGET_OF_LOVE = scope:root_scope } + can_start_scheme = { + type = courting + target_character = root + } + } + weight = { + base = 100 + opinion_modifier = { + opinion_target = root + multiplier = 5 + } + compatibility_modifier = { + compatibility_target = root + multiplier = 20 + } + modifier = { + has_relation_potential_lover = root + add = 500 + } + modifier = { + is_knight = yes + add = 200 + } + ai_value_modifier = { + ai_honor = 2 + ai_sociability = 1 + } + } + start_scheme = { + type = courting + target_character = root + } + } + } + 96 = { } #Nothing + } + } + + # Every courtier gets a chance to do something (relations also include guests) + every_in_list = { + list = courtiers_and_guests + limit = { NOT = { is_in_list = already_updated } } #If another character set a relation with you, you don't get to run your own update. (However, we don't want to block you from being selected by other characters if you are the best alternative.) + + save_scope_as = current_character + + random = { + chance = 5 + modifier = { #More should happen in player's court! + root = { is_ai = no } + is_courtier_of = root + add = 15 + } + + random_list = { + ### RELATIONS ### + # Friend + 100 = { + ai_value_modifier = { + ai_compassion = 0.8 + ai_sociability = 2 + } + trigger = { + any_relation = { + type = friend + count <= 2 + } + } + + random_in_list = { + limit = { + can_set_relation_friend_trigger = { CHARACTER = scope:current_character } + } + list = courtiers_and_guests + weight = { + base = 100 + compatibility_modifier = { + who = this + compatibility_target = scope:current_character + multiplier = 20 + } + modifier = { + has_relation_potential_friend = scope:current_character + add = 500 + } + } + + add_to_list = already_updated + set_random_friendship_reason = { TARGET = scope:current_character } + } + } + # Lover + 50 = { + ai_value_modifier = { + ai_sociability = 1.5 + } + modifier = { + has_trait = lustful + add = 150 + } + modifier = { + OR = { + any_relation = { type = soulmate always = yes } + is_married = yes + } + ai_honor >= 0 + add = -150 + } + modifier = { + add = { + value = attraction + divide = high_positive_attraction + multiply = 50 + } + } + trigger = { + is_married = no + is_concubine = no + might_cheat_on_every_partner_trigger = yes + NOR = { + has_trait = chaste + has_trait = celibate + has_sexuality = asexual + } + trigger_if = { + limit = { + is_courtier = yes + is_close_or_extended_family_of = liege + } + OR = { + has_trait = lustful + is_deviant_trigger = yes + } + } + any_relation = { + type = lover + count < 1 + } + } + + random_in_list = { + limit = { + is_married = no + is_concubine = no + might_cheat_on_every_partner_trigger = yes + NOR = { + has_trait = chaste + has_trait = celibate + has_sexuality = asexual + } + any_relation = { + type = lover + count < 1 + } + trigger_if = { + limit = { + is_courtier = yes + is_close_or_extended_family_of = liege + } + scope:current_character = { is_lowborn = no } + OR = { + is_deviant_trigger = yes + has_trait = lustful + trait_compatibility = { + target = scope:current_character + value >= high_positive_trait_compatibility + } + } + } + this != scope:current_character + can_set_relation_lover_trigger = { CHARACTER = scope:current_character } + is_attracted_to_gender_of = scope:current_character + scope:current_character = { is_attracted_to_gender_of = prev } + age <= scope:current_character.age_plus_5 + age >= scope:current_character.age_minus_10 + trait_compatibility = { + target = scope:current_character + value >= low_positive_trait_compatibility + } + save_temporary_scope_as = incest_check + accepts_incest_with_each_other_trigger = { + CHARACTER_1 = scope:incest_check + CHARACTER_2 = scope:current_character + } + } + list = courtiers_and_guests + weight = { + base = 100 + compatibility_modifier = { + who = this + compatibility_target = scope:current_character + multiplier = 20 + } + modifier = { + has_relation_potential_lover = scope:current_character + add = 500 + } + modifier = { + add = { + value = attraction + divide = high_positive_attraction + multiply = 50 + } + } + modifier = { + has_trait = lustful + factor = 2 + } + } + + add_to_list = already_updated + + set_random_lover_reason = { TARGET = scope:current_character } + } + } + + # Rival + 50 = { + ai_value_modifier = { + ai_compassion = -1 + ai_vengefulness = 2 + } + trigger = { + any_relation = { + type = rival + count <= 1 + } + ai_vengefulness >= low_negative_ai_value + } + + random_in_list = { + limit = { + can_set_relation_rival_trigger = { CHARACTER = scope:current_character } + } + list = courtiers_and_guests + weight = { + base = 100 + opinion_modifier = { + trigger = { root = { is_ai = no } } + who = this + opinion_target = scope:current_character + multiplier = -5 + } + opinion_modifier = { + trigger = { root = { is_ai = no } } + who = scope:current_character + opinion_target = this + multiplier = -5 + } + compatibility_modifier = { + who = this + compatibility_target = scope:current_character + multiplier = -20 + } + modifier = { + has_relation_potential_rival = scope:current_character + add = 500 + } + } + + add_to_list = already_updated + set_random_rivalry_reason = { + TARGET = scope:current_character + RELATION = rival + } + } + } + # Best friend + 50 = { + trigger = { + any_relation = { + type = friend + courtier_guest_management_3001_best_friend_trigger = yes + can_set_relation_best_friend_trigger = { CHARACTER = scope:current_character } + } + } + random_relation = { + type = friend + limit = { + courtier_guest_management_3001_best_friend_trigger = yes + can_set_relation_best_friend_trigger = { CHARACTER = scope:current_character } + } + + add_to_list = already_updated + set_relation_best_friend = { reason = best_friend_bonded_at_court copy_reason = friend target = scope:current_character involved_character = root.liege } + } + } + # Soulmate + 25 = { + trigger = { + any_relation = { + type = lover + courtier_guest_management_3001_soulmate_trigger = yes + can_set_relation_soulmate_trigger = { CHARACTER = scope:current_character } + } + } + random_relation = { + type = lover + limit = { + courtier_guest_management_3001_soulmate_trigger = yes + can_set_relation_soulmate_trigger = { CHARACTER = scope:current_character } + } + + add_to_list = already_updated + set_relation_soulmate = { reason = soulmate_love_at_court copy_reason = lover target = scope:current_character } + } + } + # Nemesis + 25 = { + trigger = { + any_relation = { + type = rival + courtier_guest_management_3001_nemesis_trigger = yes + can_set_relation_nemesis_trigger = { CHARACTER = scope:current_character } + } + } + random_relation = { + type = rival + limit = { + courtier_guest_management_3001_nemesis_trigger = yes + can_set_relation_nemesis_trigger = { CHARACTER = scope:current_character } + } + + add_to_list = already_updated + set_relation_nemesis = { + reason = nemesis_at_court + copy_reason = rival + target = scope:current_character + } + } + } + + ### SECRETS ### + 30 = { + trigger = { + NOT = { any_secret = { always = yes } } + is_adult = yes + } + courtier_guest_pool_character_secret_giving_effect = yes + } + } + } + + } + } +} + +############################ +# WANDERER INTO ADVENTURER # +############################ + +courtier_guest_management.4001 = { + hidden = yes + trigger = { + has_ep3_dlc_trigger = yes + is_pool_character = yes # Can cease to be in the pool between it queuing and executing + ai_can_valid_to_create_laamp_trigger = yes + is_valid_for_laampdom = yes + OR = { + has_character_flag = easteregg + has_trait = historical_character + culture = { + has_cultural_parameter = much_more_likely_to_be_laamps + } + AND = { + is_lowborn = no + culture = { + has_cultural_parameter = more_likely_to_be_laamps + } + } + any_claim = { tier >= tier_kingdom } + } + pool_character_is_pruneable_trigger = no # Avoid having uninteresting characters become Adventurers + is_ai = yes + NOT = { + any_heir_title = { } + } + } + + immediate = { + random = { + chance = 0 + modifier = { add = ep3_laamp_chance_score_value } + #Counteract bonus in above value somewhat + modifier = { + culture = { has_cultural_parameter = more_likely_to_be_laamps } + add = -75 + } + modifier = { + has_trait = historical_character + add = 150 + } + create_landless_adventurer_title_effect = { + REASON = flag:wanderer + FLAVOR_CHAR = root + } + trigger_event = ep3_laamps.0003 + if = { # Debug AI tracking + limit = { debug_only = yes } + if = { + limit = { exists = global_var:ai_wanderer_laamp_count } + change_global_variable = { + name = ai_wanderer_laamp_count + add = 1 + } + } + else = { + set_global_variable = { + name = ai_wanderer_laamp_count + value = 1 + } + } + debug_log = "AI became adventurer due to cultural tradition" + debug_log_scopes = yes + } + } + } +} diff --git a/events/dlc/fp2/fp2_struggle_events.txt b/events/dlc/fp2/fp2_struggle_events.txt index fd8140b6..1993a47c 100644 --- a/events/dlc/fp2/fp2_struggle_events.txt +++ b/events/dlc/fp2/fp2_struggle_events.txt @@ -2054,7 +2054,6 @@ scripted_trigger neighboring_ruler_proper_culture_trigger = { culture = culture:baranis culture = culture:butr culture = culture:levantine - culture = culture:sephardi } } diff --git a/events/dlc/fp2/fp2_yearly_events.txt b/events/dlc/fp2/fp2_yearly_events.txt index 9075d9a1..ea1eee4d 100644 --- a/events/dlc/fp2/fp2_yearly_events.txt +++ b/events/dlc/fp2/fp2_yearly_events.txt @@ -5915,709 +5915,6 @@ fp2_yearly.8006 = { # Conversos and Jewish events # By James Beaumont ################################### -scripted_trigger valid_grantable_county_barony = { - title_province = { - geographical_region = world_europe_west_iberia - } - title_province = { has_building_or_higher = common_tradeport_01 } - is_holy_site = no - county.holder = { - any_held_title = { # Make sure it isn't revoking their last title - title_tier = county - count >= 2 - } - } -} - -fp2_yearly.9000 = { - type = character_event - title = fp2_james.0001.t - desc = fp2_james.0001.desc - theme = secret - override_background = { - reference = docks - } - left_portrait = { - character = root - animation = personality_rational - } - right_portrait = { - character = scope:fp2_james_0001_jewish_trader - animation = personality_bold - } - - trigger = { - NOT = { root.religion = religion:judaism_religion } - highest_held_title_tier >= tier_county - any_sub_realm_barony = { - valid_grantable_county_barony = yes - } - } - - immediate = { - random_sub_realm_barony = { - limit = { - valid_grantable_county_barony = yes - } - save_scope_as = fp2_james_0001_thriving_community - } - create_character = { - template = spanish_jewish_merchant_character - location = root.capital_province - save_scope_as = fp2_james_0001_jewish_trader - } - } - - option = { - name = fp2_james.0001.a - scope:fp2_james_0001_thriving_community.county = { - add_county_modifier = { - modifier = fp2_jewish_community_denied_modifier - years = 10 - } - } - scope:fp2_james_0001_jewish_trader.culture = { - change_cultural_acceptance = { - target = root.culture - value = low_negative_culture_acceptance - desc = cultural_acceptance_gain_conversos_tolerance - } - } - - stress_impact = { - callous = minor_stress_impact_loss - greedy = minor_stress_impact_gain - compassionate = medium_stress_impact_gain - } - ai_chance = { - base = 10 - ai_value_modifier = { - ai_honor = -0.5 - ai_greed = -0.5 - ai_zeal = 1.5 - } - } - } - - option = { - name = fp2_james.0001.b - trigger = { - NOT = { # Prevent all of Iberia from converting - any_county_in_region = { - region = world_europe_west_iberia - culture = culture:sephardi - } - } - } - create_title_and_vassal_change = { - type = granted - save_scope_as = change - add_claim_on_loss = no - } - scope:fp2_james_0001_thriving_community.county = { - change_title_holder = { - holder = scope:fp2_james_0001_jewish_trader - change = scope:change - } - } - resolve_title_and_vassal_change = scope:change - hidden_effect = { - add_opinion = { - target = scope:fp2_james_0001_jewish_trader - modifier = received_title_county - } - } - scope:fp2_james_0001_thriving_community.county = { - add_county_modifier = { - modifier = fp2_thriving_jewish_community_modifier - years = 10 - } - set_county_culture = scope:fp2_james_0001_jewish_trader.culture - set_county_faith = scope:fp2_james_0001_jewish_trader.faith - } - scope:fp2_james_0001_jewish_trader.culture = { - change_cultural_acceptance = { - target = root.culture - value = medium_positive_culture_acceptance - desc = cultural_acceptance_gain_conversos_tolerance - } - } - - stress_impact = { - compassionate = minor_stress_impact_loss - greedy = minor_stress_impact_loss - } - ai_chance = { - base = 10 - ai_value_modifier = { - ai_honor = 1.5 - ai_greed = 1.5 - ai_zeal = -0.5 - } - } - } - - option = { - name = fp2_james.0001.c - scope:fp2_james_0001_thriving_community.county = { - add_county_modifier = { - modifier = fp2_thriving_jewish_community_modifier - years = 10 - } - } - scope:fp2_james_0001_jewish_trader.culture = { - change_cultural_acceptance = { - target = root.culture - value = low_positive_culture_acceptance - desc = cultural_acceptance_gain_conversos_tolerance - } - } - - stress_impact = { - compassionate = minor_stress_impact_loss - greedy = minor_stress_impact_loss - } - ai_chance = { - base = 10 - ai_value_modifier = { - ai_honor = 1.5 - ai_greed = 1.5 - ai_zeal = -0.5 - } - } - } -} - -scripted_effect fp2_polish_should_heritage_israelite_get_upset_effect = { - if = { - limit = { - scope:fp2_james_0002_conversos_character = { culture = { has_cultural_pillar = heritage_israelite } } - } - scope:fp2_james_0002_conversos_character.culture = { - change_cultural_acceptance = { - target = root.culture - value = low_negative_culture_acceptance - desc = cultural_acceptance_loss_conversos_tolerance - } - } - } -} - -# Suspect Conversos of secretly praciticing Judaism -fp2_yearly.9001 = { - type = character_event - title = fp2_james.0002.t - desc = fp2_james.0002.desc - theme = secret - override_background = { - reference = temple - } - left_portrait = { - character = root - animation = paranoia - } - right_portrait = { - character = scope:fp2_james_0002_conversos_character - animation = personality_cynical - } - - trigger = { - OR = { root.religion = religion:eastern_orthodox_religion root.religion = religion:catholic_religion root.religion = religion:protestant_religion } - is_landed = yes - NOT = { faith = faith:conversos } - } - - weight_multiplier = { - base = 1 - modifier = { - add = 1 - any_character_struggle = { - is_struggle_type = iberian_struggle - is_struggle_phase = struggle_iberia_phase_hostility - } - } - } - - immediate = { - every_sub_realm_county = { - limit = { - faith = faith:conversos - holder = { - liege = { # Don't convert player-Conversos territory - OR = { - is_ai = yes - NOT = { faith = faith:conversos } - } - } - } - } - add_to_list = fp2_james_0002_conversos_county - } - # Try to find a Conversos vassal if one exists - if = { - limit = { - any_vassal = { - faith = faith:conversos - is_available_ai = yes - } - } - random_vassal = { - limit = { - faith = faith:conversos - is_available_ai = yes - } - save_scope_as = fp2_james_0002_conversos_character - } - } - # Otherwise find a pool character - else_if = { - limit = { - any_pool_character = { - province = root.capital_province - faith = faith:conversos - } - } - random_pool_character = { - province = root.capital_province - limit = { - faith = faith:conversos - } - save_scope_as = fp2_james_0002_conversos_character - } - } - # Otherwise create one - else = { - create_character = { - template = spanish_conversos_character - location = root.capital_province - save_scope_as = fp2_james_0002_conversos_character - } - } - scope:fp2_james_0002_conversos_character = { - random_list = { - 50 = { - add_character_flag = is_secretly_jewish_flag - } - 50 = { - } - } - } - # Get a religion for them to potentially be secretly praciticing - religion:judaism_religion = { - random_faith = { - limit = { is_mainstream_jewish_faith = yes } - save_scope_as = fp2_james_0002_jewish_faith - } - } - } - - option = { - name = fp2_james.0002.a - custom_tooltip = fp2_james.0002.a.tt - hidden_effect = { - if = { - limit = { - scope:fp2_james_0002_conversos_character = { has_character_flag = is_secretly_jewish_flag } - } - send_interface_toast = { - type = event_toast_effect_good - title = fp2_james.0002.a.jewish_communities_thrive - every_in_list = { - list = fp2_james_0002_conversos_county - set_county_faith = scope:fp2_james_0002_jewish_faith - } - scope:fp2_james_0002_conversos_character = { - set_character_faith = scope:fp2_james_0002_jewish_faith - every_vassal = { - limit = { - faith = faith:conversos - is_available_ai = yes - } - set_character_faith = scope:fp2_james_0002_jewish_faith - } - } - } - } - else = { - send_interface_toast = { - type = event_toast_effect_good - title = fp2_james.0002.a.nothing_happened_toast - } - } - fp2_polish_should_heritage_israelite_get_upset_effect = yes - } - - stress_impact = { - zealous = medium_stress_impact_gain - } - ai_chance = { - base = 10 - ai_value_modifier = { - ai_honor = -0.5 - ai_zeal = 1.5 - } - } - } - - option = { - name = fp2_james.0002.b - duel = { - skill = intrigue - target = scope:fp2_james_0002_conversos_character - - 50 = { - compare_modifier = { - value = scope:duel_value - multiplier = 3.5 - } - desc = fp2_james.0002.b.succesful_interrogation - - if = { - limit = { scope:fp2_james_0002_conversos_character = { has_character_flag = is_secretly_jewish_flag } } - - send_interface_message = { # Begrudgingly added "unecessary" polish - type = event_prison_good - title = fp2_james.0002.t - right_icon = scope:fp2_james_0002_conversos_character - - rightfully_imprison_character_effect = { - TARGET = scope:fp2_james_0002_conversos_character - IMPRISONER = root - } - fp2_polish_should_heritage_israelite_get_upset_effect = yes - } - } - else = { - send_interface_message = { - type = event_intrigue_bad - title = fp2_james.0002.a.offended_conversos - right_icon = scope:fp2_james_0002_conversos_character - - reverse_add_opinion = { - target = scope:fp2_james_0002_conversos_character - modifier = hate_opinion - opinion = -30 - } - fp2_polish_should_heritage_israelite_get_upset_effect = yes - } - } - } - 50 = { - compare_modifier = { - value = scope:duel_value - multiplier = -3.5 - } - desc = fp2_james.0002.b.failed_interrogation - send_interface_message = { - type = event_intrigue_bad - title = fp2_james.0002.a.offended_conversos - right_icon = scope:fp2_james_0002_conversos_character - - every_sub_realm_county = { - custom = fp2_james_0002.b.failed_interrogation.tt - limit = { - faith = { - religion = { - OR = { - this = religion:christianity_religion - this = religion:judaism_religion - } - } - } - } - add_county_modifier = { - modifier = fp2_conversos_persecution_modifier - years = 10 - } - } - reverse_add_opinion = { - target = scope:fp2_james_0002_conversos_character - modifier = hate_opinion - opinion = -30 - } - fp2_polish_should_heritage_israelite_get_upset_effect = yes - } - } - } - - stress_impact = { compassionate = medium_stress_impact_gain } - ai_chance = { - base = 10 - ai_value_modifier = { - ai_zeal = 0.5 - } - } - } - - option = { # Imprison the suspect without trial - name = fp2_james.0002.c - - send_interface_message = { - type = event_prison_neutral - title = fp2_james.0002.t - right_icon = scope:fp2_james_0002_conversos_character - - imprison_character_effect = { - TARGET = scope:fp2_james_0002_conversos_character - IMPRISONER = root - } - fp2_polish_should_heritage_israelite_get_upset_effect = yes - - stress_impact = { - compassionate = medium_stress_impact_gain - diligent = medium_stress_impact_gain - just = medium_stress_impact_gain - callous = minor_stress_impact_loss - sadistic = minor_stress_impact_loss - zealous = minor_stress_impact_loss - } - } - - ai_chance = { - base = 10 - modifier = { - factor = 0 - OR = { - has_trait = compassionate - has_trait = diligent - has_trait = just - } - } - modifier = { - factor = 2 - OR = { - has_trait = callous - has_trait = sadistic - } - has_trait = zealous - } - } - } -} - -# Jewish people come fleeing persecution from a nearby realm -fp2_yearly.9002 = { - type = character_event - title = fp2_james.0003.t - desc = fp2_james.0003.desc - theme = secret - override_background = { - reference = throne_room - } - left_portrait = { - character = root - animation = paranoia - } - right_portrait = { - character = scope:fp2_james_003_jewish_refugee_leader - animation = beg - } - - trigger = { - NOT = { root.religion = religion:judaism_religion } - NOT = { faith = faith:conversos } - any_neighboring_and_across_water_top_liege_realm = { # There is someone to do persecuting - holder = { - is_ai = yes - NOT = { root.religion = religion:judaism_religion } - NOT = { faith = faith:conversos } - } - } - highest_held_title_tier >= tier_county - any_held_county = { - is_landless_type_title = no - title_province = { - geographical_region = world_europe_west_iberia - } - NOT = { # Don't give away the capital - this = this.holder.top_liege.capital_county - } - holder = { - any_held_title = { - title_tier = county - count >= 2 - } - } - } - } - - weight_multiplier = { - base = 1 - modifier = { - add = 1 - any_character_struggle = { - is_struggle_type = iberian_struggle - is_struggle_phase = struggle_iberia_phase_hostility - } - } - modifier = { - factor = 0.1 - any_county_in_region = { - region = world_europe_west_iberia - culture = culture:sephardi - } - } - } - - immediate = { - # Grab the neighbour for loc purposes - random_neighboring_and_across_water_top_liege_realm = { - limit = { - holder = { - is_ai = yes - NOT = { root.religion = religion:judaism_religion } - NOT = { faith = faith:conversos } - } - } - holder = { save_scope_as = fp2_james_003_intolerant_ruler } - } - # find a pool character - if = { - limit = { - any_pool_character = { - province = root.capital_province - religion = religion:judaism_religion - } - } - random_pool_character = { - province = root.capital_province - limit = { - religion = religion:judaism_religion - } - save_scope_as = fp2_james_003_jewish_refugee_leader - } - } - # Otherwise create one - else = { - create_character = { - template = spanish_jewish_merchant_character # May as well reuse the template - location = root.capital_province - save_scope_as = fp2_james_003_jewish_refugee_leader - } - } - # Get a religion for them to potentially be secretly praciticing - religion:judaism_religion = { - random_faith = { - limit = { is_mainstream_jewish_faith = yes } - save_scope_as = fp2_james_0003_jewish_faith - } - } - random_held_county = { - limit = { - is_landless_type_title = no - title_province = { - geographical_region = world_europe_west_iberia - } - NOT = { # Don't give away the capital - this = this.holder.top_liege.capital_county - } - holder = { - any_held_title = { - title_tier = county - count >= 2 - } - } - } - weight = { - modifier = { # Low-dev counties should be more highly considered - add = 50 - development_level <= medium_development_level - } - } - save_scope_as = fp2_james_0003_province_to_convert - } - } - - option = { # Offer the community protection in your realm - name = fp2_james.0003.a - create_title_and_vassal_change = { - type = granted - save_scope_as = change - add_claim_on_loss = no - } - scope:fp2_james_0003_province_to_convert.county = { - change_title_holder = { - holder = scope:fp2_james_003_jewish_refugee_leader - change = scope:change - } - } - resolve_title_and_vassal_change = scope:change - hidden_effect = { - add_opinion = { - target = scope:fp2_james_003_jewish_refugee_leader - modifier = received_title_county - } - } - scope:fp2_james_0003_province_to_convert.county = { - change_development_level = 1 - if = { - limit = { - root = { - is_ai = no - } - NOT = { - any_county_in_region = { - region = world_europe_west_iberia - culture = culture:sephardi - } - } - } - set_county_culture = scope:fp2_james_003_jewish_refugee_leader.culture - set_county_faith = scope:fp2_james_003_jewish_refugee_leader.faith - add_county_modifier = { - modifier = fp2_thriving_jewish_community_modifier - years = 10 - } - } - else = { - add_county_modifier = { - modifier = fp2_thriving_jewish_community_modifier - years = 10 - } - } - } - scope:fp2_james_003_jewish_refugee_leader.culture = { - change_cultural_acceptance = { - target = root.culture - value = medium_positive_culture_acceptance - desc = cultural_acceptance_gain_conversos_tolerance - } - } - - stress_impact = { - callous = minor_stress_impact_gain - greedy = minor_stress_impact_gain - compassionate = medium_stress_impact_loss - zealous = medium_stress_impact_gain - paranoid = medium_stress_impact_gain - } - ai_chance = { - base = 10 - ai_value_modifier = { - ai_honor = 1.5 - ai_zeal = -0.5 - } - } - } - - option = { - name = fp2_james.0003.b - scope:fp2_james_003_jewish_refugee_leader = { silent_disappearance_effect = yes } - - stress_impact = { - paranoid = minor_stress_impact_loss - zealous = minor_stress_impact_loss - } - ai_chance = { - base = 10 - ai_value_modifier = { - ai_honor = -0.5 - ai_zeal = 1.5 - } - } - } -} - ################################### # Toledan Nights # By James Beaumont