fixes big evebts abd on actions plus mroe

This commit is contained in:
Greekman 2026-11-21 19:27:08 +00:00
parent c9d520e5a1
commit bce2aa31a1
207 changed files with 100377 additions and 9296 deletions

View file

@ -239,7 +239,7 @@ on_title_destroyed = {
# limit = {
# scope:landed_title = {
# has_clerical_region = yes
# root = { religion = religion:christianity_religion }
# root = { OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion } }
# }
# }
# situation:the_christian_church.situation_sub_region:core = {
@ -254,6 +254,10 @@ on_title_destroyed = {
# scope:title = the title that changes hands
# scope:previous_holder = previous holder. Might be dead
on_title_gain = {
on_actions = {
gdp_league_focus_on_title_gain
}
effect = {
if = {
limit = {
@ -305,23 +309,48 @@ on_title_gain = {
if = {
limit = { clerical_elector_title ?= scope:title }
pam_strip_illegal_cardinalate_effect = yes
if = {
limit = { clerical_elector_title ?= scope:title }
add_character_flag = cardinal_flag
situation:the_christian_church ?= {
add_manual_participant = prev
}
}
# Also catches a sitting Head of Faith who is handed a cardinalate
pam_vacate_head_of_faith_cardinalate_effect = yes
}
# A cardinal handed the Church seat must vacate the cardinalate
else_if = {
limit = {
scope:title = {
OR = {
is_head_of_faith = yes
this = title:k_papal_state
}
}
}
pam_vacate_head_of_faith_cardinalate_effect = yes
}
if = {
limit = {
exists = clerical_elector_title
scope:title = clerical_elector_title
}
add_character_flag = cardinal_flag
situation:the_christian_church ?= {
add_manual_participant = prev
}
}
# Unconditional: also catches a sitting Head of Faith who is handed a cardinalate
pam_vacate_head_of_faith_cardinalate_effect = yes
limit = {
scope:transfer_type = flag:election
government_has_flag = government_is_republic
}
scope:title = {
every_full_assembly_member = {
if = {
limit = {
has_character_modifier = gdp_popular_mandate_modifier
}
remove_character_modifier = gdp_popular_mandate_modifier
}
}
}
}
if = {
limit = {
scope:title = { has_clerical_region = yes }
religion = religion:christianity_religion
OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion }
}
situation:the_christian_church ?= {
add_manual_participant = prev
@ -334,7 +363,7 @@ on_title_gain = {
scope:transfer_type = flag:inheritance
scope:transfer_type = flag:appointment_succession
}
religion = religion:christianity_religion
OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion }
OR = {
scope:title = { has_clerical_region = yes }
scope:title = { has_title_law = clerical_appointment_law }
@ -359,7 +388,7 @@ on_title_gain = {
if = {
limit = {
pam_government_is_religious_playable_trigger = yes
religion != religion:christianity_religion
NOR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion }
NOT = { exists = primary_heir }
}
pam_seed_monk_courtiers_effect = yes
@ -443,7 +472,7 @@ on_title_gain = {
# The challenger registers only after the title change
if = {
limit = {
religion = religion:christianity_religion
OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion }
pam_title_is_church_seat_trigger = { TITLE = scope:title }
}
pam_family_becomes_prelate_effect = {
@ -453,7 +482,7 @@ on_title_gain = {
}
else_if = {
limit = {
religion = religion:christianity_religion
OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion }
scope:title = { has_clerical_region = yes }
NOT = {
any_held_title = {
@ -472,7 +501,7 @@ on_title_gain = {
pam_the_christian_church_clergy_gained_landed_title_catalyst_effect = yes
#if = {
# limit = {
# religion = religion:christianity_religion
# OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion }
# scope:title = { has_clerical_region = yes }
# exists = scope:previous_holder
# }
@ -2489,7 +2518,10 @@ on_title_gain = {
if = {
limit = {
is_governor = yes
NOT = { has_trait = governor }
NOR = {
has_trait = governor
has_character_flag = gdp_founding_republic
}
scope:title = {
tier >= root.main_administrative_tier
}
@ -2919,6 +2951,41 @@ on_title_gain = {
scope:title = { update_dynamic_coa = yes }
### MEMORIES - SHOULD STAY AT BOTTOM ###
# Creation effects stash these on the character, as on_title_gain fires before they can set them on the title
if = {
limit = {
exists = var:pending_adventurer_flavor_char
scope:title = { is_landless_type_title = yes }
NOT = { exists = scope:title.var:adventurer_flavor_char }
}
scope:title = {
set_variable = {
name = adventurer_creation_reason
value = root.var:pending_adventurer_creation_reason
}
set_variable = {
name = adventurer_flavor_char
value = root.var:pending_adventurer_flavor_char
}
}
}
else_if = {
limit = {
exists = var:pending_merchant_flavor_char
scope:title = { gdp_merchant_company_title_trigger = yes }
NOT = { exists = scope:title.var:merchant_flavor_char }
}
scope:title = {
set_variable = {
name = merchant_creation_reason
value = root.var:pending_merchant_creation_reason
}
set_variable = {
name = merchant_flavor_char
value = root.var:pending_merchant_flavor_char
}
}
}
# Ascended to the throne
if = {
limit = {
@ -2968,6 +3035,45 @@ on_title_gain = {
}
}
}
else_if = {
limit = { exists = scope:title.var:merchant_flavor_char }
create_character_memory = {
type = became_merchant_memory
participants = {
flavor_character = scope:title.var:merchant_flavor_char
}
}
#Only children should get childhood memories
if = {
limit = { is_adult = no }
scope:new_memory = { set_variable = childhood_memory }
}
scope:new_memory = {
save_scope_as = became_merchant_memory
set_variable = {
name = landless_title
value = scope:title
}
set_variable = {
name = reason
value = scope:transfer_type
}
set_variable = {
name = merchant_creation_reason
value = scope:title.var:merchant_creation_reason
}
if = {
limit = { exists = scope:lost_primary_title }
set_variable = {
name = old_primary_title
value = scope:lost_primary_title
}
}
if = { # Error suppression
limit = { exists = var:landless_title }
}
}
}
else = {
# Overwrite if there is a more specific Reason
root = {
@ -3324,9 +3430,9 @@ on_title_gain = {
# if = {
# limit = {
# scope:title = title:c_jerusalem
# religion = religion:christianity_religion
# OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion }
# scope:previous_holder ?= {
# NOT = { religion = religion:christianity_religion }
# NOT = { OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion } }
# }
# NOR = {
# scope:transfer_type = flag:created
@ -3345,9 +3451,9 @@ on_title_gain = {
# limit = {
# scope:title.tier = tier_county
# NOT = { scope:title = title:c_jerusalem }
# religion = religion:christianity_religion
# OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion }
# scope:previous_holder ?= {
# NOT = { religion = religion:christianity_religion }
# NOT = { OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion } }
# }
# NOR = {
# scope:transfer_type = flag:created
@ -3409,22 +3515,72 @@ on_title_gain = {
}
}
}
#########
# GDP #
#########
if = {
limit = {
scope:title = { gdp_merchant_company_title_trigger = yes }
NOT = { has_trait = lifestyle_merchant }
government_has_flag = government_is_merchant # exclude patricians
}
add_trait = lifestyle_merchant
}
if = {
limit = {
has_gdp_dlc_trigger = yes
}
if = {
limit = { scope:title = { is_noble_family_title = yes } }
hanseatic_sync_family_head_benefits_effect = { CHARACTER = root }
scope:previous_holder ?= {
hanseatic_sync_family_head_benefits_effect = { CHARACTER = this }
}
}
if = {
limit = {
scope:title = {
tier = tier_county
is_noble_family_title = no
}
}
hanseatic_sync_county_benefits_effect = { COUNTY = scope:title }
}
if = {
limit = {
scope:title = { is_landless_type_title = no }
}
if = {
limit = { has_trait = dealbreaker }
remove_trait = dealbreaker
}
every_secret = {
type = secret_dealbreaker
remove_secret = yes
}
}
}
}
events = {
roman_restoration.0005 #New Roman Emperor gets Augustus trait. (old holder, if still alive, loses it)
roman_restoration.0199 #Restoring the Pentarchy.
title_event.0021 # Rename/recolor Britannia based on founder's culture; applied immediately on creation
# NEOW 2555: event not loaded. roman_restoration.0005 #New Roman Emperor gets Augustus trait. (old holder, if still alive, loses it)
# NEOW 2555: event not loaded. roman_restoration.0199 #Restoring the Pentarchy.
# NEOW 2555: event not loaded. title_event.0021 # Rename/recolor Britannia based on founder's culture; applied immediately on creation
delay = { days = 1 }
NEOW_grant_title.001
# NEOW 2555: event not loaded. NEOW_grant_title.001
realm_maintenance.2001 #Big notification about inheriting emperor tier title
british_isles.1032 # Danelaw-England partition calc.
title_event.0001 # Rename West Francia to France
title_event.0002 # Rename East Francia to Germany
title_event.0011 # Asturias becomes Leon upon emergence of Castille
# NEOW 2555: event not loaded. british_isles.1032 # Danelaw-England partition calc.
# NEOW 2555: event not loaded. title_event.0001 # Rename West Francia to France
# NEOW 2555: event not loaded. title_event.0002 # Rename East Francia to Germany
# NEOW 2555: event not loaded. title_event.0011 # Asturias becomes Leon upon emergence of Castille
# If we weren't already in a diarchy but should be, put us in one.
diarchy.0011
ep3_emperor_yearly.2020 # EP3: The Patriarch refuses to crown you as new emperor because you have a criminal trait
empire_faith_gate.0001 # Empire Faith Gate: contested-empire legitimacy on empire gain
gdp_merchant_family.9010 # Merhcant child
}
}
@ -3475,30 +3631,22 @@ on_title_gain_inheritance = {
becomes_independent = { change = scope:change }
}
}
# if = {
# limit = {
# scope:title = {
# OR = {
# this = title:e_mongol_empire
# AND = {
# exists = global_var:greatest_of_khans_title
# this = global_var:greatest_of_khans_title
# }
# }
# }
# has_character_flag = gain_mongol_succession_dread
# }
# add_dread = 50
# }
# else_if = {
# limit = {
# OR = {
# scope:title = title:h_roman_empire
# scope:title = title:h_eastern_roman_empire
# }
# }
# set_variable = uses_custom_caesar_flavourization
# }
#########
# GDP #
#########
gdp_merchant_patron_change_on_title_transfer_effect = yes
# CE3 achievement: Where There's a Will — inherited from the murdered cleric
if = {
limit = {
exists = var:ce3_will_victim
scope:previous_holder ?= var:ce3_will_victim
}
add_achievement_global_variable_effect = {
VARIABLE = ce3_13_where_theres_a_will_achievement_unlocked
VALUE = yes
}
}
}
}
@ -3622,7 +3770,11 @@ on_title_gain_usurpation = {
# scope:new_holder = new holder.
on_title_lost = {
events = {
british_isles.1033 # Danelaw-England partition calc.
# NEOW 2555: event not loaded. british_isles.1033 # Danelaw-England partition calc.
}
on_actions = {
gdp_league_focus_on_title_lost
}
effect = {
@ -3874,6 +4026,31 @@ on_title_lost = {
# EP3 LAAMP SUPPORTER INVALIDATION
ep3_laamp_supporter_invalidated_effect = yes
# GDP REPUBLIC DESTRUCTION - last landed county lost
if = {
limit = {
gdp_holds_republic_title_trigger = yes # title loser is a republic leader
scope:title = { # lost title is landed county
tier = tier_county
is_landless_type_title = no
is_noble_family_title = no
}
NOT = { # lost title is last held landed county
any_held_county = {
is_landless_type_title = no
is_noble_family_title = no
NOT = { this = scope:title }
}
}
}
random_held_title = {
limit = { gdp_is_republic_title_trigger = yes }
save_scope_as = republic_title
}
# Destroy title - this triggers on_title_destroyed and on_vassal_change
scope:new_holder = { destroy_title = scope:republic_title }
}
# EP3 - Handle admin estates when they end up outside the realm
if = {
limit = {
@ -4198,61 +4375,62 @@ on_title_lost = {
# BP3 - Inspector perks cleanup effect
landless_inspector_cleanup_modifier = yes
#End Greatest of Khans story if title was lost
if = {
limit = {
any_owned_story = {
story_type = story_greatest_of_khans
}
global_var:greatest_of_khans_title ?= {
this = scope:title
}
OR = {
NOT = {
exists = scope:new_holder
}
scope:new_holder = {
NOR = {
AND = {
exists = dynasty
dynasty ?= root.dynasty
}
is_grandchild_of = root
is_child_of = root
}
}
}
}
if = {
limit = {
is_alive = yes
}
trigger_event = {
id = mpo_greatest_of_khans.0040
days = 1
}
}
else_if = {
limit = {
exists = root.player_heir
exists = root.dynasty
player_heir.dynasty ?= root.dynasty
}
player_heir ?= {
trigger_event = {
id = mpo_greatest_of_khans.0040
days = 1
}
}
}
else = {
every_owned_story = {
limit = { story_type = story_greatest_of_khans }
end_story = yes
}
remove_character_modifier = the_great_khan_modifier
}
}
# NEOW 2555: disabled Great Khan event has no live title-transfer hook.
#End Greatest of Khans story if title was lost
# if = {
# limit = {
# any_owned_story = {
# story_type = story_greatest_of_khans
# }
# global_var:greatest_of_khans_title ?= {
# this = scope:title
# }
# OR = {
# NOT = {
# exists = scope:new_holder
# }
# scope:new_holder = {
# NOR = {
# AND = {
# exists = dynasty
# dynasty ?= root.dynasty
# }
# is_grandchild_of = root
# is_child_of = root
# }
# }
# }
# }
# if = {
# limit = {
# is_alive = yes
# }
# trigger_event = {
# id = mpo_greatest_of_khans.0040
# days = 1
# }
# }
# else_if = {
# limit = {
# exists = root.player_heir
# exists = root.dynasty
# player_heir.dynasty ?= root.dynasty
# }
# player_heir ?= {
# trigger_event = {
# id = mpo_greatest_of_khans.0040
# days = 1
# }
# }
# }
# else = {
# every_owned_story = {
# limit = { story_type = story_greatest_of_khans }
# end_story = yes
# }
# remove_character_modifier = the_great_khan_modifier
# }
# }
#Coronation loyalty modifier
if = {
limit = {
@ -4402,6 +4580,26 @@ on_title_lost = {
}
}
}
else_if = { # Liegeless Patricians become Merchants or go to the pool
limit = {
government_has_flag = government_is_republic
NOT = { has_character_flag = government_republic_conversion_protection }
}
if = {
limit = { exists = var:republic_destroyer }
var:republic_destroyer = { save_scope_as = destroyer }
}
else = {
# due to effect order we cannot be sure this is the destroyer
scope:new_holder = { save_scope_as = destroyer }
set_variable = {
name = republic_destroyer
value = scope:destroyer
weeks = 1
}
}
gdp_destroyed_republic_patrician_effect = { DESTROYER = scope:destroyer }
}
}
else_if = {
limit = {
@ -4440,18 +4638,79 @@ on_title_lost = {
#########
# PAM #
#########
if = {
limit = {
scope:title = {
has_clerical_region = yes
root = { OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion } }
scope:new_holder = { NOT = { OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion } } }
}
}
situation:the_christian_church.situation_sub_region:core = {
remove_clerical_realm_from_sub_region = scope:title
}
}
#########
# GDP #
#########
# NEOW 2555: 1178 Guelph/Ghibelline title changes remain disabled.
#GG: Account for custom-made HRE and Popes in 1178
# if = {
# limit = {
# scope:title = {
# has_clerical_region = yes
# root = { religion = religion:christianity_religion }
# scope:new_holder = { NOT = { religion = religion:christianity_religion } }
# }
# game_start_date = 1178.10.1
# scope:new_holder = { is_from_ruler_designer = yes }
# }
# situation:the_christian_church.situation_sub_region:core = {
# remove_clerical_realm_from_sub_region = scope:landed_title
# #Ghibellines/HRE
# if = {
# limit = {
# scope:title = { this = title:e_hre }
# }
# remove_variable = ghibelline_leader
# scope:new_holder = { set_variable = ghibelline_leader }
# recalculate_participant_group = situation:guelph_ghibelline
# }
# #Guelphs
# if = {
# limit = {
# scope:title = { this = title:d_commune_verona }
# }
# remove_variable = guelph_leader
# scope:new_holder = { set_variable = guelph_leader }
# recalculate_participant_group = situation:guelph_ghibelline
# }
# }
# #GG: You don't get to be a leader as landless, sorry
# if = {
# limit = {
# exists = situation:guelph_ghibelline
# OR = {
# has_variable = guelph_leader
# has_variable = ghibelline_leader
# }
# is_landed = no
# }
# try_set_up_new_gg_leader_effect = yes
# }
gdp_merchant_patron_change_on_title_transfer_effect = yes
burgher_broken_charter_effect = yes
if = {
limit = { scope:title = { is_noble_family_title = yes } }
hanseatic_sync_family_head_benefits_effect = { CHARACTER = root }
scope:new_holder ?= {
hanseatic_sync_family_head_benefits_effect = { CHARACTER = this }
}
}
if = {
limit = {
scope:title = {
tier = tier_county
is_noble_family_title = no
}
}
hanseatic_sync_county_benefits_effect = { COUNTY = scope:title }
}
}
}
@ -5180,6 +5439,54 @@ on_vassal_change = {
resolve_title_and_vassal_change = scope:change
}
}
### If a republic family becomes independent or part of a non-Republic...
if = {
limit = {
government_has_flag = government_is_republic
NOT = { has_character_flag = gdp_becoming_patrician }
NOT = { has_character_flag = government_republic_conversion_protection }
is_landed = no
any_held_title = { is_noble_family_title = yes }
liege = {
OR = {
this = root # independent
NOT = { government_has_flag = government_is_republic }
}
}
}
# Become a Merchant or go to the pool
if = {
limit = { exists = var:republic_destroyer }
var:republic_destroyer = { save_scope_as = destroyer }
}
else = {
# due to effect order we cannot be sure this is the destroyer
scope:old_liege = { save_scope_as = destroyer }
set_variable = {
name = republic_destroyer
value = scope:destroyer
weeks = 1
}
}
gdp_destroyed_republic_patrician_effect = { DESTROYER = scope:destroyer }
}
### A landed republic governor becomes independent to form a new republic
if = {
limit = {
government_has_flag = government_is_republic
is_landed = yes
this = highest_liege_matching_rule:uses_assembly
NOT = { has_character_flag = gdp_recently_founded_republic }
scope:old_liege = {
government_has_flag = government_is_republic
is_alive = yes
is_landed = yes
this = highest_liege_matching_rule:uses_assembly
this != root
}
}
gdp_found_a_republic_effect = yes
}
# Empire Faith Gate: sync the empire-holders list when an empire-tier ruler gains or loses independence.
if = {
limit = {
@ -5530,9 +5837,58 @@ on_realm_capital_change = {
if = {
limit = {
is_landed = no
is_in_army = no
is_travelling = no
NOT = { exists = involved_activity }
should_in_default_location_trigger = yes
}
set_location_to_default = yes
}
}
}
# In republics - move patricians to realm capital
if = {
limit = { gdp_is_assembly_head_trigger = yes }
capital_province = { save_scope_as = capital_province }
# Move the ruler's capital and domicile
if = {
limit = {
any_held_title = { is_noble_family_title = yes }
}
every_held_title = {
limit = {
is_noble_family_title = yes
}
set_capital_county = scope:capital_province.county
}
domicile ?= {
move_domicile = scope:capital_province
}
if = {
limit = {
is_landed = no
should_in_default_location_trigger = yes
}
set_location_to_default = yes
}
}
# And the same for all patrician vassals
every_vassal = {
limit = {
exists = domicile
domicile = { is_domicile_type = merchant_company }
}
every_held_title = {
limit = {
is_noble_family_title = yes
}
set_capital_county = scope:capital_province.county
}
domicile ?= {
move_domicile = scope:capital_province
}
if = {
limit = {
is_landed = no
should_in_default_location_trigger = yes
}
set_location_to_default = yes
}
@ -5548,3 +5904,68 @@ on_realm_capital_change = {
# Not called if new primary title is the same as the previous primary title
on_primary_title_change = {
}
on_term_ended_events = {
effect = {
if = {
limit = { scope:previous_holder = scope:new_holder }
# Re-elected (root)
scope:title ?= {
every_full_assembly_member = {
limit = {
is_ai = no
}
trigger_event = republic_event.0051
}
}
}
else = {
# Elected (root = winner)
scope:title ?= {
every_full_assembly_member = {
limit = {
is_ai = no
}
trigger_event = republic_event.0050
}
}
}
}
}
on_term_ended = {
on_actions = { on_term_ended_events }
effect = {
if = {
limit = { scope:previous_holder = scope:new_holder }
every_player = {
limit = {
OR = {
this = root
is_vassal_or_below_of = root
}
}
if = {
limit = { this = root }
send_interface_toast = {
type = event_toast_effect_good
title = term_ended_reelected_toast_self
left_icon = scope:title
custom_tooltip = term_ended_reelected_toast_self.desc
}
}
else = {
send_interface_toast = {
type = event_toast_effect_neutral
title = term_ended_reelected_toast
left_icon = scope:new_holder
right_icon = scope:title
custom_tooltip = term_ended_reelected_toast.desc
}
}
}
}
}
}