scripted triggers

This commit is contained in:
Fishedotjpg 2026-11-18 14:45:30 +00:00
parent 134dc3348b
commit 648b12fbf0
29 changed files with 1559 additions and 1060 deletions

View file

@ -170,7 +170,7 @@ can_potentially_call_ally_trigger = {
$JOINER$ = {
trigger_if = {
limit = {
NOT = {
NOR = {
# Diarchs can join against other vassals.
this ?= $WARRIOR$.diarch
# Confederation members can join the confederation leader's defensive wars
@ -181,7 +181,6 @@ can_potentially_call_ally_trigger = {
}
}
}
}
NOT = {
target_is_liege_or_above = $WARRIOR$
@ -305,6 +304,16 @@ allows_declaring_war_against_target_trigger = {
}
}
}
trigger_if = {
limit = {
has_realm_law = japanese_bureaucracy_3
this != top_liege
}
custom_tooltip = {
text = non_admin_vassal_japanese_bureaucracy_3
government_has_mechanic = administrative
}
}
scope:defender_check = {
custom_tooltip = {
text = is_a_herder_recipient_tt
@ -320,6 +329,33 @@ allows_declaring_war_against_target_trigger = {
}
}
}
trigger_if = {
limit = {
gdp_is_protected_city_war_target_trigger = { TARGET = scope:defender_check }
NOT = { has_strong_usable_hook = liege }
}
trigger_if = {
limit = { NOT = { exists = scope:recipient } }
scope:defender_check = {
save_temporary_scope_as = recipient
}
}
scope:defender_check = {
trigger_if = {
limit = { vassal_contract_has_flag = free_city_obligation }
custom_tooltip = {
text = declare_war_target_is_free_city_tt
always = no
}
}
trigger_else = {
custom_tooltip = {
text = declare_war_target_is_chartered_city_tt
always = no
}
}
}
}
trigger_if = {
limit = { liege != this }
trigger_if = {
@ -370,6 +406,10 @@ allows_declaring_war_against_target_trigger = {
has_realm_law_flag = admin_vassal_wars_permission_only
}
}
custom_tooltip = {
text = admin_all_vassal_wars_banned
admin_governor_allows_declaring_war_trigger = yes
}
custom_tooltip = {
text = admin_vassal_wars_permission_only_desc
has_variable = admin_permission_to_declare_war
@ -450,6 +490,70 @@ allows_declaring_war_against_target_trigger = {
}
}
}
# Republican rulers must seek approval if the law demands it
trigger_if = {
limit = {
has_realm_law_flag = republic_war_approval_required
highest_liege_matching_rule:uses_assembly != scope:defender_check # Approval is not needed against the republic's ruler
}
custom_tooltip = {
text = must_have_assembly_approval_declare_war_desc
has_variable = has_assembly_approval_declare_war
}
}
#You're under Peace Privilege; no wars allowed against the opposite side
custom_tooltip = {
text = not_attack_gg_during_repose_tt
trigger_if = {
limit = {
situation:guelph_ghibelline ?= { situation_current_phase = repose }
OR = {
is_guelph_trigger = yes
is_ghibelline_trigger = yes
}
}
NOR = {
AND = {
is_guelph_trigger = yes
scope:recipient = { is_ghibelline_trigger = yes }
}
AND = {
is_ghibelline_trigger = yes
scope:recipient = { is_guelph_trigger = yes }
}
}
}
}
#The Guelphs won the GG Situation; no HRE wars against theocratic vassals
custom_tooltip = {
text = guelph_victory_hre_no_theocracy_cb_tt
trigger_if = {
limit = { exists = var:gg_ended_in_guelph_victory_no_hre_wars_on_theocratic_vassals }
NOT = {
this = title:e_hre.holder
scope:defender_check = {
is_vassal_of = title:e_hre.holder
government_has_flag = government_is_ecclesiastical
}
}
}
}
#... nor against rulers in Northern Italy
custom_tooltip = {
text = guelph_victory_hre_no_cb_tt
trigger_if = {
limit = { exists = var:gg_hre_no_cb_northern_italy }
NOT = {
this = title:e_hre.holder
scope:defender_check = {
primary_title = {
title_province = { geographical_region = gdp_guelph_ghibelline_northern_italy_region }
}
}
}
}
}
}
war_declarer_needs_hook_on_liege = {
@ -502,7 +606,7 @@ can_be_warrior_trigger = {
imprisoned = no
incapable = no
}
tgp_is_ceremonial_liege_trigger = no
is_ceremonial_liege = no
OR = {
can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = $ARMY_OWNER$ }
AND = {
@ -604,6 +708,7 @@ can_be_knight_trigger = {
}
this != liege.diarch
}
is_trader = no # Traders are away running a trade route
# knight permissions for players
trigger_if = {
limit = {
@ -748,10 +853,10 @@ using_de_jure_cb_trigger = {
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_cb = dismantle_holy_pretender_cb
using_cb = dismantle_byz_pretender_cb
using_cb = norman_conquest_cb
using_cb = norwegian_invasion_cb
}
}
@ -841,6 +946,17 @@ special_invasion_cb_seize_land_in_region_trigger = {
}
}
# keep player's land if they are vassal.
special_invasion_cb_seize_land_trigger = {
holder ?= {
top_liege ?= scope:defender
trigger_if = {
limit = { is_ai = no }
this = top_liege
}
}
}
can_join_war_liege_vassal_check_trigger = {
custom_description = {
text = "basic_ally_can_join_because_liege_or_vassals"
@ -1014,7 +1130,7 @@ can_use_viking_invasion_cbs_dlc_trigger = {
any_sub_realm_county = { is_coastal_county = yes }
trigger_if = {
limit = { is_ai = yes }
prestige >= 75
prestige >= minor_prestige_value
OR = {
top_liege = this
primary_title.tier >= tier_kingdom
@ -1090,7 +1206,7 @@ prisoners_of_war_trigger = {
any_prisoner = {
OR = {
this = scope:war.primary_attacker
scope:war.primary_attacker.primary_title = {
scope:war.primary_attacker.primary_title ?= {
place_in_line_of_succession = {
target = prev
value <= 3
@ -1104,7 +1220,7 @@ prisoners_of_war_trigger = {
any_prisoner = {
OR = {
this = scope:war.primary_defender
scope:war.primary_defender.primary_title = {
scope:war.primary_defender.primary_title ?= {
place_in_line_of_succession = {
target = prev
value <= 3
@ -1141,6 +1257,56 @@ religious_war_vassals_constraints = {
}
}
religious_war_faith_hostility_trigger = {
scope:attacker = {
faith = {
faith_hostility_level = {
target = scope:defender.faith
value >= religious_cb_enabled_hostility_level
}
}
top_liege != scope:defender.top_liege
}
}
religious_war_struggle_check_trigger = {
# Filter for struggles
trigger_if = {
limit = {
scope:defender = {
any_character_struggle = {
involvement = involved
has_struggle_phase_parameter = holy_wars_in_region_cannot_be_declared
}
}
}
exists = scope:target
trigger_if = {
limit = { scope:target.tier = tier_county }
scope:target = {
NOT = {
any_county_struggle = {
has_struggle_phase_parameter = holy_wars_in_region_cannot_be_declared
}
}
}
}
trigger_else = { # For Duchy and Kingdom Holy War
scope:target = {
any_in_de_facto_hierarchy = { # We only consider county within the realm of the target's holder
tier = tier_county
NOT = {
any_county_struggle = {
has_struggle_phase_parameter = holy_wars_in_region_cannot_be_declared
}
}
}
}
}
}
are_holy_wars_disabled_by_struggle_conciliation_trigger = no # Disabled against other involved faiths in FP2 Conciliation ending
}
herders_and_tributary_constraints = {
trigger_if = {
limit = { exists = scope:defender }
@ -1151,7 +1317,7 @@ herders_and_tributary_constraints = {
text = is_a_herder_defender_tt # herders can't fight
government_has_flag = government_is_herder
}
is_tributary_of_suzerain_or_above = scope:attacker # can't fight your tributaries or your tributaries' tributaries
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 = {
@ -1166,7 +1332,7 @@ herders_and_tributary_constraints = {
}
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
is_tributary_of_suzerain_or_above = scope:defender # can't attack your own suzerain
trigger_if = {
limit = {
exists = suzerain
@ -1199,11 +1365,7 @@ feudal_clan_tribal_conquest_constraints = {
AND = {
tier = tier_county
title_province = {
OR = {
has_holding_type = tribal_holding
has_holding_type = nomad_holding
has_holding_type = herder_holding
}
holding_is_tribal = yes
}
}
AND = {
@ -1211,11 +1373,7 @@ feudal_clan_tribal_conquest_constraints = {
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
}
holding_is_tribal = yes
}
}
}
@ -1224,23 +1382,279 @@ feudal_clan_tribal_conquest_constraints = {
NOR = {
government_has_flag = government_is_tribal
government_has_flag = government_is_nomadic
government_has_flag = government_is_landless_adventurer
}
short_term_gold < 200
short_term_treasury_or_gold < 200
OR = {
AND = {
government_has_mechanic = administrative
short_term_gold < 700
short_term_treasury_or_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
holding_is_tribal = yes
}
}
}
}
}
war_should_invalidate_defender_lost_target_titles_trigger = {
NOT = {
any_in_list = {
list = target_titles
any_in_de_jure_hierarchy = {
tier >= tier_county
holder ?= {
target_is_same_character_or_above = scope:defender
}
}
}
}
}
war_should_invalidate_defender_lost_target_lands_trigger = {
NOT = {
any_in_list = {
list = target_titles
any_in_de_jure_hierarchy = {
tier = tier_county
holder ?= {
target_is_same_character_or_above = scope:defender
}
}
}
}
}
religious_war_should_invalidate_faith_change_trigger = {
scope:war = {
OR = {
has_variable = invalidate_defender_faith_change
has_variable = invalidate_attacker_faith_change
}
}
}
# To prevent the AI wasting strong CBs on scattered counties
ai_aggressive_cb_constraints = {
trigger_if = {
limit = {
scope:attacker = {
is_ai = yes
}
}
scope:target ?= {
trigger_if = {
limit = { tier = tier_duchy }
any_in_de_jure_hierarchy = {
continue = { tier > tier_county }
count >= 2
tier = tier_county
holder ?= {
target_is_same_character_or_above = scope:defender
}
}
}
# kingdom
trigger_else_if = {
limit = { tier = tier_kingdom }
any_in_de_jure_hierarchy = {
continue = { tier > tier_county }
count >= 5
tier = tier_county
holder ?= {
target_is_same_character_or_above = scope:defender
}
}
}
# in case used in a dynamic level CB
trigger_else_if = {
limit = { tier = tier_county }
always = yes
}
# empire+
trigger_else = {
any_in_de_jure_hierarchy = {
continue = { tier > tier_county }
count >= 16
tier = tier_county
holder ?= {
target_is_same_character_or_above = scope:defender
}
}
}
}
}
}
ai_naval_expansion_cb_constraints = {
trigger_if = {
limit = {
scope:attacker = {
is_ai = yes
}
}
scope:attacker = {
OR = {
has_trait = ambitious
ai_boldness >= very_high_positive_ai_value
}
}
}
}
# Cooldown is set in on_declaration of expansion_cb and duchy_expansion_cb
ai_land_expansion_cb_constraints = {
trigger_if = {
limit = {
scope:attacker = {
is_ai = yes
is_governor = yes
}
}
scope:attacker = {
NOT = { has_variable = ai_land_expansion_cb_cooldown }
}
}
}
civil_war_is_local_player_in_faction_trigger = {
scope:attacker = {
OR = {
joined_faction ?= {
any_faction_member = { is_local_player = yes }
}
AND = {
is_local_player = yes
has_character_flag = should_become_independent
}
}
}
}
has_required_prestige_level_to_declare_war = {
trigger_if = {
limit = {
government_has_flag = government_uses_house_unity
house ?= {
has_house_unity_stage = antagonistic
}
culture = {
has_cultural_parameter = cb_lower_prestige_level_requirement
}
}
prestige_level >= {
value = $LEVEL$
subtract = 2
min = 0
}
}
trigger_else_if = {
limit = {
OR = {
AND = {
government_has_flag = government_uses_house_unity
house ?= {
has_house_unity_stage = antagonistic
}
}
culture = {
has_cultural_parameter = cb_lower_prestige_level_requirement
}
}
}
prestige_level >= {
value = $LEVEL$
subtract = 1
min = 0
}
}
trigger_else = {
prestige_level >= $LEVEL$
}
}
# NOTICE: should use in allowed_against_character_display_regardless since used defender.
has_required_piety_level_to_declare_war = {
trigger_if = {
limit = {
scope:defender ?= {
is_alive = yes
has_variable_list = humsacd_hofs
is_target_in_variable_list = {
name = humsacd_hofs
target = scope:attacker.faith
}
}
}
trigger_if = {
limit = {
OR = {
culture = {
has_cultural_parameter = cb_lower_piety_level_requirement
}
# Iberian Struggle Hostility Reward
house ?= {
OR = {
has_house_modifier = fp2_struggle_hostility_house_faith_modifier
has_house_modifier = fp2_struggle_hostility_house_combined_modifier
}
}
}
}
piety_level >= {
value = $LEVEL$
subtract = 2
min = 0
}
}
trigger_else = {
piety_level >= {
value = $LEVEL$
subtract = 1
min = 0
}
}
}
trigger_else = {
trigger_if = {
limit = {
OR = {
culture = {
has_cultural_parameter = cb_lower_piety_level_requirement
}
# Iberian Struggle Hostility Reward
house ?= {
OR = {
has_house_modifier = fp2_struggle_hostility_house_faith_modifier
has_house_modifier = fp2_struggle_hostility_house_combined_modifier
}
}
}
}
piety_level >= {
value = $LEVEL$
subtract = 1
min = 0
}
}
trigger_else = {
piety_level >= $LEVEL$
}
}
}
has_mandala_invasion_cb_trigger = {
house ?= { has_house_head_parameter = has_mandala_invasion_cb }
is_house_head = yes
}
depose_war_victory_trigger = {
OR = {
NOT = { exists = scope:attacker.var:initial_target }
scope:defender = scope:attacker.var:initial_target
scope:defender.primary_title.tier <= scope:attacker.var:target_tier
}
}