declare_war_interaction = { category = interaction_category_diplomacy common_interaction = yes special_interaction = declare_war_interaction interface = declare_war interface_priority = 70 popup_on_receive = yes pause_on_receive = no # this is handled by the interface instead desc = declare_war_desc is_shown = { scope:recipient != scope:actor scope:recipient = { is_playable_character = yes } scope:actor = { NOT = { is_at_war_with = scope:recipient } } } is_valid_showing_failures_only = { scope:actor = { custom_tooltip = { text = sworn_peace_tt NOT = { has_character_flag = sworn_peace } } NOT = { has_trait = incapable } can_attack_in_hierarchy = scope:recipient trigger_if = { limit = { NOT = { government_has_flag = can_start_war_with_raised_troops } } NOT = { has_raised_armies = yes } } trigger_else = { custom_description = { text = army_blocks_defender_army NOT = { any_army = { location.county.holder ?= scope:recipient } } } } has_any_display_cb_on = scope:recipient NOT = { is_allied_in_war = scope:recipient } custom_description = { text = "is_not_bankrupt" is_in_debt = no } NOT = { custom_description = { text = "is_in_an_activity" exists = involved_activity } } trigger_if = { limit = { culture = { has_cultural_parameter = cannot_attack_allies } } NOT = { is_allied_to = scope:recipient } } trigger_if = { limit = { culture = { has_cultural_parameter = cannot_attack_truces } } NOT = { has_truce = scope:recipient } } is_imprisoned = no trigger_if = { limit = { has_variable_list = subjugation_offer_under_consideration } custom_description = { text = is_not_considering_offer_of_subjugation NOT = { is_target_in_variable_list = { name = subjugation_offer_under_consideration target = scope:recipient } } } } trigger_if = { limit = { has_realm_law = japanese_bureaucracy_3 this != top_liege } custom_tooltip = { text = non_admin_vassal_japanese_bureaucracy_3 government_allows = administrative } } } scope:recipient = { custom_tooltip = { text = is_a_herder_recipient_tt NOT = { government_has_flag = government_is_true_herder } # herders can't fight } NOT = { is_tributary_of_suzerain_or_above = scope:actor } # can't fight your tributaries or your tributaries' tributaries NOT = { has_strong_hook = scope:actor } trigger_if = { limit = { is_imprisoned = yes } NOT = { imprisoner = scope:actor } } } scope:actor = { trigger_if = { limit = { NOT = { government_allows = administrative } liege ?= { has_realm_law_flag = vassal_all_wars_banned_permanent this != scope:actor } } custom_tooltip = { text = admin_all_vassal_wars_banned always = no } } trigger_if = { limit = { government_allows = administrative top_liege = scope:recipient.top_liege scope:recipient = { government_allows = administrative } top_liege != scope:recipient NOT = { top_participant_group:dynastic_cycle ?= { has_participant_group_parameter = dynastic_cycle_vassal_internal_wars_allowed } } } custom_tooltip = { text = admin_cannot_declare_internal_wars always = no } } trigger_if = { # Admin - Laws only allow frontier and naval themes to declare war limit = { government_allows = administrative top_liege != this top_liege = { this != scope:recipient.top_liege has_realm_law_flag = admin_vassal_wars_restricted } } custom_tooltip = { text = admin_all_vassal_wars_banned OR = { vassal_contract_has_flag = admin_theme_frontier vassal_contract_has_flag = admin_theme_naval } } } trigger_if = { # Admin - Laws only allow frontier and naval themes to declare war IF they have permission limit = { government_allows = administrative OR = { vassal_contract_has_flag = admin_theme_frontier vassal_contract_has_flag = admin_theme_naval } top_liege = { this != scope:recipient.top_liege has_realm_law_flag = admin_vassal_wars_permission_only NOT = { has_realm_law_flag = admin_vassal_wars_banned } } } custom_tooltip = { text = admin_vassal_wars_permission_only_desc has_variable = admin_permission_to_declare_war } } trigger_if = { # Admin - Laws prevent all vassals from declaring war limit = { government_allows = administrative OR = { vassal_contract_has_flag = admin_theme_frontier vassal_contract_has_flag = admin_theme_naval } top_liege = { this != scope:recipient.top_liege has_realm_law_flag = admin_vassal_wars_banned } } custom_tooltip = { text = admin_all_vassal_wars_banned always = no } } trigger_if = { limit = { scope:recipient = { OR = { has_subject_contract_group = tributary_celestial has_subject_contract_group = tributary_hegemonic } } is_independent_ruler = no # to avoid duplicating tooltips already applying to the top_liege } NOT = { scope:recipient = { is_tributary_of = scope:actor.top_liege } } } } scope:actor = { trigger_if = { limit = { has_government = landless_adventurer_government } custom_tooltip = { text = camp_located_in_defender_realm.tt domicile.domicile_location.county.holder = { NOR = { this = scope:recipient any_liege_or_above = { this = scope:recipient } } } } } } trigger_if = { limit = { scope:actor = { is_confederation_member = yes } } NOT = { scope:recipient = { is_member_of_confederation = scope:actor.confederation } } } } has_valid_target_showing_failures_only = { custom_description = { text = "declare_war_hook_on_liege" OR = { war_declarer_needs_hook_on_liege = no always = scope:hook } } scope:actor = { NOR = { is_at_war_with = scope:recipient custom_description = { #A vassal cannot go to war against someone their Liege is already at war with text = liege_is_at_war_with_recipient object = scope:recipient liege = { is_at_war_with = scope:recipient } } } } } send_options_exclusive = no send_option = { is_shown = { war_declarer_needs_hook_on_liege = yes } is_valid = { scope:actor = { has_usable_hook = liege } } flag = hook localization = WAR_LIEGE_HOOK can_invalidate_interaction = yes } should_use_extra_icon = { war_declarer_needs_hook_on_liege = yes scope:actor = { has_usable_hook = liege } } extra_icon = "gfx/interface/icons/character_interactions/hook_icon.dds" on_accept = { scope:actor = { #Feedback! hidden_effect = { send_interface_toast = { type = event_toast_effect_neutral title = declare_war_interaction_notification left_icon = scope:actor right_icon = scope:recipient custom_tooltip = declare_war_interaction_notification_tooltip show_as_tooltip = { if = { limit = { always = scope:hook } use_hook = liege } } } } #Has the instigator promised a vassal a war (vassal.2601)? if = { limit = { exists = var:promised_war var:promised_war = { is_alive = yes this != scope:recipient } } trigger_event = { id = vassal.2610 days = { 7 10 } } } if = { limit = { always = scope:hook } use_hook = liege } #Send break up event if they are your lover if = { limit = { has_relation_lover = scope:recipient NOT = { has_relation_rival = scope:recipient } #To enable really strange love stories any_character_war = { casus_belli = { primary_attacker = scope:actor primary_defender = scope:recipient any_target_title = { } } } } scope:recipient = { trigger_event = { id = lover.0103 days = { 14 30 } } } } #Invalidate any wars your vassals have going against recipient atm scope:recipient = { if = { limit = { any_character_war = { primary_attacker = { is_vassal_or_below_of = scope:actor trigger_if = { #Ai should never invalidate a player's war! limit = { this = { is_ai = no } } scope:actor = { is_ai = no } } } } } every_character_war = { limit = { primary_attacker = { is_vassal_or_below_of = scope:actor trigger_if = { #Ai should never invalidate a player's war! limit = { this = { is_ai = no } } scope:actor = { is_ai = no } } } } show_as_tooltip = { end_war = invalidated } #Actually ended in the event primary_attacker = { trigger_event = war_event.1001 } } } } #Notify defender's vassals if the war is targeting one or more of their titles scope:recipient = { if = { limit = { any_vassal = { save_temporary_scope_as = attacked_vassal any_character_war = { casus_belli = { primary_attacker = scope:actor primary_defender = scope:recipient any_target_title = { holder = { OR = { this = scope:attacked_vassal is_vassal_or_below_of = scope:attacked_vassal } } } } } } } every_vassal = { save_temporary_scope_as = attacked_vassal limit = { any_character_war = { casus_belli = { primary_attacker = scope:actor primary_defender = scope:recipient any_target_title = { holder = { OR = { this = scope:attacked_vassal is_vassal_or_below_of = scope:attacked_vassal } } } } } } send_interface_toast = { type = msg_war_declared_on_liege title = declare_war_interaction_notification left_icon = scope:actor right_icon = scope:recipient custom_tooltip = declare_war_interaction_notification_tooltip } } } } # If you are admin and had permission to start war, spend said permission if = { limit = { has_variable = admin_permission_to_declare_war } remove_variable = admin_permission_to_declare_war } } } auto_accept = yes } end_war_attacker_victory_interaction = { special_interaction = end_war_attacker_victory_interaction hidden = yes use_diplomatic_range = no secondary_scopes_optional = yes ai_targets = { ai_recipients = primary_war_enemies } ai_frequency_by_tier = { barony = 0 county = 1 duchy = 1 kingdom = 1 empire = 1 hegemony = 1 } # Depending on who was the attacker, we need to send a different notification message to the recipient. notification_text = { first_valid = { triggered_desc = { trigger = { scope:recipient = { any_character_war = { casus_belli = { primary_attacker = scope:actor } } } } desc = end_war_attacker_victory_attacker_desc } desc = end_war_attacker_victory_defender_desc } } populate_actor_list = { scope:actor = { every_close_family_member = { limit = { # Unlanded, at sender's court, child/sibling/nibling/grandchild bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:actor } } add_to_list = characters } } } populate_recipient_list = { scope:recipient = { every_close_family_member = { limit = { # Unlanded, at sender's court, child/sibling/nibling/grandchild bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:recipient } } add_to_list = characters } } } can_be_picked = { scope:war ?= { custom_tooltip = { text = hostage_exchange_invalid_for_crusade_tt NOR = { using_cb = undirected_great_holy_war using_cb = directed_great_holy_war } } custom_tooltip = { text = hostage_exchange_invalid_for_cb_tt bp2_hostage_exchange_invalid_cb_trigger = no } } } redirect = { # secondary recipient is always set, so we need to clear it # if can_send condition depends on the scope being empty clear_saved_scope = secondary_recipient } on_accept = { casus_belli = { primary_attacker = { save_scope_as = attacker_winner } primary_defender = { save_scope_as = defender_loser } } if = { limit = { scope:war ?= { using_cb = fp3_free_house_member_cb } } } else = { release_prisoners_of_war_effect = yes } # Hostages # Save scopes for clarity if = { limit = { scope:war ?= { NOR = { using_cb = undirected_great_holy_war using_cb = directed_great_holy_war } bp2_hostage_exchange_invalid_cb_trigger = no } } if = { limit = { exists = scope:secondary_actor scope:recipient = { is_landed_or_landless_administrative = yes } } hostage_depart_effect = { HOSTAGE = scope:secondary_actor WARDEN = scope:recipient HOME_COURT = scope:actor } } if = { limit = { exists = scope:secondary_recipient scope:actor = { is_landed_or_landless_administrative = yes } } hostage_depart_effect = { HOSTAGE = scope:secondary_recipient WARDEN = scope:actor HOME_COURT = scope:recipient } } } #Send notification to vassals hidden_effect = { scope:attacker_winner = { if = { limit = { any_vassal = { this != scope:defender_loser } } every_vassal = { limit = { this != scope:defender_loser } send_interface_toast = { type = msg_liege_war_ended_attacker_win title = war_event.notification_liege_win.t left_icon = scope:attacker_winner right_icon = scope:defender_loser custom_tooltip = war_event.1901 } } } } scope:defender_loser = { if = { limit = { any_vassal = { this != scope:attacker_winner } } every_vassal = { limit = { this != scope:attacker_winner } send_interface_toast = { type = msg_liege_war_ended_attacker_win title = war_event.notification_liege_loss.t left_icon = scope:defender_loser right_icon = scope:attacker_winner custom_tooltip = war_event.1902 } } } } } #Special bookmark event for Aella of Northumbria bookmark_867_northmen_aellas_capture_war_imprisonment_effect = yes end_war = attacker } on_decline = { } ai_potential = { is_at_war = yes any_character_war = { is_war_leader = root OR = { attacker_war_score >= 100 AND = { OR = { attacker_war_score >= 90 AND = { attacker_war_score >= 80 root = { dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_3 } } } } root = { has_perk = peacemaker_perk } primary_defender = { is_ai = yes } } AND = { OR = { attacker_war_score >= 90 AND = { attacker_war_score >= 80 root = { has_perk = peacemaker_perk } } } root = { dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_3 } } primary_defender = { is_ai = yes } } #SENT A SCARY SEVERED HEAD AAAAHHH AND = { attacker_war_score >= 70 primary_defender = { is_ai = yes save_temporary_scope_as = defender } root = { has_variable = peace_acceptance_head_scare var:peace_acceptance_head_scare = { this = scope:defender } } } primary_defender = { is_ai = yes has_variable = conqueror } } } } ai_will_do = { base = 0 modifier = { scope:war = { primary_attacker = scope:actor OR = { attacker_war_score >= 100 AND = { OR = { attacker_war_score >= 90 AND = { attacker_war_score >= 80 root = { dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_3 } } } } root = { has_perk = peacemaker_perk } primary_defender = { is_ai = yes } } AND = { OR = { attacker_war_score >= 90 AND = { attacker_war_score >= 80 root = { has_perk = peacemaker_perk } } } root = { dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_3 } } primary_defender = { is_ai = yes } } #SENT A SCARY SEVERED HEAD AAAAHHH AND = { attacker_war_score >= 70 primary_defender = { is_ai = yes save_temporary_scope_as = defender } root = { has_variable = peace_acceptance_head_scare var:peace_acceptance_head_scare = { this = scope:defender } } } AND = { NOR = { using_cb = undirected_great_holy_war using_cb = mongol_invasion_war using_cb = mongol_realm_invasion_war using_cb = mpo_gok_onslaught_cb } primary_defender = { is_ai = yes has_variable = conqueror } } } } add = 100 } modifier = { scope:war = { primary_defender = scope:actor attacker_war_score >= 100 days_since_max_war_score >= 180 } add = 100 } } ai_accept = { base = -99 compare_modifier = { target = scope:war value = attacker_war_score desc = "WARSCORE_MODIFIER" } modifier = { scope:war.casus_belli = { primary_attacker = { has_perk = peacemaker_perk this != scope:recipient } } add = peacemaker_value desc = "PEACEMAKER_PERK_MODIFIER" } modifier = { scope:war.casus_belli = { primary_attacker = { dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_3 } NOT = { this = scope:recipient } } } add = 10 desc = "NOMAD_LEGACY_PERK_MODIFIER" } modifier = { scope:war.casus_belli = { primary_defender = { save_temporary_scope_as = defender } primary_attacker = { has_variable = peace_acceptance_head_scare var:peace_acceptance_head_scare = { this = scope:defender } } primary_defender = { is_ai = yes } } add = 30 desc = "COWED_BY_SEVERED_HEAD_MODIFIER" } # Hostages modifier = { exists = scope:secondary_actor add = war_actor_hostage_value desc = WAR_OVERVIEW_HOSTAGE_OFFER_VALUE } modifier = { exists = scope:secondary_recipient add = war_recipient_hostage_value desc = WAR_OVERVIEW_HOSTAGE_DEMAND_VALUE } # The AI cannot accept the outcome, if they will lose all their land and you try to take a hostage from them modifier = { scope:war = { OR = { exists = scope:secondary_actor exists = scope:secondary_recipient } casus_belli = { any_target_title = { count >= 1 add_to_temporary_list = target_titles } } NOT = { scope:recipient = { any_held_title = { tier = tier_county NOT = { any_this_title_or_de_jure_above = { is_in_list = target_titles } } } } } } add = -10000 desc = WAR_OVERVIEW_HOSTAGE_DEMAND_BLOCKED } # This is a bit of a hidden modifier, only used to make sure we get the right icon when you force it through at 100 war score, and the opponent has more realm left modifier = { scope:war = { attacker_war_score >= 100 OR = { exists = scope:secondary_actor exists = scope:secondary_recipient } casus_belli = { any_target_title = { count >= 1 add_to_temporary_list = target_titles } } scope:recipient = { any_held_title = { tier = tier_county NOT = { any_this_title_or_de_jure_above = { is_in_list = target_titles } } } } } add = 1000 desc = "WARSCORE_MODIFIER" } } auto_accept = { trigger_if = { limit = { OR = { scope:war = { attacker_war_score >= 100 } AND = { scope:recipient = { is_ai = yes } primary_attacker = scope:recipient } scope:war.casus_belli = { # Conquerors know when to fold primary_attacker = { is_ai = yes current_military_strength >= scope:recipient.fifty_percent_more_of_current_military_strength } primary_defender = { is_ai = yes has_variable = conqueror this = scope:recipient } } } } always = yes } trigger_else = { always = no } # The auto accept kind of messes up the hostage interaction a bit, so we block the auto accept if they try to grab a hostage and all the opponent's land at the same time scope:war = { trigger_if = { limit = { OR = { exists = scope:secondary_actor exists = scope:secondary_recipient } casus_belli = { any_target_title = { count >= 1 add_to_temporary_list = target_titles } } NOT = { scope:recipient = { any_held_title = { tier = tier_county NOT = { any_this_title_or_de_jure_above = { is_in_list = target_titles } } } } } } always = no } } } is_valid_showing_failures_only = { scope:war = { has_valid_casus_belli = yes trigger_if = { # Cannot exchange hostages with soon to be landless limit = { OR = { exists = scope:secondary_actor exists = scope:secondary_recipient } casus_belli = { any_target_title = { count >= 1 add_to_temporary_list = target_titles } } } custom_tooltip = { text = hostage_no_land_after_war_tt scope:recipient = { any_held_title = { title_tier = county NOT = { any_this_title_or_de_jure_above = { is_in_list = target_titles } } } } } } } } } end_war_attacker_white_peace_interaction = { special_interaction = end_war_white_peace_interaction hidden = yes use_diplomatic_range = no secondary_scopes_optional = yes send_name = "WHITE_PEACE_INTERACTION" ai_targets = { ai_recipients = primary_war_enemies } ai_frequency_by_tier = { barony = 0 county = 12 duchy = 12 kingdom = 12 empire = 12 hegemony = 12 } # Depending on who was the attacker, we need to send a different notification message to the recipient. notification_text = { first_valid = { triggered_desc = { trigger = { scope:recipient = { any_character_war = { casus_belli = { primary_attacker = scope:actor } } } } desc = end_war_attacker_white_peace_attacker_desc } desc = end_war_attacker_white_peace_defender_desc } } redirect = { # secondary recipient is always set, so we need to clear it # if can_send condition depends on the scope being empty clear_saved_scope = secondary_recipient } populate_actor_list = { scope:actor = { every_close_family_member = { limit = { # Unlanded, at sender's court, child/sibling/nibling/grandchild bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:actor } } add_to_list = characters } } } populate_recipient_list = { scope:recipient = { every_close_family_member = { limit = { # Unlanded, at sender's court, child/sibling/nibling/grandchild bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:recipient } } add_to_list = characters } } } can_be_picked = { scope:war ?= { custom_tooltip = { text = hostage_exchange_invalid_for_crusade_tt NOR = { using_cb = undirected_great_holy_war using_cb = directed_great_holy_war } } custom_tooltip = { text = hostage_exchange_invalid_for_cb_tt bp2_hostage_exchange_invalid_cb_trigger = no } } } on_accept = { casus_belli = { primary_attacker = { save_scope_as = attacker_white_peace } primary_defender = { save_scope_as = defender_white_peace } } if = { limit = { scope:war ?= { using_cb = fp3_free_house_member_cb } } } else = { release_prisoners_of_war_effect = yes } # Hostages # Save scopes for clarity if = { limit = { scope:war ?= { NOR = { using_cb = undirected_great_holy_war using_cb = directed_great_holy_war } bp2_hostage_exchange_invalid_cb_trigger = no } } if = { limit = { exists = scope:secondary_actor scope:recipient = { is_landed_or_landless_administrative = yes } } hostage_depart_effect = { HOSTAGE = scope:secondary_actor WARDEN = scope:recipient HOME_COURT = scope:actor } } if = { limit = { exists = scope:secondary_recipient scope:actor = { is_landed_or_landless_administrative = yes } } hostage_depart_effect = { HOSTAGE = scope:secondary_recipient WARDEN = scope:actor HOME_COURT = scope:recipient } } } #Send notification to vassals hidden_effect = { scope:attacker_white_peace = { if = { limit = { any_vassal = { this != scope:defender_white_peace } } every_vassal = { limit = { this != scope:defender_white_peace } send_interface_toast = { type = msg_liege_war_ended_white_peace title = WAR_RESULTS_WHITE_PEACE left_icon = scope:attacker_white_peace right_icon = scope:defender_white_peace custom_tooltip = war_event.1903 } } } } scope:defender_white_peace = { if = { limit = { any_vassal = { this != scope:attacker_white_peace } } every_vassal = { limit = { this != scope:attacker_white_peace } send_interface_toast = { type = msg_liege_war_ended_white_peace title = WAR_RESULTS_WHITE_PEACE left_icon = scope:defender_white_peace right_icon = scope:attacker_white_peace custom_tooltip = war_event.1904 } } } } } end_war = white_peace } on_decline = { } ai_potential = { any_character_war = { count >= 1 casus_belli = { OR = { primary_attacker = root primary_defender = root } } } trigger_if = { limit = { exists = scope:war } NOR = { # Don't send inane white peace offers to the player scope:war = { casus_belli = { primary_defender = root primary_attacker = { is_ai = no } } attacker_war_score >= 10 } scope:war = { casus_belli = { primary_attacker = root primary_defender = { is_ai = no } } defender_war_score >= 70 } } } } ai_will_do = { base = 0 # Attacker concerned about defending in other wars modifier = { scope:war.casus_belli = { primary_attacker = root } scope:war = { war_days >= 365 attacker_war_score <= 0 } any_character_war = { this != scope:war casus_belli = { primary_defender = root } } add = { value = 10 if = { limit = { scope:war = { attacker_war_score <= -50 } } add = 40 } } } # Attacker Greed ai_value_modifier = { ai_greed = { if = { limit = { scope:war.casus_belli = { primary_attacker = root } scope:war = { war_days >= 365 attacker_war_score <= 10 } ai_greed > -20 } value = -0.25 } } ai_vengefulness = { if = { limit = { ai_vengefulness > 0 } value = -1 } } } # Defender prefers White Peace to loss modifier = { scope:war.casus_belli = { primary_defender = root } scope:war = { war_days >= 182 defender_war_score <= 15 } add = { value = 10 if = { limit = { scope:war = { defender_war_score <= -40 } } add = 50 } } } # Defenders want to end wars that's taking too long to win modifier = { scope:war.casus_belli = { primary_defender = root } scope:war = { war_days >= 365 } add = { value = scope:war.war_days divide = 30 if = { limit = { scope:war = { defender_war_score > 0 } } subtract = scope:war.defender_war_score } if = { # If you're this close, perhaps it's worth waiting a few more months for ticking warscore? limit = { scope:war = { defender_war_score >= 70 } } subtract = scope:war.defender_war_score } min = 0 } } # I'm in debt, how about a white peace? Defender modifier = { scope:war = { war_days >= 182 } scope:war.casus_belli = { primary_defender = root } OR = { debt_level >= 1 treasury_debt_level >= 1 } add = { value = debt_level multiply = 20 if = { limit = { scope:war = { defender_war_score > 0 }} subtract = scope:war.defender_war_score } if = { # Push through to the end, it's worth it at this point... limit = { scope:war = { defender_war_score >= 80 }} subtract = scope:war.defender_war_score } min = 0 } } # I'm in debt, how about a white peace? Attacker modifier = { scope:war = { war_days >= 182 } scope:war.casus_belli = { primary_attacker = root } OR = { debt_level >= 1 treasury_debt_level >= 1 } add = { value = debt_level multiply = 20 if = { limit = { scope:war = { attacker_war_score > 0 }} subtract = scope:war.attacker_war_score } min = 0 } } # Do not attempt white peace vs. players if you're losing modifier = { OR = { AND = { scope:war.casus_belli = { primary_attacker = root primary_defender = { is_ai = no } } scope:war = { defender_war_score >= 30 } } AND = { scope:war.casus_belli = { primary_defender = root primary_attacker = { is_ai = no } } scope:war = { attacker_war_score >= 30 } } } factor = 0 } # Can end with hostages of equalish value modifier = { exists = scope:secondary_recipient exists = scope:secondary_actor scope:war = { war_days >= 365 NOR = { defender_war_score >= 30 attacker_war_score >= 30 } } trigger_if = { limit = { scope:war.primary_attacker = scope:actor } interaction_relative_hostage_value > -10 } trigger_else = { interaction_relative_hostage_value > -20 } add = { value = 0 if = { limit = { interaction_relative_hostage_value < 0 } add = { value = interaction_relative_hostage_value multiply = -1 } } else = { add = interaction_relative_hostage_value } if = { limit = { scope:actor.ai_boldness < 0 } add = { value = scope:actor.ai_boldness multiply = -0.25 } } if = { limit = { scope:actor.ai_honor < 0 } add = { value = scope:actor.ai_honor multiply = 0.1 } } else = { add = { value = scope:actor.ai_honor multiply = 0.25 } } if = { limit = { scope:actor.ai_rationality < 0 } add = { value = scope:actor.ai_rationality multiply = 0.1 } } else = { add = { value = scope:actor.ai_rationality multiply = 0.25 } } if = { limit = { scope:actor.ai_greed > 0 } add = { value = scope:actor.ai_greed multiply = -0.1 } } else = { add = { value = scope:actor.ai_greed multiply = -0.25 } } } } # Can end with hostage demand modifier = { exists = scope:secondary_recipient NOT = { exists = scope:secondary_actor } scope:war = { war_days >= 365 NOR = { defender_war_score >= 30 attacker_war_score >= 30 } } add = { value = 0 add = { value = interaction_recipient_hostage_value multiply = 0.1 } if = { limit = { scope:actor.ai_boldness < 0 } add = { value = scope:actor.ai_boldness multiply = -0.25 } } if = { limit = { scope:actor.ai_honor < 0 } add = { value = scope:actor.ai_honor multiply = -0.25 } } else = { add = { value = scope:actor.ai_honor multiply = 0.25 } } if = { limit = { scope:actor.ai_rationality < 0 } add = { value = scope:actor.ai_rationality multiply = 0.25 } } else = { add = { value = scope:actor.ai_rationality multiply = 0.25 } } if = { limit = { scope:actor.ai_greed > 0 } add = { value = scope:actor.ai_greed multiply = 0.25 } } else = { add = { value = scope:actor.ai_greed multiply = -0.1 } } } } # I don't have time for this, I need to conquer modifier = { scope:war.casus_belli = { primary_defender = { this = scope:actor has_variable = conqueror } primary_attacker = { is_ai = yes } } add = 100 } } ai_accept = { base = -30 compare_modifier = { trigger = { scope:war.casus_belli = { primary_defender = scope:recipient } } target = scope:war value = attacker_war_score desc = "WARSCORE_MODIFIER" } compare_modifier = { trigger = { scope:war.casus_belli = { primary_attacker = scope:recipient } } target = scope:war value = defender_war_score desc = "WARSCORE_MODIFIER" } # Length of War compare_modifier = { target = scope:war trigger = { scope:war = { war_days >= 365 } } value = { value = war_days divide = 91 # 40 in 10 years } desc = "WAR_LENGTH" } # I'm in debt, how about a white peace? modifier = { scope:war = { war_days >= 182 } scope:war.casus_belli = { primary_defender = root } OR = { debt_level >= 1 treasury_debt_level >= 1 } add = { value = debt_level multiply = 20 } desc = COMPLETELY_BANKRUPT } # Attacker concerned about other wars modifier = { scope:war.casus_belli = { primary_attacker = scope:recipient } scope:recipient = { any_character_war = { this != scope:war primary_defender = scope:recipient } } add = 10 desc = CONCERN_ABOUT_OTHER_WARS } # Vengefulness ai_value_modifier = { trigger = { scope:war.casus_belli = { primary_defender = scope:recipient } } ai_vengefulness = { if = { limit = { scope:war.casus_belli = { primary_defender = scope:recipient } } value = -0.25 } } ai_greed = { if = { limit = { scope:war.casus_belli = { primary_attacker = scope:recipient } } value = -0.25 } } ai_zeal = { value = -0.2 if = { limit = { faith = { faith_hostility_level = { target = scope:actor.faith value = 2 } } } multiply = 2 } if = { limit = { faith = { faith_hostility_level = { target = scope:actor.faith value = 3 } } } multiply = 3 } if = { limit = { OR = { ai_zeal <= 0 faith = { faith_hostility_level = { target = scope:actor.faith value <= 0 } } } } value = 0 } } } # Peacemaker Perk modifier = { trigger = { scope:war.casus_belli = { primary_defender = scope:recipient primary_attacker = { has_perk = peacemaker_perk } } } add = peacemaker_value desc = "PEACEMAKER_PERK_MODIFIER" } modifier = { trigger = { scope:war.casus_belli = { primary_attacker = scope:recipient primary_defender = { has_perk = peacemaker_perk } } } add = peacemaker_value desc = "PEACEMAKER_PERK_MODIFIER" } modifier = { trigger = { scope:war.casus_belli = { primary_defender = scope:recipient primary_attacker = { dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_3 } } } } add = 10 desc = "NOMAD_LEGACY_PERK_MODIFIER" } modifier = { trigger = { scope:war.casus_belli = { primary_attacker = scope:recipient primary_defender = { dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_3 } } } } add = 10 desc = "NOMAD_LEGACY_PERK_MODIFIER" } modifier = { trigger = { scope:war.casus_belli = { primary_attacker = scope:recipient primary_attacker = { is_ai = yes save_temporary_scope_as = attacker } primary_defender = { has_variable = peace_acceptance_head_scare var:peace_acceptance_head_scare = { this = scope:attacker } } } } add = 30 desc = "COWED_BY_SEVERED_HEAD_MODIFIER" } modifier = { trigger = { scope:war.casus_belli = { primary_defender = scope:recipient primary_defender = { is_ai = yes save_temporary_scope_as = defender } primary_attacker = { has_variable = peace_acceptance_head_scare var:peace_acceptance_head_scare = { this = scope:defender } } } } add = 30 desc = "COWED_BY_SEVERED_HEAD_MODIFIER" } # Cultural Traditions modifier = { trigger = { scope:war.casus_belli = { primary_defender = scope:recipient primary_attacker = { culture = { has_cultural_parameter = facilitate_white_peace } } } } add = 10 desc = "TRADITION_BONUS_WHITE_PEACE" } modifier = { trigger = { scope:war.casus_belli = { primary_attacker = scope:recipient primary_defender = { culture = { has_cultural_parameter = facilitate_white_peace } } } } add = 10 desc = "TRADITION_BONUS_WHITE_PEACE" } # Struggles modifier = { trigger = { scope:actor = { OR = { any_character_struggle = { involvement = involved is_struggle_parameter_active_secondary_character_involvement_either_trigger = { PARAMETER = white_peace_acceptance_between_involved_or_interloper_with_region_easier CHAR = scope:recipient } } any_character_struggle = { involvement = interloper is_struggle_parameter_active_secondary_character_involvement_either_trigger = { PARAMETER = white_peace_acceptance_between_involved_or_interloper_with_region_easier CHAR = scope:recipient } } } } } add = 10 desc = "STRUGGLE_INVOLVED_OR_INTERLOPER_PHASE_BONUS" } # GoK war modifier = { desc = WAR_OVERVIEW_WHITE_PEACE_GOK add = -70 scope:war = { using_cb = mpo_gok_onslaught_cb primary_defender = scope:actor } } # GoK war but have counties occupied modifier = { desc = WAR_OVERVIEW_WHITE_PEACE_GOK_OCCUPATION add = { value = 0 scope:war.primary_defender = { every_sub_realm_county = { limit = { county_controller = scope:war.primary_attacker } add = 2 } } max = 200 } scope:war = { using_cb = mpo_gok_onslaught_cb attacker_war_score <= 25 primary_defender = { any_sub_realm_county = { county_controller = scope:war.primary_attacker } } primary_defender = scope:actor } } # Hostages modifier = { exists = scope:secondary_actor add = { value = war_actor_hostage_value multiply = 0.5 } desc = WAR_OVERVIEW_WHITE_PEACE_HOSTAGE_OFFER_VALUE } modifier = { exists = scope:secondary_recipient add = { value = war_recipient_hostage_value multiply = 0.5 } desc = WAR_OVERVIEW_WHITE_PEACE_HOSTAGE_DEMAND_VALUE } } is_valid_showing_failures_only = { exists = scope:war scope:war = { has_valid_casus_belli = yes } is_white_peace_possible = yes } } end_war_attacker_defeat_interaction = { special_interaction = end_war_attacker_defeat_interaction hidden = yes use_diplomatic_range = no secondary_scopes_optional = yes ai_targets = { ai_recipients = primary_war_enemies } ai_frequency_by_tier = { barony = 0 county = 1 duchy = 1 kingdom = 1 empire = 1 hegemony = 1 } # Depending on who was the attacker, we need to send a different notification message to the recipient. notification_text = { first_valid = { triggered_desc = { trigger = { scope:recipient = { any_character_war = { casus_belli = { primary_attacker = scope:actor } } } } desc = end_war_attacker_defeat_attacker_desc } desc = end_war_attacker_defeat_defender_desc } } populate_actor_list = { scope:actor = { every_close_family_member = { limit = { # Unlanded, at sender's court, child/sibling/nibling/grandchild bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:actor } } add_to_list = characters } } } populate_recipient_list = { scope:recipient = { every_close_family_member = { limit = { # Unlanded, at sender's court, child/sibling/nibling/grandchild bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:recipient } } add_to_list = characters } } } can_be_picked = { scope:war ?= { custom_tooltip = { text = hostage_exchange_invalid_for_crusade_tt NOR = { using_cb = undirected_great_holy_war using_cb = directed_great_holy_war } } custom_tooltip = { text = hostage_exchange_invalid_for_cb_tt bp2_hostage_exchange_invalid_cb_trigger = no } } } redirect = { # secondary recipient is always set, so we need to clear it # if can_send condition depends on the scope being empty clear_saved_scope = secondary_recipient } on_accept = { casus_belli = { primary_attacker = { save_scope_as = attacker_loser } primary_defender = { save_scope_as = defender_winner set_signature_weapon_effect = yes } } if = { limit = { scope:war ?= { using_cb = fp3_free_house_member_cb } } } else = { release_prisoners_of_war_effect = yes } # Hostages # Save scopes for clarity if = { limit = { scope:war ?= { NOR = { using_cb = undirected_great_holy_war using_cb = directed_great_holy_war } bp2_hostage_exchange_invalid_cb_trigger = no } } if = { limit = { exists = scope:secondary_actor scope:recipient = { is_landed = yes } } hostage_depart_effect = { HOSTAGE = scope:secondary_actor WARDEN = scope:recipient HOME_COURT = scope:actor } } if = { limit = { exists = scope:secondary_recipient scope:actor = { is_landed = yes } } hostage_depart_effect = { HOSTAGE = scope:secondary_recipient WARDEN = scope:actor HOME_COURT = scope:recipient } } } #Send notification to vassals hidden_effect = { scope:attacker_loser = { if = { limit = { any_vassal = { this != scope:defender_winner } } every_vassal = { limit = { this != scope:defender_winner } send_interface_toast = { type = msg_liege_war_ended_defender_win title = war_event.notification_liege_loss.t left_icon = scope:attacker_loser right_icon = scope:defender_winner custom_tooltip = war_event.1905 } } } } scope:defender_winner = { if = { limit = { any_vassal = { this != scope:attacker_loser } } every_vassal = { limit = { this != scope:attacker_loser } send_interface_toast = { type = msg_liege_war_ended_defender_win title = war_event.notification_liege_win.t left_icon = scope:defender_winner right_icon = scope:attacker_loser custom_tooltip = war_event.1906 } } } } } end_war = defender } on_decline = { } ai_potential = { is_at_war = yes any_character_war = { is_war_leader = root OR = { defender_war_score >= 100 AND = { OR = { attacker_war_score >= 90 AND = { attacker_war_score >= 80 root = { dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_3 } } } } root = { has_perk = peacemaker_perk } primary_defender = { is_ai = yes } } AND = { OR = { attacker_war_score >= 90 AND = { attacker_war_score >= 80 root = { has_perk = peacemaker_perk } } } root = { dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_3 } } primary_defender = { is_ai = yes } } AND = { defender_war_score >= 70 primary_attacker = { is_ai = yes save_temporary_scope_as = attacker } root = { has_variable = peace_acceptance_head_scare var:peace_acceptance_head_scare = { this = scope:attacker } } } } } } ai_will_do = { base = 0 modifier = { scope:war = { primary_defender = scope:actor OR = { defender_war_score >= 100 AND = { defender_war_score >= 90 scope:actor = { OR = { has_perk = peacemaker_perk culture = { has_cultural_parameter = can_end_defensive_wars_earlier } } } primary_attacker = { is_ai = yes } } AND = { defender_war_score >= 90 scope:actor = { dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_3 } } primary_attacker = { is_ai = yes } } AND = { defender_war_score >= 70 primary_attacker = { is_ai = yes save_temporary_scope_as = attacker } root = { has_variable = peace_acceptance_head_scare var:peace_acceptance_head_scare = { this = scope:attacker } } } } } add = 100 } modifier = { scope:war = { primary_attacker = scope:actor defender_war_score >= 100 days_since_max_war_score >= 180 } add = 100 } } ai_accept = { base = -99 compare_modifier = { target = scope:war value = defender_war_score desc = "WARSCORE_MODIFIER" } modifier = { add = 1000 scope:war.casus_belli = { primary_defender = scope:recipient } desc = "WOULD_WIN_MODIFIER" } modifier = { scope:war.casus_belli = { primary_defender = { has_perk = peacemaker_perk this != scope:recipient } } add = peacemaker_value desc = "PEACEMAKER_PERK_MODIFIER" } modifier = { scope:war.casus_belli = { primary_defender = { dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_3 } NOT = { this = scope:recipient } } } add = 10 desc = "NOMAD_LEGACY_PERK_MODIFIER" } modifier = { scope:war.casus_belli = { primary_attacker = { is_ai = yes save_temporary_scope_as = attacker } primary_defender = { has_variable = peace_acceptance_head_scare var:peace_acceptance_head_scare = { this = scope:attacker } } } add = 30 desc = "COWED_BY_SEVERED_HEAD_MODIFIER" } modifier = { scope:war.casus_belli = { primary_defender = { culture = { has_cultural_parameter = can_end_defensive_wars_earlier } this != scope:recipient } } add = 10 desc = "TRADITION_BONUS_DEFENSIVE_WARS" } # Hostages modifier = { exists = scope:secondary_actor add = war_actor_hostage_value desc = WAR_OVERVIEW_HOSTAGE_OFFER_VALUE } modifier = { exists = scope:secondary_recipient add = war_recipient_hostage_value desc = WAR_OVERVIEW_HOSTAGE_DEMAND_VALUE } } auto_accept = { OR = { scope:war = { defender_war_score >= 100 } AND = { scope:recipient = { is_ai = yes } primary_defender = scope:recipient } } } is_valid_showing_failures_only = { scope:war = { has_valid_casus_belli = yes } } } view_war_interaction = { category = interaction_category_diplomacy common_interaction = yes special_interaction = offer_peace_interaction interface = offer_peace use_diplomatic_range = no ignores_pending_interaction_block = yes is_shown = { scope:actor = { is_at_war_with = scope:recipient NOT = { any_character_war = { is_war_leader = scope:actor is_participant = scope:recipient } } } } auto_accept = yes } offer_peace_interaction = { category = interaction_category_diplomacy common_interaction = yes icon = war_won_icon special_interaction = offer_peace_interaction interface = offer_peace use_diplomatic_range = no is_shown = { scope:actor = { is_at_war_with = scope:recipient any_character_war = { is_war_leader = scope:actor is_participant = scope:recipient } } } auto_accept = yes }