N3OW/common/scripted_triggers/00_war_and_peace_triggers.txt

992 lines
23 KiB
Text
Raw Normal View History

2025-12-03 20:29:31 +01:00

###TRIGGER LIST
#prisoner_gives_warscore_for_trigger - takes WAR and CHARACTER (primary enemy or one of their top 3 player heirs)
at_war_with_any_coreligionist_trigger = {
any_character_war = {
casus_belli = {
OR = {
primary_attacker = {
is_at_war_with = root
faith = root.faith
}
primary_defender = {
is_at_war_with = root
faith = root.faith
}
}
}
}
}
at_war_with_any_non_coreligionist_trigger = {
any_character_war = {
casus_belli = {
OR = {
primary_attacker = {
is_at_war_with = root
faith != root.faith
}
primary_defender = {
is_at_war_with = root
faith != root.faith
}
}
}
}
}
at_war_only_with_coreligionists_trigger = {
is_at_war = yes
NOT = {
any_character_war = {
casus_belli = {
OR = {
primary_attacker = {
is_at_war_with = root
faith != root.faith
}
primary_defender = {
is_at_war_with = root
faith != root.faith
}
}
}
}
}
}
joiner_not_already_in_another_war_with_any_target_war_participants_trigger = {
###Triggers to make sure the recipient doesn't end up in a war with someone they already have a war with###
# $WARRIOR$ — the already-warring character, actor in call / recipient in offer
# $JOINER$ — the ally, recipient in call / actor in offer
#Set the primary enemy
trigger_if = {
limit = { scope:target = { primary_attacker = $WARRIOR$ } }
scope:target = { primary_defender = { save_temporary_scope_as = primary_enemy } }
}
trigger_else = {
scope:target = { primary_attacker = { save_temporary_scope_as = primary_enemy } }
}
$JOINER$ = {
#recipient can't already be at war with the primary_enemy
custom_description = {
text = "is_already_war_enemy_of_primary_enemy"
subject = $JOINER$
object = scope:primary_enemy
NOT = {
any_war_enemy = { this = scope:primary_enemy }
}
}
#recipient can't already be at war with another enemy in target war
custom_description = {
text = "is_war_enemy_with_another_target_war_enemy"
subject = $JOINER$
NOT = {
any_war_enemy = {
this != scope:primary_enemy #Already handled above
OR = {
AND = {
scope:target = { primary_defender = scope:primary_enemy }
is_defender_in_war = scope:target
}
AND = {
scope:target = { primary_attacker = scope:primary_enemy }
is_attacker_in_war = scope:target
}
}
}
}
}
#recipient can't have a war enemy who is on actor's side in this war
custom_description = {
text = "is_war_enemy_with_my_war_ally"
subject = $JOINER$
NOT = {
any_war_enemy = {
OR = {
AND = {
scope:target = { primary_defender = $WARRIOR$ }
is_defender_in_war = scope:target
}
AND = {
scope:target = { primary_attacker = $WARRIOR$ }
is_attacker_in_war = scope:target
}
}
}
}
}
#recipient can't be on the same side in another war with primary_enemy
custom_description = {
text = "is_war_ally_of_primary_enemy"
subject = $JOINER$
object = scope:primary_enemy
NOT = {
any_character_war = {
OR = {
AND = {
is_defender = $JOINER$
any_war_defender = { this = scope:primary_enemy }
}
AND = {
is_attacker = $JOINER$
any_war_attacker = { this = scope:primary_enemy }
}
}
}
}
}
#recipient can't be on the same side in another war with another enemy in the target war
custom_description = {
text = "is_war_ally_of_another_target_enemy"
subject = $JOINER$
NOT = {
any_war_ally = {
this != scope:primary_enemy #Already handled above
OR = {
AND = {
scope:target = { primary_defender = scope:primary_enemy }
is_defender_in_war = scope:target
}
AND = {
scope:target = { primary_attacker = scope:primary_enemy }
is_attacker_in_war = scope:target
}
}
}
}
}
}
}
can_potentially_call_ally_trigger = {
# Can never call vassals to your own wars (their obligations are met via taxes and levies!)
custom_description = {
text = cannot_call_vassal_to_war
$JOINER$ = {
trigger_if = {
limit = {
NOT = {
# Diarchs can join against other vassals.
this ?= $WARRIOR$.diarch
# Confederation members can join the confederation leader's defensive wars
AND = {
is_confederation_member = yes
$WARRIOR$ = {
is_member_of_confederation = $JOINER$.confederation
}
}
}
}
NOT = {
target_is_liege_or_above = $WARRIOR$
}
}
}
}
# Can never call your liege to your own wars (they protect you only from foreign invaders, by being the war target instead of you) -- Unless you have the Nomadic Contract Right
custom_description = {
text = cannot_call_liege_to_war
$JOINER$ = {
trigger_if = {
limit = {
target_is_vassal_or_below = $WARRIOR$
$WARRIOR$ = {
vassal_contract_has_flag = vassal_contract_liege_forced_war_override
}
}
always = yes
}
trigger_else_if = {
limit = {
$JOINER$ = {
NOT = {
target_is_vassal_or_below = $WARRIOR$
}
}
}
always = yes
}
trigger_else = {
always = no
}
}
}
}
war_declarer_needs_hook_on_liege = {
scope:actor = {
top_liege != this
liege != scope:recipient
NAND = {
government_allows = administrative
liege = { government_allows = administrative }
}
NOT = {
vassal_contract_has_flag = vassal_contract_war_override
}
OR = {
AND = {
liege = scope:recipient.liege
liege = { has_realm_law_flag = vassal_internal_wars_banned }
}
liege = { has_realm_law_flag = vassal_all_wars_banned }
AND = {
has_realm_law = japanese_bureaucracy_2
NOT = { government_allows = administrative }
}
}
}
}
any_liege_or_above_is_participant_trigger = {
save_temporary_scope_as = trigger_war
$CHARACTER$ = {
any_liege_or_above = {
scope:trigger_war = { is_participant = prev }
}
}
}
can_use_conquest_cbs_trigger = {
OR = {
government_has_flag = government_is_tribal
government_has_flag = government_is_clan
government_has_flag = government_is_nomadic
government_has_flag = government_is_steppe_admin
faith = { has_doctrine_parameter = conquest_cb_enabled }
culture = { has_cultural_parameter = can_use_conquest_cbs }
AND = {
government_has_flag = government_is_japan_feudal
has_realm_law = imperial_expansion_law
}
}
}
can_be_warrior_trigger = {
is_available_quick = {
adult = yes
imprisoned = no
incapable = no
}
tgp_is_ceremonial_liege_trigger = no
OR = {
can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = $ARMY_OWNER$ }
AND = {
$ARMY_OWNER$.culture = { has_cultural_parameter = high_prowess_ignores_knight_restrictions }
prowess >= 10
}
# Japan Onna-musha
trigger_if = {
limit = {
#not for admin
$ARMY_OWNER$ = {
NOT = {
government_allows = administrative
}
culture = { has_cultural_parameter = non_admin_close_family_non_martial_gender_knights_in_defensive_wars }
}
culture = { has_cultural_parameter = non_admin_close_family_non_martial_gender_knights_in_defensive_wars }
}
AND = {
$ARMY_OWNER$ = { is_at_war_as_defender = yes }
OR = {
is_spouse_of = $ARMY_OWNER$
AND = {
is_close_family_of = $ARMY_OWNER$
is_married = no
}
}
}
}
}
}
can_be_knight_trigger = {
is_available_quick = {
ai = yes
hostage = no
}
can_be_warrior_trigger = { ARMY_OWNER = $ARMY_OWNER$ }
trigger_if = { # Admin governors cannot be knights
limit = {
$ARMY_OWNER$ = { government_allows = administrative }
is_courtier = no
}
primary_title ?= {
tier < tier_duchy
trigger_if = {
limit = { is_noble_family_title = yes }
always = no
}
}
}
trigger_if = {
limit = {
$ARMY_OWNER$.culture = {
has_cultural_parameter = minimum_prowess_for_knights
}
}
prowess >= 12
}
trigger_if = {
limit = {
is_clergy = yes
}
OR = {
faith = { has_doctrine_parameter = clergy_can_fight }
culture = { has_cultural_parameter = culture_clergy_can_fight }
AND = {
$ARMY_OWNER$.culture = {
has_cultural_parameter = high_prowess_ignores_knight_restrictions
}
prowess >= 10
}
}
}
OR = {
AND = {
$ARMY_OWNER$.culture = {
has_cultural_parameter = high_prowess_ignores_knight_restrictions
}
prowess >= 10
}
has_trait = order_member # Order Members will fight for their faith even if their faith says no
NOR = {
has_trait = blind
has_court_position = master_assassin_court_position #FP3 addition
}
}
trigger_if = {
limit = {
exists = liege.diarch
}
this != liege.diarch
}
}
# If you update one of the available triggers, update all of them. It's a lot better for performance to not have scripted triggers within scripted triggers when they're checked as often as these ones are.
can_be_commander_basic_trigger = {
is_available_quick = {
alive = yes
adult = yes
incapable = no
hostage = no
}
NAND = {
is_clergy = yes
NOR = {
has_trait = order_member # Order Members will fight for their faith even if their faith says no
faith = { has_doctrine_parameter = clergy_can_fight }
culture = { has_cultural_parameter = culture_clergy_can_fight }
}
}
OR = { # You can always lead your own armies
this = $ARMY_OWNER$
can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = $ARMY_OWNER$ }
}
trigger_if = {
limit = { $ARMY_OWNER$ = { is_ai = yes } }
is_ai = yes
highest_held_title_tier < tier_hegemony
}
}
# If you update one of the available triggers, update all of them. It's a lot better for performance to not have scripted triggers within scripted triggers when they're checked as often as these ones are.
can_be_commander_now_trigger = {
is_available_quick = {
alive = yes
adult = yes
imprisoned = no
travel = no
}
OR = { # You can always lead your own armies
this = $ARMY_OWNER$
can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = $ARMY_OWNER$ }
}
trigger_if = {
limit = { $ARMY_OWNER$ = { is_ai = yes } }
is_ai = yes
}
custom_description = {
text = ALREADY_IN_ACTIVITY
NOR = {
exists = involved_activity
has_variable = homage_liege_scope
has_character_flag = meditation_character_flag
has_character_flag = local_shrine_rite
has_character_flag = petition_liege_character_flag
has_character_flag = holding_court_character_flag
is_being_visited_on_tour_strict = yes
}
}
}
get_valid_commander_list_trigger = {
any_vassal = {
add_to_temporary_list = temp$LIST$
}
any_courtier = {
add_to_temporary_list = temp$LIST$
}
any_in_list = {
list = temp$LIST$
count = all
can_be_commander_now_trigger = { ARMY_OWNER = scope:army_owner }
add_to_temporary_list = $LIST$
}
}
prisoner_gives_warscore_for_trigger = {
save_temporary_scope_as = war_prisoner
#Character getting war score is primary defender
trigger_if = {
limit = { $WAR$.primary_defender = $CHARACTER$ }
$WAR$.primary_attacker = {
OR = {
this = scope:war_prisoner
#player_heir_position = {
#target = scope:war_prisoner
#value <= 3
#}
}
}
}
#Character getting war score is primary attacker
trigger_else_if = {
limit = { $WAR$ = { primary_attacker = $CHARACTER$ } }
$WAR$.primary_defender = {
OR = {
this = scope:war_prisoner
#player_heir_position = {
#target = scope:war_prisoner
#value <= 3
#}
}
}
}
trigger_else = {
always = no
}
}
using_non_ghw_holy_war_cb_trigger = {
OR = {
using_cb = minor_religious_war
using_cb = religious_war
using_cb = major_religious_war
}
}
using_holy_war_cb_trigger = {
OR = {
using_non_ghw_holy_war_cb_trigger = yes
using_cb = undirected_great_holy_war
using_cb = directed_great_holy_war
}
}
using_de_jure_cb_trigger = {
OR = {
using_cb = claim_cb
using_cb = de_jure_cb
using_cb = individual_county_de_jure_cb
using_cb = individual_duchy_de_jure_cb
using_cb = imperial_reconquest_cb
using_cb = dismantle_holy_pretender_cb
using_cb = dismantle_byz_pretender_cb
using_cb = norman_conquest_cb
using_cb = norwegian_invasion_cb
}
}
using_conquest_cb_trigger = {
OR = {
using_cb = county_conquest_cb
using_cb = duchy_conquest_cb
using_cb = ducal_conquest_cb
using_cb = ireland_laudabiliter_conquest_cb
using_cb = mongol_invasion_war
using_cb = mpo_gok_onslaught_cb
}
}
using_hierarchical_cb_trigger = {
OR = {
using_cb = tribal_subjugation_cb
using_cb = vassalization_cb
}
}
# In case is_civil_war is causing issues.
using_civil_war_cb_trigger = {
OR = {
using_cb = independence_faction_war
using_cb = liberty_faction_war
using_cb = populist_war
using_cb = claimant_faction_war
using_cb = depose_war
using_cb = refused_liege_demand_war
using_cb = nation_fracturing_faction_war
using_cb = peasant_war
}
}
special_invasion_cb_seize_land_in_region_trigger = {
OR = {
AND = { # For Duchies
tier = tier_duchy
OR = {
# Title is in the specified region
capital_vassal = {
title_province = {
geographical_region = $TARGET_REGION$
}
}
# Title is owned by the current holder of the invasion's target kingdom
AND = {
holder ?= $TARGET_KINGDOM$.holder
kingdom = $TARGET_KINGDOM$
}
}
}
AND = { # For Counties
tier = tier_county
OR = {
# Title is in the specified region
title_province = {
geographical_region = $TARGET_REGION$
}
AND = {
holder ?= $TARGET_KINGDOM$.holder
kingdom = $TARGET_KINGDOM$
}
}
trigger_if = {
# If our de jure liege is an existing duchy that would have been siezed in the duchy step, do not transfer the county (it has already been transferred).
limit = {
de_jure_liege ?= {
exists = holder
OR = {
capital_vassal = {
title_province = {
geographical_region = $TARGET_REGION$
}
}
AND = {
holder ?= $TARGET_KINGDOM$.holder
kingdom = $TARGET_KINGDOM$
}
}
}
}
always = no
}
}
}
}
can_join_war_liege_vassal_check_trigger = {
custom_description = {
text = "basic_ally_can_join_because_liege_or_vassals"
subject = $JOINER$
# actor is defender, attackers do not include recipient's liege or vassals
trigger_if = {
limit = {
$WARRIOR$ = { is_defender_in_war = scope:target }
}
$JOINER$ = {
trigger_if = {
limit = {
# Diarchs can join against other vassals.
NOT = { this ?= $WARRIOR$.diarch }
}
NOR = {
any_liege_or_above = {
is_attacker_in_war = scope:target
}
any_vassal_or_below = {
is_attacker_in_war = scope:target
}
}
}
}
}
# actor is attacker, defenders do not include recipient's liege or vassals
trigger_else_if = {
limit = {
$WARRIOR$ = { is_attacker_in_war = scope:target }
}
$JOINER$ = {
NOR = {
any_liege_or_above = {
is_defender_in_war = scope:target
}
any_vassal_or_below = {
is_defender_in_war = scope:target
}
}
}
}
# it's fine, whatever
trigger_else = {
always = yes
}
}
}
pressing_claim_of_character_trigger = {
custom_description = {
subject = this
object = $CHARACTER$
text = pressing_claim_of_character_trigger_text
save_temporary_scope_as = claim_presser
any_character_war = {
primary_attacker = scope:claim_presser
claimant ?= $CHARACTER$
}
}
}
is_religious_war = {
OR = {
using_cb = minor_religious_war
using_cb = religious_war
using_cb = major_religious_war
using_cb = excommunication_war
using_cb = undirected_great_holy_war
using_cb = directed_great_holy_war
}
}
conquest_cb_holder_under_target_can_be_vassalized = {
# If there is no holder they can't be vassalized!
holder ?= {
# We can only vassalize characters of a lower tier than us.
highest_held_title_tier < scope:attacker.highest_held_title_tier
# We can't vassalize Governors
NOT = { government_has_flag = government_is_special_administrative }
# Only (sub)vassals of the defender can be considered for transfer (no poaching vassals from 3rd parties without fighting them!)
target_is_liege_or_above = scope:defender
# *All* of a character's subrealm must be within the target area. If we're attacking for Jerusalem, we don't want to also be stealing parts of Egypt, Syria, etc.
any_sub_realm_county = {
count = all
target_is_de_jure_liege_or_above = scope:target_title
}
}
}
religious_cb_holder_under_target_can_be_vassalized = {
conquest_cb_holder_under_target_can_be_vassalized = yes
# Religious Tolerance Check
scope:attacker.faith = {
OR = {
# For all Faiths, if the attacker views this vassal's faith more favorably than the defender does, they are 'liberated' and become vassals under the attacker.
# For example, if Catholics are crusading against Ash'aris(viewed as Evil), any Messalian vassals (viewed as Hostile) will become vassals under the Catholic attacker.
faith_hostility_level_comparison = {
prev.holder.faith < scope:defender.faith
}
# Pluralist faiths always attempt to preserve vassals if possible, even if the vassal follows an Evil faith.
has_doctrine_parameter = pluralism_pluralistic_holy_wars_preserve_vassals
}
}
}
desirable_for_capture_trigger = {
OR = {
is_playable_character = yes
any_parent = { always = yes }
any_spouse = { is_playable_character = yes }
any_close_family_member = { is_playable_character = yes }
diplomacy >= very_high_skill_rating
martial >= very_high_skill_rating
stewardship >= very_high_skill_rating
intrigue >= very_high_skill_rating
learning >= very_high_skill_rating
has_trait = lifestyle_physician
has_trait = lifestyle_mystic
}
}
can_use_viking_invasion_cbs_trigger = {
trigger_if = { # Conquerors go for neighbors, no need to go overseas
limit = {
has_trait = conqueror
is_ai = yes
}
always = no
}
trigger_else_if = {
limit = {
has_fp1_dlc_trigger = yes
}
can_use_viking_invasion_cbs_dlc_trigger = yes
OR = {
#If the host has fp1, then we want Scandis to beat each other up and export the losers overseas, not form huge overseas empires themselves.
capital_province = {
NOT = { geographical_region = world_europe_north }
}
#Players are under no restrictions.
is_ai = no
}
}
trigger_else = {
has_fp1_dlc_trigger = no
can_use_viking_invasion_cbs_dlc_trigger = yes
}
}
can_use_viking_invasion_cbs_dlc_trigger = {
culture = { has_innovation = innovation_longboats }
faith = { has_doctrine = tenet_warmonger }
any_sub_realm_county = { is_coastal_county = yes }
trigger_if = {
limit = { is_ai = yes }
prestige >= 75
OR = {
top_liege = this
primary_title.tier >= tier_kingdom
}
NOT = {
any_liege_or_above = {
NOT = {
faith = { has_doctrine = tenet_warmonger }
}
}
}
}
}
coastal_or_neighboring_county_trigger = {
OR = {
is_coastal_county = yes
any_neighboring_county = {
holder = {
target_is_same_character_or_above = $CHARACTER$
}
}
}
}
# Non-vikings will for the AI just assert it's legal, as the target titles should already have fallen back to only allowing land and sea borders
neighboring_county_or_viking_conquest_trigger = {
OR = {
trigger_if = {
limit = {
$CHARACTER$ = {
can_use_viking_invasion_cbs_trigger = yes
}
}
is_coastal_county = yes
OR = {
$CHARACTER$ = { is_ai = no }
is_neighbor_to_realm = $CHARACTER$
$CHARACTER$ = {
NOT = {
any_sub_realm_title = {
tier = tier_county
NOT = {
is_connected_to = {
target = $CHARACTER$.capital_province.county
}
}
}
}
}
}
}
trigger_else = {
$CHARACTER$ = { is_ai = no }
}
any_neighboring_county = {
holder = {
target_is_same_character_or_above = $CHARACTER$
}
}
}
}
valid_struggle_cb_target_trigger = {
any_neighboring_county = {
holder = { target_is_same_character_or_above = $CHARACTER$ }
}
}
prisoners_of_war_trigger = {
OR = {
scope:defender = {
any_prisoner = {
OR = {
this = scope:war.primary_attacker
scope:war.primary_attacker.primary_title = {
place_in_line_of_succession = {
target = prev
value <= 3
}
}
}
}
}
#Prisoners of attackers
scope:attacker = {
any_prisoner = {
OR = {
this = scope:war.primary_defender
scope:war.primary_defender.primary_title = {
place_in_line_of_succession = {
target = prev
value <= 3
}
}
}
}
}
}
}
# Used for checking if a captured combatant is worth war-score.
character_is_potential_valuable_prisoner = {
OR = {
this = scope:primary_siege_attacker
this = scope:primary_siege_defender
is_heir_of = scope:primary_siege_attacker
is_heir_of = scope:primary_siege_defender
}
}
religious_war_vassals_constraints = {
trigger_if = {
limit = {
scope:attacker = { top_liege != this }
}
scope:attacker = {
NOT = { character_is_land_realm_neighbor = scope:defender }
}
scope:defender = { top_liege = this }
}
trigger_else = {
always = no
}
}
herders_and_tributary_constraints = {
trigger_if = {
limit = { exists = scope:defender }
scope:defender = {
save_temporary_scope_as = recipient # done for is_a_herder_defender_tt
NOR = {
custom_tooltip = {
text = is_a_herder_defender_tt # herders can't fight
2026-03-09 03:51:24 +00:00
government_has_flag = government_is_true_herder
2025-12-03 20:29:31 +01:00
}
is_tributary_of_suzerain_or_above = scope:attacker # can't fight your tributaries or your tributaries' tributaries
}
# You cannot attack your Confederation buddies tributaries
trigger_if = {
limit = {
suzerain != this
scope:attacker = { is_confederation_member = yes }
suzerain = { is_confederation_member = yes }
}
NOT = { scope:attacker.confederation = suzerain.confederation }
}
}
scope:attacker = { # Tributaries cannot attack their Suzerain or Suzerain's Confederation buddies
NOR = {
is_tributary_of_suzerain_or_above = scope:defender # can't attack your own suzerain
trigger_if = {
limit = {
suzerain != this
scope:defender = { is_confederation_member = yes }
suzerain = { is_confederation_member = yes }
}
# if you have a suzerain who's part of a confederation, you may not attack any of its members
scope:defender.confederation = suzerain.confederation
}
}
}
#Mandala Vassals shouldn't attack their Liege's Tributaries
trigger_if = {
limit = {
scope:attacker = {
is_independent_ruler = no
liege ?= { government_has_flag = government_is_mandala }
}
}
NOT = {
scope:defender = { is_tributary_of = scope:attacker.liege }
}
}
}
}
feudal_clan_tribal_conquest_constraints = {
OR = {
AND = {
tier = tier_county
title_province = {
OR = {
has_holding_type = tribal_holding
has_holding_type = nomad_holding
has_holding_type = herder_holding
}
}
}
AND = {
tier > tier_county
any_in_de_jure_hierarchy = {
tier = tier_county
title_province = {
OR = {
has_holding_type = tribal_holding
has_holding_type = nomad_holding
has_holding_type = herder_holding
}
}
}
}
}
scope:attacker = {
NOR = {
government_has_flag = government_is_tribal
government_has_flag = government_is_nomadic
}
short_term_gold < 200
OR = {
AND = {
government_has_flag = government_is_special_administrative
short_term_gold < 700
this != top_liege
}
any_sub_realm_county = {
title_province = {
OR = {
has_holding_type = tribal_holding
has_holding_type = nomad_holding
has_holding_type = herder_holding
}
}
}
}
}
}