From 6fe43fad9525a5fb99afef48a912d91d37a7a57a Mon Sep 17 00:00:00 2001 From: Thakia Date: Fri, 9 Oct 2026 17:58:54 -0300 Subject: [PATCH] on actions updated files --- common/on_action/NEOW_game_start.txt | 17 - common/on_action/army_on_actions.txt | 91 +- common/on_action/combat_on_actions.txt | 12 +- common/on_action/death.txt | 827 +++++-- common/on_action/dlc/mpo/mpo_on_actions_2.txt | 15 +- common/on_action/game_start.txt | 208 +- common/on_action/inventory_on_actions.txt | 433 +++- common/on_action/province_on_actions.txt | 181 +- common/on_action/religion_on_actions.txt | 2118 +++++++++++++---- common/on_action/title_on_actions.txt | 542 ++++- common/on_action/travel_on_actions.txt | 148 +- common/on_action/yearly_groups_on_actions.txt | 132 + common/on_action/yearly_on_actions.txt | 133 +- 13 files changed, 3892 insertions(+), 965 deletions(-) delete mode 100644 common/on_action/NEOW_game_start.txt diff --git a/common/on_action/NEOW_game_start.txt b/common/on_action/NEOW_game_start.txt deleted file mode 100644 index 0a843bd15..000000000 --- a/common/on_action/NEOW_game_start.txt +++ /dev/null @@ -1,17 +0,0 @@ -on_game_start = { - events = { - historical_artifacts.999 - } - on_actions = { - NEOW_on_game_start - } -} - -NEOW_on_game_start = { - effect = { - ### Fire Starting Events - debug_log = "NEOW_on_game_start fired" - - fire_starting_events = yes - } -} \ No newline at end of file diff --git a/common/on_action/army_on_actions.txt b/common/on_action/army_on_actions.txt index 55d1a9c2c..d71fa93f9 100644 --- a/common/on_action/army_on_actions.txt +++ b/common/on_action/army_on_actions.txt @@ -50,7 +50,7 @@ on_army_monthly = { } } -# called when a county is (fully) occupied. Does not fire on reoccupation by province owner +# called when a county is (fully) occupied. Does not fire on reoccupation by province owner, there is on_liberation_siege_completion for that. # root is the occupant # scope:county is the county title # scope:barony is the barony title that got occupied @@ -404,7 +404,7 @@ on_county_occupied = { } } -# called when a siege completes. Does *not* fire on reoccupation by province order +# called when a siege completes. Does not fire on reoccupation by province owner, there is on_liberation_siege_completion for that. # root is the occupant # scope:barony is the barony title that got occupied # scope:county is the county title for the barony @@ -416,6 +416,7 @@ on_siege_completion = { siege.0101 # Notify holders/lieges that the county was lost to siege siege.0001 # Capture/kill prisoners siege.0031 # Chance to steal an artifact + siege.0032 # Chance to steal an artifact from holy site faction_demand.1010 #Reinforce populist rebels faction_demand.1110 #Reinforce peasant rebels siege.1001 #Someone I care about was immured here... @@ -437,7 +438,7 @@ on_siege_completion = { # If you have the Sacred Destruction tenet get piety/destroy development if = { limit = { - faith = { has_doctrine_parameter = successful_sieges_give_piety } + rite = { rite_has_parameter = successful_sieges_give_piety } } send_interface_toast = { title = successful_sieges_give_piety_toast @@ -447,6 +448,54 @@ on_siege_completion = { } } + if = { + limit = { + rite = { rite_has_parameter = tenet_aniconism_siege_destruction_bonus } + exists = scope:previous_controller + scope:previous_controller.rite ?= { NOT = { rite_has_tenet = tenet_aniconism } } + } + send_interface_toast = { + title = tenet_aniconism_siege_destruction_toast + left_icon = root + add_piety = minor_piety_gain + scope:barony.county = { change_development_progress_with_overflow = -3 } + } + } + + # Extinction of Dharma: razing a rival faith's holdings hastens the dharma's decline + if = { + limit = { + rite = { rite_has_parameter = extinction_of_dharma_siege_bonus } + exists = scope:previous_controller + scope:previous_controller = { + faith.religion = root.faith.religion + NOT = { faith = root.faith } + } + } + send_interface_toast = { + title = extinction_of_dharma_siege_toast + left_icon = root + add_piety = minor_piety_gain + scope:barony.county = { change_development_progress_with_overflow = -3 } + } + } + + # If you have the Miles Christi tenet get SP + pam_miles_christi_fulfillment_from_combat_effect = yes + + if = { + limit = { + has_personal_tenet_flag = tenet_aniconism_destruction_fulfillment + exists = scope:previous_controller + scope:previous_controller.rite ?= { NOT = { rite_has_tenet = tenet_aniconism } } + } + send_interface_toast = { + title = pam_aniconism_siege_toast + left_icon = root + change_spiritual_fulfillment = minor_spiritual_fulfillment_value + } + } + # We change your legend to reflect this siege if = { limit = { @@ -593,6 +642,17 @@ on_siege_completion = { } } +# called when a "liberation siege" completes, meaning a siege that turns an occupied barony into an unoccupied one. +# root is the liberator of the occupation. +# scope:barony is the barony title that got liberated +# scope:county is the county title for the barony +# scope:previous_controller is the previous controller of the county +# scope:war is the war causing the previous controller and the liberator to be hostile +# liberated_baronies is a list of all baronies that the siege caused the occupier to control (I.E., can include baronies with no fort level) +on_liberation_siege_completion = { + +} + # Called when a siege loots a holding # root is sieging character # scope:barony is the barony title that got looted @@ -667,8 +727,12 @@ on_siege_looting = { multiply = 5 } } - tgp_treasury_raided_effect = yes - + scope:barony.title_province ?= { + random_army_in_location = { + limit = { army_owner = root } + tgp_treasury_raided_effect = yes + } + } } } @@ -871,10 +935,10 @@ on_raid_action_completion = { tgp_silk_road_raid_effect = yes } } - scope:county.holder = { add_to_list = raid_targets } - scope:county.holder.liege ?= { add_to_list = raid_targets } - scope:county.holder.liege.liege ?= { add_to_list = raid_targets } - scope:county.holder.liege.liege.liege ?= { add_to_list = raid_targets } + scope:county.holder = { + add_to_list = raid_targets + every_liege_or_above = { add_to_list = raid_targets } + } every_in_list = { list = raid_targets send_interface_message = { @@ -917,6 +981,15 @@ on_raid_action_completion = { # log_debug_variable_for_persian_struggle_effect = { VAR = concession_catalyst_raided_involved } # } # } +# } +# +# if = { # PAM - Catalysts +# limit = { +# pam_neighboring_unreformed_pagan_raid_you_catalyst_trigger = yes +# } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_neighboring_unreformed_pagan_raid_you +# } # } # Commander trait leveling diff --git a/common/on_action/combat_on_actions.txt b/common/on_action/combat_on_actions.txt index 36f165673..7a9c5466f 100644 --- a/common/on_action/combat_on_actions.txt +++ b/common/on_action/combat_on_actions.txt @@ -480,8 +480,13 @@ on_combat_end_winner = { # Commander trait leveling every_side_commander = { - commander_trait_leveling_leveling_effect = { XP = 1 } + commander_trait_leveling_leveling_effect = { XP = 1 } + pam_miles_christi_fulfillment_from_combat_effect = yes } + + # Miles Christi holy weapon victories + pam_miles_christi_holy_weapon_victory_effect = yes + if = { limit = { any_side_participant = { @@ -497,6 +502,7 @@ on_combat_end_winner = { } } every_side_participant = { + limit = { is_alive = yes } if = { limit = { has_variable = accolade_progress } change_variable = { @@ -667,7 +673,7 @@ on_combat_end_loser = { # Commander trait leveling every_side_commander = { - commander_trait_leveling_leveling_effect = { XP = 0.5 } + commander_trait_leveling_leveling_effect = { XP = 0.5 } } if = { @@ -738,6 +744,6 @@ on_combat_end_loser = { } } } - } + } } } diff --git a/common/on_action/death.txt b/common/on_action/death.txt index f3a91d233..8d87b9afc 100644 --- a/common/on_action/death.txt +++ b/common/on_action/death.txt @@ -1,5 +1,7 @@ # character just about to die in root scope -# if a killer is known, it's set as scope:killer +# The death reason is set as scope:death_reason +# If a killer is known, it's set as scope:killer +# If an artifact was used to kill, it's set as scope:artifact #Triggered by code on_death = { @@ -27,13 +29,13 @@ on_death = { limit = { is_ruler = yes exists = primary_heir - OR = { - has_variable = flavourise_camp_purpose_mercenaries - has_variable = flavourise_camp_purpose_wanderers - has_variable = flavourise_camp_purpose_scholars - has_variable = flavourise_camp_purpose_explorers - has_variable = flavourise_camp_purpose_brigands - has_variable = flavourise_camp_purpose_legitimists + has_variable = { + name = flavourise_camp_purpose_mercenaries + name = flavourise_camp_purpose_wanderers + name = flavourise_camp_purpose_scholars + name = flavourise_camp_purpose_explorers + name = flavourise_camp_purpose_brigands + name = flavourise_camp_purpose_legitimists } } if = { @@ -78,29 +80,29 @@ on_death = { limit = { is_ruler = yes top_liege != this - primary_heir ?= { - NOR = { - has_character_flag = vassal_directive_improve_development - has_character_flag = vassal_directive_train_commanders - has_character_flag = vassal_directive_build_maa - has_character_flag = vassal_directive_convert_faith - has_character_flag = vassal_directive_convert_culture - has_character_flag = vassal_directive_improve_cultural_acceptance - has_character_flag = vassal_directive_building_focus_fortification - has_character_flag = vassal_directive_building_focus_military - has_character_flag = vassal_directive_building_focus_economy - } + has_variable = { + name = vassal_directive_improve_development + name = vassal_directive_train_commanders + name = vassal_directive_build_maa + name = vassal_directive_convert_faith + name = vassal_directive_convert_culture + name = vassal_directive_improve_cultural_acceptance + name = vassal_directive_building_focus_fortification + name = vassal_directive_building_focus_military + name = vassal_directive_building_focus_economy } - OR = { - has_character_flag = vassal_directive_improve_development - has_character_flag = vassal_directive_train_commanders - has_character_flag = vassal_directive_build_maa - has_character_flag = vassal_directive_convert_faith - has_character_flag = vassal_directive_convert_culture - has_character_flag = vassal_directive_improve_cultural_acceptance - has_character_flag = vassal_directive_building_focus_fortification - has_character_flag = vassal_directive_building_focus_military - has_character_flag = vassal_directive_building_focus_economy + primary_heir ?= { + has_none_of_variables = { + name = vassal_directive_improve_development + name = vassal_directive_train_commanders + name = vassal_directive_build_maa + name = vassal_directive_convert_faith + name = vassal_directive_convert_culture + name = vassal_directive_improve_cultural_acceptance + name = vassal_directive_building_focus_fortification + name = vassal_directive_building_focus_military + name = vassal_directive_building_focus_economy + } } } if = { @@ -209,10 +211,10 @@ on_death = { has_character_flag = bp2_prestige_piety_chain piety_level < prestige_level #higher stat gives the chain } - faith = { + rite = { NOR = { - trait_is_virtue = humble - trait_is_virtue = content + trait_is_virtue_rite = humble + trait_is_virtue_rite = content } } } @@ -235,6 +237,18 @@ on_death = { } } + if = { + limit = { + is_ruler = yes + exists = dynasty + rite = { rite_has_parameter = tenet_ancestor_worship_renown_on_death } + pam_ancestor_worship_death_renown_value > 0 + } + dynasty = { + add_dynasty_prestige = root.pam_ancestor_worship_death_renown_value + } + } + if = { limit = { exists = player_heir @@ -295,12 +309,6 @@ on_death = { } } } - } - - if = { - limit = { - exists = player_heir - } trigger_event = { id = fp3_yearly.2030 days = 16 @@ -316,23 +324,18 @@ on_death = { } } change_current_court_grandeur = grandeur_loss_on_succession_value - } - if = { # Grandeur in elective realms - limit = { - has_royal_court = yes - has_dlc_feature = royal_court - primary_heir ?= { - has_royal_court = no + if = { # Grandeur in elective realms + limit = { + primary_title = { + has_order_of_succession = election + } } - primary_title = { - has_order_of_succession = election - } - } - primary_heir = { - set_variable = { - name = previous_holder_grandeur_value - value = prev.court_grandeur_current + primary_heir = { + set_variable = { + name = previous_holder_grandeur_value + value = prev.court_grandeur_current + } } } } @@ -572,15 +575,15 @@ on_death = { } } save_scope_as = dead_spouse - # Free the betrothed - betrothed = { + # Free the betrothed - the wedding promise can outlive the betrothal itself + betrothed ?= { save_scope_as = alive_spouse trigger_event = ep2_wedding.0003 } # Free the host if they were not the betrothed themselves if = { limit = { - NOT = { betrothed = { has_variable = promised_grand_wedding_marriage_countdown } } + NOT = { betrothed ?= { has_variable = promised_grand_wedding_marriage_countdown } } } var:promised_grand_wedding_by = { trigger_event = ep2_wedding.0002 } } @@ -590,6 +593,7 @@ on_death = { # Complete activity intent if relevant if = { limit = { + exists = scope:killer exists = involved_activity scope:killer.involved_activity ?= root.involved_activity scope:killer = { @@ -684,6 +688,7 @@ on_death = { player_heir ?= { if = { limit = { + is_alive = yes #if the predecessor died during a murder feast/bloody wedding is quite likely that the heir would've died too OR = { opinion = { target = root @@ -691,7 +696,6 @@ on_death = { } has_any_good_relationship_with_root_trigger = yes } - is_alive = yes #if the predecessor died during a murder feast/bloody wedding is quite likely that the heir would've died too } add_character_flag = pilgrimage_liked_my_predecessor } @@ -776,14 +780,9 @@ on_death = { } } # Check equipped artifacts - if = { - limit = { - any_equipped_character_artifact = { ep1_artifact_is_court_artifact_trigger = yes } - } - every_equipped_character_artifact = { - limit = { ep1_artifact_is_court_artifact_trigger = yes } - set_variable = equipped_court_succession - } + every_equipped_character_artifact = { + limit = { ep1_artifact_is_court_artifact_trigger = yes } + set_variable = equipped_court_succession } if = { limit = { @@ -992,6 +991,35 @@ on_death = { } } } + if = { + limit = { + has_personal_tenet_flag = tenet_purgatory_prayers_for_the_dead + root = { num_sinful_traits > 0 } + } + send_interface_toast = { + type = event_toast_effect_good + title = pam_purgatory_prayers_for_the_dead_toast + left_icon = this + right_icon = root + add_piety = { + value = minor_piety_value + multiply = root.num_sinful_traits + } + } + } + # Separate if: Purgatory's block above can pay on the same death + if = { + limit = { + has_personal_tenet_flag = tenet_khachkar_kin_death_stress_loss + } + send_interface_toast = { + type = event_toast_effect_good + title = pam_khachkar_grief_toast + left_icon = this + right_icon = root + add_stress = medium_stress_loss + } + } } every_spouse = { @@ -1015,47 +1043,35 @@ on_death = { # Tournament tournament_versus_qualifier_death_effect = yes - # Petition Liege invalidation - if = { - limit = { - any_vassal = { var:petition_liege_scope ?= root } - } - every_vassal = { + # Travel invalidation for vassals heading here, in a single vassal pass rather than one per interaction + every_vassal = { + # Petition Liege invalidation + if = { limit = { var:petition_liege_scope ?= root } trigger_event = { on_action = petition_liege_travel_planner_exit } - current_travel_plan = { + current_travel_plan = { if = { limit = { can_cancel = yes } cancel_travel_plan = yes } } } - } - # Pay Homage invalidation - if = { - limit = { - any_vassal = { var:homage_liege_scope ?= root } - } - every_vassal = { + # Pay Homage invalidation + if = { limit = { var:homage_liege_scope ?= root } trigger_event = { on_action = pay_homage_travel_planner_exit } - current_travel_plan = { + current_travel_plan = { if = { limit = { can_cancel = yes } cancel_travel_plan = yes } } } - } - # Bow Before Liege invalidation - if = { - limit = { - any_vassal = { var:pledge_loyalty_to_liege_scope ?= root } - } - every_vassal = { + # Bow Before Liege invalidation + if = { limit = { var:pledge_loyalty_to_liege_scope ?= root } trigger_event = { on_action = pledge_loyalty_to_liege_travel_planner_exit } - current_travel_plan = { + current_travel_plan = { if = { limit = { can_cancel = yes } cancel_travel_plan = yes @@ -1258,54 +1274,58 @@ on_death = { } } - # Clan Succession effects if = { limit = { government_has_flag = government_is_clan - house ?= { - OR = { - has_house_unity_stage = competitive - has_house_unity_stage = antagonistic - } - } + exists = house } - every_vassal = { - limit = { house ?= root.house } - add_unpressed_claim = root.primary_title - } - } - - # When the house head of a clan dies, they have an impact on their house's unity - # Effect of reducing the house unity has to be delayed in death_management.0100 so that your succession laws don't change from lowered house unity before the succession happens - if = { - limit = { - government_has_flag = government_is_clan - house ?= { - house_head = root - NOT = { has_house_unity_stage = impassive } - } - primary_title.title_held_years >= 1 - } - #calculate the unity value you should lose on this character and save it to pass it to the add_unity_value effect in the death_management.0100 event - save_scope_value_as = { - name = unity_change - value = { - value = 10 - add = root.primary_title.title_held_years - multiply = -1 - min = -50 - } - } - save_scope_as = dead_house_head - #trigger the death_management.0100 event that will remove the unity after succession happens + # Clan Succession effects if = { limit = { - exists = player_heir + house = { + OR = { + has_house_unity_stage = competitive + has_house_unity_stage = antagonistic + } + } } - player_heir = { - trigger_event = { - id = death_management.0100 - delayed = yes + every_vassal = { + limit = { house ?= root.house } + add_unpressed_claim = root.primary_title + } + } + + # When the house head of a clan dies, they have an impact on their house's unity + # Effect of reducing the house unity has to be delayed in death_management.0100 so that your succession laws don't change from lowered house unity before the succession happens + if = { + limit = { + house = { + house_head = root + NOT = { has_house_unity_stage = impassive } + } + primary_title.title_held_years >= 1 + } + #calculate the unity value you should lose on this character and save it to pass it to the add_unity_value effect in the death_management.0100 event + save_scope_value_as = { + name = unity_change + value = { + value = 10 + add = root.primary_title.title_held_years + multiply = -1 + min = -50 + } + } + save_scope_as = dead_house_head + #trigger the death_management.0100 event that will remove the unity after succession happens + if = { + limit = { + exists = player_heir + } + player_heir = { + trigger_event = { + id = death_management.0100 + delayed = yes + } } } } @@ -1324,6 +1344,38 @@ on_death = { } } + # copy name of dog for funeral event + if = { + limit = { + any_owned_story = { + story_type = story_cycle_pet_dog + } + player_heir ?= { + NOT = { + any_owned_story = { story_type = story_cycle_pet_dog } + } + } + } + if = { + limit = { + any_owned_story = { + story_type = story_cycle_pet_dog + var:story_cycle_dog_name ?= flag:custom + } + } + player_heir = { + copy_localized_text = { + key = story_cycle_dog_name + target = root + } + } + } + trigger_event = { + on_action = story_cycle_pet_dog_removal + years = 5 + } + } + if = { # Add Legitimacy Legacy Level 2 limit = { dynasty ?= { @@ -1342,7 +1394,7 @@ on_death = { # In Admin Realms, you inherit a portion of your predecessor's Influence on succession if = { limit = { - government_allows = administrative + government_has_flag = government_has_influence influence > 0 exists = house player_heir ?= { # Let's make sure we don't give Influence to anyone that shouldn't get it @@ -1378,7 +1430,14 @@ on_death = { } # EP3 - Become Adventurer - Succession - trigger_event = ep3_laamps.0012 + # Pre-gated on the event's own trigger so the vast majority of deaths skip the dispatch + if = { + limit = { + is_landed = yes + exists = player_heir + } + trigger_event = ep3_laamps.0012 + } # EP3 - Adventurer support invalidation ep3_laamp_supporter_invalidated_effect = yes @@ -1552,33 +1611,20 @@ on_death = { # } # EP3 - Grand Ambitions Story Cycle - if = { + # Get the scope of the story owner + random_targeting_scheme = { limit = { - any_targeting_scheme = { - scheme_type = depose - scheme_owner = { - any_owned_story = { - type = grand_ambitions_story_cycle - var:target_char ?= root - } + scheme_type = depose + scheme_owner = { + any_owned_story = { + type = grand_ambitions_story_cycle + var:target_char ?= root } } } - save_scope_as = previous_story_target - # Get the scope of the story owner - random_targeting_scheme = { - limit = { - scheme_type = depose - scheme_owner = { - any_owned_story = { - type = grand_ambitions_story_cycle - var:target_char ?= root - } - } - } - # Fire an event to the story owner letting them know that their target is dead and letting them choose if they should continue their story and start a new scheme against the heir - scheme_owner = { trigger_event = grand_ambitions.0500 } - } + root = { save_scope_as = previous_story_target } + # Fire an event to the story owner letting them know that their target is dead and letting them choose if they should continue their story and start a new scheme against the heir + scheme_owner = { trigger_event = grand_ambitions.0500 } } # EP3, Hasan story cycle stuff @@ -1711,7 +1757,7 @@ on_death = { } } - + # Additional Flavor Titles additional_flavor_check_death_effect = yes @@ -1807,8 +1853,8 @@ on_death = { save_scope_as = activity activity_host = { trigger_event = { - id = coronation_events.0301 - days = 1 + id = coronation_events.0301 + days = 1 } } } @@ -1836,15 +1882,15 @@ on_death = { add_realm_law_skip_effects = uncrowned } } - + ### TGP ### ## China ## # Imperial murder catalyst if = { limit = { + exists = scope:killer exists = title:h_china.holder house ?= title:h_china.holder.house - exists = scope:killer } save_scope_as = imperial_death situation:dynastic_cycle = { @@ -1869,7 +1915,7 @@ on_death = { } } } - + # Merit based governments if = { limit = { @@ -1930,11 +1976,6 @@ on_death = { government_has_flag = government_has_merit is_independent_ruler = yes highest_held_title_tier >= tier_empire - any_concubine = { - NOT = { - has_trait = celibate - } - } } every_concubine = { limit = { @@ -1986,7 +2027,7 @@ on_death = { value = piety_level } #You do _not_ get any progress towards Godlike - player_heir = { + player_heir = { trigger_event = { id = tgp_east_asia_mandala_events.0102 delayed = yes @@ -2011,7 +2052,7 @@ on_death = { min = minor_piety_value } } - } + } #Set up the scopes in case we should level up the heir's Piety Level cap if = { limit = { @@ -2024,10 +2065,10 @@ on_death = { piety_level >= max_piety_level } if = { - limit = { + limit = { OR = { - has_character_modifier = budding_deity_modifier - has_character_modifier = budding_godhood_modifier + has_character_modifier = budding_deity_modifier + has_character_modifier = budding_godhood_modifier } } save_scope_as = apply_godlike @@ -2036,10 +2077,10 @@ on_death = { limit = { has_character_modifier = budding_divinity_modifier } save_scope_as = apply_budding_deity } - else = { save_scope_as = apply_budding_divinity } + else = { save_scope_as = apply_budding_divinity } } #Get some piety -- and maybe a Piety Level cap increase, depending on predecessor's Piety Level - player_heir = { + player_heir = { trigger_event = { id = tgp_east_asia_mandala_events.0100 delayed = yes @@ -2050,10 +2091,10 @@ on_death = { #Lose Mandala if you change to a monotheist faith mandala_no_longer_polytheist_effect = yes } - + # ACH Purge Pretenders Oath reward - + if = { limit = { has_variable = purge_oath_previous_law @@ -2102,9 +2143,9 @@ on_death = { # Ceremonial liege family if = { limit = { + player_heir ?= { is_ai = no } tgp_is_in_ceremonial_house_trigger = yes any_held_title = { is_noble_family_title = yes } - player_heir = { is_ai = no } } if = { limit = { is_playable_character = no } @@ -2123,43 +2164,384 @@ on_death = { } resolve_title_and_vassal_change = scope:change } - if = { + every_relation = { + type = disciple limit = { - any_relation = { - type = disciple - is_ai = no + is_ai = no + } + random_relation = { + type = fellow_disciple + limit = { + merit_level > prev.merit_level + is_ai = yes + } + save_scope_as = superior_fellow_disciple + } + every_relation = { + type = fellow_disciple + limit = { + merit_level < prev.merit_level + is_ai = yes + } + add_to_list = potential_new_disciples + } + root = { save_scope_as = deceased_elder } + if = { + limit = { + is_available_adult = yes + } + trigger_event = { + id = tgp_china_career.0030 } } - save_scope_as = deceased_elder - every_relation = { - type = disciple + } + #Beatify dead order founders + if = { + limit = { + has_pam_dlc_trigger = yes + has_variable = founding_monastic + rite = { + OR = { + rite_has_tenet = tenet_dulia + has_tenet_status = { + tenet = tenet_dulia + status = permitted + } + } + } + OR = { + piety_level >= 3 + AND = { + has_trait = devoted + has_trait_xp = { + trait = devoted + value >= 65 + } + } + } + } + pam_pick_founder_burial_province_effect = yes + #Want to send notifications to players that are patron, founder or family members + if = { limit = { - is_ai = no - } - random_relation = { - type = fellow_disciple - limit = { - merit_level > prev.merit_level - is_ai = yes - } - save_scope_as = superior_fellow_disciple - } - every_relation = { - type = fellow_disciple - limit = { - merit_level < prev.merit_level - is_ai = yes - } - add_to_list = potential_new_disciples - } - if = { - limit = { - is_available_adult = yes - } - trigger_event = { - id = tgp_china_career.0030 + faith = { + any_faith_holy_order = { + leader = root + holy_order_patron ?= { + is_ai = no + } + } } } + faith = { + random_faith_holy_order = { + limit = { + leader = root + holy_order_patron ?= { + is_ai = no + } + } + holy_order_patron = { + add_to_list = dead_monastic_notified + } + } + } + } + if = { + limit = { + primary_title = { + has_variable = founder + var:founder = { + is_alive = yes + is_ai = no + } + } + } + primary_title = { + var:founder = { + add_to_list = dead_monastic_notified + } + } + } + if = { + limit = { + exists = dynasty + } + dynasty = { + every_dynasty_member = { + limit = { + is_ai = no + } + add_to_list = dead_monastic_notified + } + } + } + every_in_list = { + list = dead_monastic_notified + send_interface_message = { + type = msg_monastic_leader_beatified + title = monastic_founder_beatified_t + desc = monastic_founder_beatified_desc + left_icon = root + right_icon = root.primary_title + show_as_tooltip = { + if = { + limit = { exists = scope:consecration_province } + pam_canonize_saint_effect = { + CANONIZER = root + CANDIDATE = root + CONSECRATION_PROVINCE = scope:consecration_province + PRESET = no + } + } + else = { + root = { add_trait = saint } + } + } + } + } + if = { + limit = { exists = scope:consecration_province } + pam_canonize_saint_effect = { + CANONIZER = root + CANDIDATE = root + CONSECRATION_PROVINCE = scope:consecration_province + PRESET = no + } + } + # Every burial site in the faith is taken; beatify anyway rather than drop the founder + else = { + add_trait = saint + } + } + #PAM - Holy Myron: the herb-gathering chaplain dies en route; inform whoever sent them + if = { + limit = { + has_variable = pam_holy_myron_journey_tier + exists = var:pam_holy_myron_liege + var:pam_holy_myron_liege = { is_alive = yes } + } + save_scope_as = myron_chaplain + var:pam_holy_myron_liege = { + trigger_event = pam_holy_myron.0020 + } + } + # CE3 achievement: Where There's a Will — the succession demander killed the cleric + if = { + limit = { + exists = var:ce3_will_demander + exists = scope:killer + scope:killer = var:ce3_will_demander + var:ce3_will_demander = { is_alive = yes } + } + var:ce3_will_demander = { + set_variable = { + name = ce3_will_victim + value = root + } + } + } + #If you are a Christian ruler who does not take pam_decision_last_rites their will have their legitimacy and vassal opinion lowered + if = { + limit = { + is_adult = yes + has_pam_dlc_trigger = yes + NOT = { + has_character_flag = did_last_rites_flag + } + health <= death_chance_dying_health + has_spiritual_fulfillment_type = christian_fulfillment + root.rite = { + has_at_least_tenet_status = { + tenet = tenet_communion + status = permitted + } + has_at_least_tenet_status = { + tenet = tenet_confession + status = permitted + } + } + } + every_vassal_or_below = { + vassal_stance = zealot + custom = every_zealot_vassal + add_opinion = { + modifier = no_last_rites_opinion + target = root + opinion = -30 + } + } + if = { + limit = { is_valid_for_legitimacy_change = yes } + add_legitimacy = massive_legitimacy_loss + } + } +# # PAM - Catalysts +# if = { +# limit = { +# pam_head_of_rite_had_short_reign_trigger = yes +# situation:the_christian_church ?= { +# situation_top_has_catalyst = catalyst_clergy_hor_short_reign +# } +# } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_clergy_hor_short_reign +# } +# } + + #Piety loss when someone kills them, but not in battle, and not if execution already applied it + if = { + limit = { + exists = scope:killer + scope:killer != root + scope:killer = { is_alive = yes } + NOT = { has_character_flag = clerical_kill_consequences_applied_on_execution } + NAND = { + is_in_army = yes + scope:killer = { is_in_army = yes } + } + } + scope:killer = { + clerical_kill_piety_effect = { + VICTIM = root + KILLER = scope:killer + } + } + } + + # Only the highest-ranking office contributes a kill catalyst +# if = { +# limit = { +# pam_the_christian_church_head_of_faith_murdered_catalyst_trigger = yes +# } +# if = { +# limit = { +# situation:the_christian_church ?= { +# situation_top_has_catalyst = catalyst_the_christian_church_head_of_faith_murdered +# } +# } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_the_christian_church_head_of_faith_murdered +# } +# } +# } +# else_if = { +# limit = { +# pam_clergy_cardinal_murdered_catalyst_trigger = yes +# } +# if = { +# limit = { +# situation:the_christian_church ?= { +# situation_top_has_catalyst = catalyst_clergy_cardinal_murdered +# } +# } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_clergy_cardinal_murdered +# } +# } +# } +# else_if = { +# limit = { +# pam_clergy_head_of_rite_murdered_catalyst_trigger = yes +# } +# if = { +# limit = { +# situation:the_christian_church ?= { +# situation_top_has_catalyst = catalyst_clergy_head_of_rite_murdered +# } +# } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_clergy_head_of_rite_murdered +# } +# } +# } +# else_if = { +# limit = { +# pam_clergy_archbishop_murdered_catalyst_trigger = yes +# } +# if = { +# limit = { +# situation:the_christian_church ?= { +# situation_top_has_catalyst = catalyst_clergy_archbishop_murdered +# } +# } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_clergy_archbishop_murdered +# } +# } +# } +# else_if = { +# limit = { +# pam_clergy_court_chaplain_murdered_catalyst_trigger = yes +# } +# if = { +# limit = { +# situation:the_christian_church ?= { +# situation_top_has_catalyst = catalyst_clergy_court_chaplain_murdered +# } +# } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_clergy_court_chaplain_murdered +# } +# } +# } + if = { # Murder of a schism-rite head by the opposing rite feeds Great Schism progress + limit = { + has_pam_dlc_trigger = yes + pam_died_from_murder_reason_trigger = yes + exists = scope:killer + pam_schism_head_of_rite_and_opposing_character_trigger = { + HEAD = root + OTHER = scope:killer + } + } + pam_change_great_schism_progress_effect = { + VALUE = pam_great_schism_progress_head_of_rite_murdered_value + TT = pam_great_schism_progress_head_of_rite_murdered_tt + } + } +# if = { +# limit = { +# pam_the_christian_church_ruler_died_in_battle_against_non_christian_catalyst_trigger = yes +# } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_the_christian_church_ruler_died_in_battle_against_non_christian +# } +# } + pam_cardinal_vacancy_on_death_effect = yes + if = { + limit = { has_variable = pam_propagate_word_of_my_sainthood } + trigger_event = { + on_action = pam_propagate_word_of_my_sainthood_convert + days = 1 + } + } + if = { + limit = { has_personal_tenet_flag = tenet_dulia_personal_sainthood_chance } + trigger_event = { + on_action = pam_dulia_personal_sainthood_convert + days = 1 + } + } + #Clean up puppet modifiers + # puppet:X asserts on characters without playable data (e.g. easter eggs); only playable chars can own puppets. + if = { + limit = { + is_landed = yes + highest_held_title_tier >= tier_county + OR = { + has_theological_agent_puppet_trigger = yes + exists = puppet:external_ruler_puppet + } + } + puppet:external_ruler_puppet ?= { + remove_puppet_modifiers_effect = yes + } + puppet:external_theological_agent_puppet ?= { + remove_puppet_modifiers_effect = yes + } + puppet:theological_agent_puppet ?= { + remove_puppet_modifiers_effect = yes } } } @@ -2167,7 +2549,6 @@ on_death = { events = { death_management.0096 # Updates marriage opinions of other spouses if relevant. death_management.0097 # Sets a flag if the dead one was someone you loved (to make suicide available) - death_management.0098 # Removes rejected_from_marriage_bed_modifier if spouse dies death_management.0099 # If spouse is pregnant, save as variable death_management.0001 # Finds characters which would care about death for notifications etc. intrigue_dread.4012 # Interrupts this event chain for the imprisoner when their prisoner dies. @@ -2179,6 +2560,7 @@ on_death = { great_holy_war.0083 # ghw fallback beneficiary dies. religious_decision.0301 # ancestor died and needs to be buried. religious_decision.0311 # Dynasty member has died and you can raise a runestone + pam_decision_events.0016 # PAM: Heir may raise a Khachkar to an ancestor game_rule.2 # Exclave Independence martial_authority.2057 # Right-Hand Person Dies martial_authority.2055 # Right-handed Person (person with right-hand) Died @@ -2190,7 +2572,34 @@ on_death = { bp1_house_feud.9000 # BP1: save rivals on death and fire inheritance on action # ep3_frankokratia_events.0021 #EP3 keep frankokratia leaders in the plot mpo_nomad_events.1090 #Nomad widow-marrying event - death_management.0123 # Hosue Relations + death_management.0123 # House Relations + } +} + +story_cycle_pet_dog_removal = { + effect = { + every_owned_story = { + limit = { story_type = story_cycle_pet_dog } + end_story = yes + } + } +} + +pam_propagate_word_of_my_sainthood_convert = { + effect = { + set_dead_character_variable = { + name = pam_propagate_word_of_my_sainthood + years = 100 + } + } +} + +pam_dulia_personal_sainthood_convert = { + effect = { + set_dead_character_variable = { + name = pam_dulia_personal_sainthood + years = 100 + } } } diff --git a/common/on_action/dlc/mpo/mpo_on_actions_2.txt b/common/on_action/dlc/mpo/mpo_on_actions_2.txt index a08268e6f..ce7f49c81 100644 --- a/common/on_action/dlc/mpo/mpo_on_actions_2.txt +++ b/common/on_action/dlc/mpo/mpo_on_actions_2.txt @@ -474,8 +474,8 @@ kurultai_succession_chaotic_minor = { } random_events = { 100 = mpo_chaotic_kurultai_succession.0001 # Siblings become your rivals - 100 = mpo_chaotic_kurultai_succession.0002 # Brother seizes the lands of a Tributary and becomes independent - 100 = mpo_chaotic_kurultai_succession.0003 # Tributary leaves + 150 = mpo_chaotic_kurultai_succession.0002 # Brother seizes the lands of a Tributary and becomes independent + 150 = mpo_chaotic_kurultai_succession.0003 # Tributary leaves 100 = mpo_chaotic_kurultai_succession.0004 # County Control loss 100 = mpo_chaotic_kurultai_succession.0005 # Loss of Prestige Level 100 = mpo_chaotic_kurultai_succession.0006 # 10% of Herd defects to Neighboring realm @@ -504,8 +504,8 @@ kurultai_succession_chaotic_medium = { 100 = mpo_chaotic_kurultai_succession.0009 # Gold divided by Siblings 100 = mpo_chaotic_kurultai_succession.0010 # Legitimacy -500 100 = mpo_chaotic_kurultai_succession.0011 # 20% of Herd defects to Neighboring realm - 300 = mpo_chaotic_kurultai_succession.0013 # 20% Realm Split - 100 = mpo_chaotic_kurultai_succession.0016 # 3 Tributaries leave + 350 = mpo_chaotic_kurultai_succession.0013 # 20% Realm Split + 150 = mpo_chaotic_kurultai_succession.0016 # 3 Tributaries leave } } @@ -580,6 +580,13 @@ mpo_de_jure_shift = { effect = { switch = { trigger = root.highest_held_title_tier + # TODO: TIT-72244 we don't have lists for hegemony for now + #tier_hegemony = { + # de_jure_shifting_effect = { + # UPPER_TIER = hegemony + # LOWER_TIER = empire + # } + #} tier_empire = { de_jure_shifting_effect = { UPPER_TIER = empire diff --git a/common/on_action/game_start.txt b/common/on_action/game_start.txt index 0aa2e1067..ab99ded44 100644 --- a/common/on_action/game_start.txt +++ b/common/on_action/game_start.txt @@ -6,11 +6,14 @@ on_game_start = { # fp1_scandinavian_adventurers.0021 # FP1 - Mark game-start prioritised adventurers. #Guaranteed historical artifacts fixed spawning debug_portraits.1 # Debug portraits for animation testing + historical_artifacts.999 # easteregg_event.0001 # Charna and Jakub duel. } effect = { ##NEOW + debug_log = "NEOW_on_game_start fired" + fire_starting_events = yes ### CHAD / IRONSIDE SKULL ### # Spawn the historical skull at game start in Lichfield. @@ -577,7 +580,7 @@ on_game_start = { if = { limit = { NOT = { - has_government = tribal_government + government_has_flag = government_is_tribal } } change_government = tribal_government @@ -636,33 +639,33 @@ on_game_start = { limit = { has_cp3_dlc_trigger = yes } - title:b_barcelona.title_province = { add_special_building_slot = drassanes_01 } #1892 - title:b_merv.title_province = { add_special_building = kyz_kala_01 } #4238 - if = { limit = { game_start_date >= 1178.10.1 } title:b_cluny.title_province = { add_special_building = cluny_abbey_02 } } #2304 - else_if = { limit = { game_start_date >= 1066.9.15 } title:b_cluny.title_province = { add_special_building = cluny_abbey_01 } } - else = { title:b_cluny.title_province = { add_special_building_slot = cluny_abbey_01 } } - title:b_york.title_province = { add_special_building = york_walls_01 } #1595 - title:b_damascus.title_province = { add_special_building = damascus_mosque_01 } #5924 - title:b_lhasa.title_province = { add_special_building = jokhang_01 } #9237 - if = { limit = { game_start_date >= 1178.10.1 } title:b_schmalkalden.title_province = { add_special_building = wartburg_01 } } #3010 - else = { title:b_schmalkalden.title_province = { add_special_building_slot = wartburg_01 } } - title:b_lalibela.title_province = { add_special_building_slot = beta_giyorgis_01 } #8301 - if = { limit = { game_start_date >= 1066.9.15 } title:b_novgorod.title_province = { add_special_building = holy_wisdom_01 } } #5137 - else = { title:b_novgorod.title_province = { add_special_building_slot = holy_wisdom_01 } } - title:b_kano.title_province = { add_special_building_slot = kano_walls_01 } #6519 - title:b_somapur.title_province = { add_special_building = somapura_university_01 } #848 - if = { limit = { game_start_date >= 1178.10.1 } title:b_firenze.title_province = { add_special_building = duomo_florence_02 } } #2543 - else = { title:b_firenze.title_province = { add_special_building = duomo_florence_01 } } - title:b_konarak.title_province = { add_special_building_slot = konark_temple_01 } #928 - title:b_fes.title_province = { add_special_building = al_qarawiyyin_university_01 } #4694 - title:b_kairouan.title_province = { add_special_building = kairouan_basins_01 } #4594 - title:b_al-ghaba.title_province = { add_special_building = ghana_palace_01 } #6628 #NOTE: likely existed since the 8th, but earliest (only) source on palace is from 1068 - title:b_visegrad_hun.title_province = { add_special_building_slot = visegrad_castle_01 } #3803 - if = { limit = { game_start_date >= 1161.9.15 } title:b_leczyca.title_province = { add_special_building = wawel_cathedral_01 } } #4924 #Date of consecreation of Archcollegiate Church of St. Mary and St. Alexius in Tum - else = { title:b_leczyca.title_province = { add_special_building_slot = wawel_cathedral_01 } } - title:b_vatapi.title_province = { add_special_building = vatapi_caves_01 } #1198 - if = { limit = { game_start_date >= 1178.10.1 } title:b_jaisalmer.title_province = { add_special_building = jaisalmer_fort_01 } } #3387 - else = { title:b_jaisalmer.title_province = { add_special_building_slot = jaisalmer_fort_01 } } #3387 + title:b_barcelona.title_province = { add_special_building_slot = drassanes_01 } #1892 + title:b_merv.title_province = { add_special_building = kyz_kala_01 } #4238 + if = { limit = { game_start_date >= 1178.10.1 } title:b_cluny.title_province = { add_special_building = cluny_abbey_02 } } #2304 + else_if = { limit = { game_start_date >= 1066.9.15 } title:b_cluny.title_province = { add_special_building = cluny_abbey_01 } } + else = { title:b_cluny.title_province = { add_special_building_slot = cluny_abbey_01 } } + title:b_york.title_province = { add_special_building = york_walls_01 } #1595 + title:b_damascus.title_province = { add_special_building = damascus_mosque_01 } #5924 + title:b_lhasa.title_province = { add_special_building = jokhang_01 } #9237 + if = { limit = { game_start_date >= 1178.10.1 } title:b_schmalkalden.title_province = { add_special_building = wartburg_01 } } #3010 + else = { title:b_schmalkalden.title_province = { add_special_building_slot = wartburg_01 } } + title:b_lalibela.title_province = { add_special_building_slot = beta_giyorgis_01 } #8301 + if = { limit = { game_start_date >= 1066.9.15 } title:b_novgorod.title_province = { add_special_building = holy_wisdom_01 } } #5137 + else = { title:b_novgorod.title_province = { add_special_building_slot = holy_wisdom_01 } } + title:b_kano.title_province = { add_special_building_slot = kano_walls_01 } #6519 + title:b_somapur.title_province = { add_special_building = somapura_university_01 } #848 + if = { limit = { game_start_date >= 1178.10.1 } title:b_firenze.title_province = { add_special_building = duomo_florence_02 } } #2543 + else = { title:b_firenze.title_province = { add_special_building = duomo_florence_01 } } + title:b_konarak.title_province = { add_special_building_slot = konark_temple_01 } #928 + title:b_fes.title_province = { add_special_building = al_qarawiyyin_university_01 } #4694 + title:b_kairouan.title_province = { add_special_building = kairouan_basins_01 } #4594 + title:b_al-ghaba.title_province = { add_special_building = ghana_palace_01 } #6628 #NOTE: likely existed since the 8th, but earliest (only) source on palace is from 1068 + title:b_visegrad_hun.title_province = { add_special_building_slot = visegrad_castle_01 } #3803 + if = { limit = { game_start_date >= 1161.9.15 } title:b_leczyca.title_province = { add_special_building = wawel_cathedral_01 } } #4924 #Date of consecreation of Archcollegiate Church of St. Mary and St. Alexius in Tum + else = { title:b_leczyca.title_province = { add_special_building_slot = wawel_cathedral_01 } } + title:b_vatapi.title_province = { add_special_building = vatapi_caves_01 } #1198 + if = { limit = { game_start_date >= 1178.10.1 } title:b_jaisalmer.title_province = { add_special_building = jaisalmer_fort_01 } } #3387 + else = { title:b_jaisalmer.title_province = { add_special_building_slot = jaisalmer_fort_01 } } #3387 } ### RELIGIOUS THINGS ### @@ -1284,10 +1287,6 @@ on_game_start = { limit = { is_governor = yes NOT = { has_trait = governor } - OR = { - government_allows = administrative - government_is_japanese_trigger = yes - } } add_trait = governor add_trait_xp = { @@ -1308,13 +1307,20 @@ on_game_start = { } } } + if = { + limit = { + exists = clerical_elector_title + NOT = { has_character_flag = cardinal_flag } + } + add_character_flag = cardinal_flag + } # Clean up TGP governments is the Expansion is not enabled if = { limit = { has_tgp_dlc_trigger = no } # TGP: Clean up maritime tribal govs and revert them to non-dlc tribals if = { limit = { - government_has_flag = government_is_wanua + has_government = wanua_government } empty_treasury_when_abandoning_landed_life_effect = yes change_government = tribal_government @@ -1322,7 +1328,7 @@ on_game_start = { # TGP: Clean up mandala govs and revert them to non-dlc feudals else_if = { limit = { - government_has_flag = government_is_mandala + has_government = mandala_government } empty_treasury_when_abandoning_landed_life_effect = yes change_government = feudal_government @@ -1409,9 +1415,9 @@ on_game_start = { limit = { tgp_is_any_minister = yes } - random_held_title = { + every_held_title = { limit = { - tier = tier_empire + tgp_is_minister_title = yes } set_capital_county = prev.top_liege.capital_county } @@ -2946,6 +2952,15 @@ on_game_start_after_lobby = { recipient = scope:astrologer_character court_position = court_astrologer_court_position } + if = { + limit = { + exists = suzerain + suzerain != this + } + end_tributary = yes + suzerain = { save_scope_as = suzerain } + start_tributary_interaction_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } } } if = { @@ -3134,50 +3149,18 @@ on_game_start_after_lobby = { limit = { highest_held_title_tier >= tier_duchy } + ### PAM: give bishops and abbots a monastic familia instead of a generic secular court ### + pam_seed_monk_courtiers_effect = yes + pam_seed_nun_courtier_effect = yes if = { limit = { exists = cp:councillor_court_chaplain cp:councillor_court_chaplain = { is_ruler = no } - faith = { has_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment } - any_vassal = { - is_physically_able_adult = yes - is_councillor = no - government_has_flag = government_is_theocracy - can_be_court_chaplain_trigger = { COURT_OWNER = liege } - faith = liege.faith - } - } - random_vassal = { - limit = { - is_physically_able_adult = yes - is_councillor = no - government_has_flag = government_is_theocracy - can_be_court_chaplain_trigger = { COURT_OWNER = liege } - faith = liege.faith - } - weight = { - base = 1 - modifier = { - add = 1000 - faith.religious_head ?= this - } - modifier = { - add = learning - } - modifier = { - add = primary_title.tier - } - } - liege = { - assign_councillor_type = { - type = councillor_court_chaplain - remove_existing_councillor = yes - target = prev - } - } + rite = { rite_has_parameter = has_clerical_regions } # Gates on landed clergy existing, not on a Clerical Appointment doctrine: that doctrine gets swapped at runtime } + assign_landed_realm_priest_effect = yes } if = { limit = { @@ -3186,6 +3169,13 @@ on_game_start_after_lobby = { if = { limit = { has_realm_law = crown_authority_0 } remove_realm_law = crown_authority_0 } } } + else_if = { # Same for county-tier bishops. Barons fall out of the chain without being checked + limit = { + highest_held_title_tier = tier_county + } + pam_seed_monk_courtiers_effect = yes + pam_seed_nun_courtier_effect = yes + } #Autopopulate families. if = { limit = { @@ -5500,6 +5490,16 @@ on_game_start_after_lobby = { value = 10 desc = cultural_acceptance_historical_relations } + character:906 = { + every_held_title = { + title_tier = county + change_county_control = 100 + } + } + random_player = { + limit = { this = character:83355 } + set_player_character = character:906 + } } ##### ANGLICS ##### @@ -15799,12 +15799,15 @@ on_game_start_after_lobby = { every_in_list = { list = holder_to_learn_chinese tgp_learn_chinese_effect_game_start = yes - every_noble_family = { - holder ?= { - tgp_learn_chinese_effect_game_start = yes - house = { - every_house_member = { - tgp_learn_chinese_effect_game_start = yes + if = { + limit = { is_independent_ruler = yes } + every_noble_family = { + holder ?= { + tgp_learn_chinese_effect_game_start = yes + house = { + every_house_member = { + tgp_learn_chinese_effect_game_start = yes + } } } } @@ -15866,6 +15869,9 @@ on_game_start_after_lobby = { } fill_external_east_asian_estate_building_effect = yes } + ecclesiastical_domicile = { + fill_ecclesiastical_domicile_building_effect = yes + } } } } @@ -16131,6 +16137,9 @@ on_game_start_after_lobby = { } fill_external_east_asian_estate_building_effect = yes } + ecclesiastical_domicile = { + fill_ecclesiastical_domicile_building_effect = yes + } } } } @@ -16183,6 +16192,9 @@ on_game_start_after_lobby = { tier_county = { change_county_fertility = { 2 8 } } + tier_hegemony = { + change_county_fertility = { 32 48 } + } } } else_if = { @@ -16217,6 +16229,7 @@ on_game_start_after_lobby = { gender_female_chance = scope:player_scope.marriage_gender_adjusted_female_chance culture = scope:player_scope.culture faith = scope:player_scope.faith + rite = scope:player_scope.rite after_creation = { random_list = { 200 = { @@ -16249,6 +16262,7 @@ on_game_start_after_lobby = { gender_female_chance = 15 culture = scope:player_scope.culture faith = scope:player_scope.faith + rite = scope:player_scope.rite after_creation = { random_list = { 200 = { @@ -16277,15 +16291,6 @@ on_game_start_after_lobby = { } } - # Sanity check the setup if in debug mode - if = { - limit = { - debug_only = yes - } - run_setup_tests_effect = yes - } - set_global_variable = game_has_started - every_independent_ruler = { # Treasury setup for any government using treasury tgp_treasury_setup_effect = yes @@ -16405,7 +16410,31 @@ on_game_start_after_lobby = { } clear_global_variable_list = easteregg_characters_list } - + + title:k_papal_state.holder ?= { + enforce_papal_latin_court_language_effect = yes + } + + # A faith's organization members are exactly its clergy, so this never touches the laity. + religion:catholic_religion = { + every_faith = { + organization ?= { + every_organization_member = { + christian_clergy_learn_liturgical_language_effect = yes + } + } + } + } + + # Sanity check the setup if in debug mode + if = { + limit = { + debug_only = yes + } + run_setup_tests_effect = yes + } + set_global_variable = game_has_started + enable_and_run_succession_calculation = yes } @@ -16431,4 +16460,3 @@ on_game_start_after_lobby = { # desc = $DESC$ # } # } - diff --git a/common/on_action/inventory_on_actions.txt b/common/on_action/inventory_on_actions.txt index 727ddd324..95e5df116 100644 --- a/common/on_action/inventory_on_actions.txt +++ b/common/on_action/inventory_on_actions.txt @@ -2,6 +2,9 @@ # root = the artifact # scope:owner = the person who now holds the artifact # scope:old_owner = the person who used to hold the artifact +# scope:old_holy_site = the holy site that used to hold the artifact (set only when +# the artifact transitioned out of holy-site ownership into +# character ownership; otherwise absent) on_artifact_changed_owner = { events = { artifact.0011 @@ -9,11 +12,17 @@ on_artifact_changed_owner = { } effect = { - save_scope_as = artifact - grant_banner_house_claim_effect = yes - every_artifact_claimant = { #This on_action is not triggered on succession for the ones getting the claim, so we force it here - trigger_event = { - on_action = on_artifact_claim_gained + if = { + limit = { + exists = scope:old_owner + } + + save_scope_as = artifact + grant_banner_house_claim_effect = yes + every_artifact_claimant = { #This on_action is not triggered on succession for the ones getting the claim, so we force it here + trigger_event = { + on_action = on_artifact_claim_gained + } } } @@ -124,3 +133,417 @@ on_artifact_durability_very_low = { artifact.3050 } } + +# Fired when an artifact has been enshrined in a holy site (whether the slot was empty +# or an existing artifact was replaced). +# root = the artifact that was enshrined +# scope:holy_site = the holy site receiving the artifact +# scope:actor = the character who initiated the enshrining +# scope:replacing = the artifact that was replaced in the slot, if any +on_holy_site_artifact_enshrined = { + effect = { + # Save if we're improving the artifact level with a replace + if = { + limit = { + scope:replacing ?= { + is_holy_relic_for = scope:actor.faith + rarity_level >= root.rarity_level + } + } + save_scope_value_as = { + name = replacing_with_better_artifact + value = no + } + } + else = { + save_scope_value_as = { + name = replacing_with_better_artifact + value = yes + } + } + + + # If this is a relic of your faith + if = { + limit = { + is_holy_relic_for = scope:actor.faith + + # Don't gain things from replacing with a worse/equal level artifact + scope:replacing_with_better_artifact = no + } + + save_scope_value_as = { + name = replace_piety_value + value = 0 + } + scope:replacing ?= { + switch = { + trigger = rarity + illustrious = { + scope:actor = { + save_scope_value_as = { + name = replace_piety_value + value = massive_piety_loss + } + } + } + famed = { + scope:actor = { + save_scope_value_as = { + name = replace_piety_value + value = major_piety_loss + } + } + } + masterwork = { + scope:actor = { + save_scope_value_as = { + name = replace_piety_value + value = medium_piety_loss + } + } + } + common = { + scope:actor = { + save_scope_value_as = { + name = replace_piety_value + value = minor_piety_loss + } + } + } + } + } + + switch = { + trigger = rarity + illustrious = { + scope:actor = { + add_piety = { + value = massive_piety_value + add = scope:replace_piety_value + } + } + } + famed = { + scope:actor = { + add_piety = { + value = major_piety_value + add = scope:replace_piety_value + } + } + } + masterwork = { + scope:actor = { + add_piety = { + value = medium_piety_value + add = scope:replace_piety_value + } + } + } + common = { + scope:actor = { + add_piety = { + value = minor_piety_value + add = scope:replace_piety_value + } + } + } + } + + # Your zealous vassals like it + scope:actor = { + every_vassal = { + vassal_stance = zealot + limit = { + root = { + is_holy_relic_for = prev.faith + } + } + add_opinion = { + modifier = enshrined_holy_relic_at_holy_site + target = scope:actor + } + } + + # Zealot lieges like it + every_liege_or_above = { + limit = { + OR = { + ai_zeal >= 50 + has_trait = devoted + has_trait = zealous + } + root = { + is_holy_relic_for = prev.faith + } + } + add_opinion = { + modifier = enshrined_holy_relic_at_holy_site + target = scope:actor + } + } + # your head of faith likes it + faith = { + religious_head ?= { + if = { + limit = { + this != scope:actor + root = { + is_holy_relic_for = prev.faith + } + } + + add_opinion = { + modifier = enshrined_holy_relic_at_holy_site + target = scope:actor + } + } + } + } + } + } + # CE3 achievement: Father's best side — a relic from a saint of the actor's family, enshrined in a holy site the actor's dynasty founded + if = { + limit = { + exists = var:pam_saint_relic_saint + scope:holy_site.title_province.barony.var:ce3_holy_site_founder_dynasty ?= scope:actor.dynasty + scope:actor = { + OR = { + is_close_or_extended_family_of = root.var:pam_saint_relic_saint + AND = { + exists = dynasty + root.var:pam_saint_relic_saint.dynasty ?= dynasty + } + } + } + } + scope:actor = { + add_achievement_global_variable_effect = { + VARIABLE = ce3_06_fathers_best_side_achievement_unlocked + VALUE = yes + } + } + } + } +} + +# Fired when an artifact has been removed from a holy site (back into the actor's inventory). +# Also fires for the artifact replaced by a swap-style enshrining — in that +# (Only fired from explicit enshrining/removing effects, not generic inventory effects) +# case scope:replacing is the artifact that took its place. +# root = the artifact that was removed +# scope:holy_site = the holy site the artifact was taken from +# scope:actor = the character who initiated the removal +# scope:replacing = the artifact taking this one's place, if removal is part of a swap +on_holy_site_artifact_removed = { + effect = { + # Save if we're improving the artifact level with a replace + if = { + limit = { + is_holy_relic_for = scope:actor.faith + OR = { + NOT = { exists = scope:replacing } + scope:replacing ?= { + rarity_level < root.rarity_level + } + } + } + save_scope_value_as = { + name = replacing_with_better_artifact + value = no + } + } + else = { + save_scope_value_as = { + name = replacing_with_better_artifact + value = yes + } + } + + # Heads of Faith don't like this. + if = { + limit = { + # Don't lose things from replacing with a better/equal level artifact + scope:replacing_with_better_artifact = no + } + scope:holy_site = { + every_holy_site_faith = { + limit = { + num_county_followers > 0 + } + religious_head ?= { + if = { + limit = { + this != scope:actor + root = { + is_holy_relic_for = prev.faith + } + } + + add_opinion = { + modifier = removed_holy_relic_from_holy_site + target = scope:actor + } + } + } + } + } + } + + # If this is a relic of your faith + if = { + limit = { + is_holy_relic_for = scope:actor.faith + scope:replacing_with_better_artifact = no + } + + # Costs Piety if it is your faith + switch = { + trigger = rarity + illustrious = { scope:actor = { add_piety_and_experience = massive_piety_loss } } + famed = { scope:actor = { add_piety_and_experience = major_piety_loss } } + masterwork = { scope:actor = { add_piety_and_experience = medium_piety_loss } } + common = { scope:actor = { add_piety_and_experience = minor_piety_loss } } + } + + # Your zealous / minority vassals don't like it + scope:actor = { + every_vassal = { + custom = every_zealot_vassal + vassal_stance = zealot + limit = { + faith = scope:actor.faith + } + add_opinion = { + modifier = removed_holy_relic_from_holy_site + target = scope:actor + } + } + every_vassal = { + custom = every_minority_vassal + vassal_stance = minority + limit = { + faith = scope:actor.faith + } + add_opinion = { + modifier = removed_holy_relic_from_holy_site + target = scope:actor + } + } + + if = { + limit = { liege != this } + # Fellow zealous vassals don't like it + liege = { + every_vassal = { + custom = every_zealot_fellow_vassal + vassal_stance = zealot + limit = { + faith = scope:actor.faith + } + add_opinion = { + modifier = removed_holy_relic_from_holy_site + target = scope:actor + } + } + } + # Lieges don't like it + every_liege_or_above = { + limit = { + OR = { + ai_zeal >= 50 + has_trait = devoted + has_trait = zealous + } + root = { + is_holy_relic_for = prev.faith + } + } + add_opinion = { + modifier = removed_holy_relic_from_holy_site + target = scope:actor + } + } + } + } + } + else_if = { + # If this is not a relic of your faith + save_scope_as = artifact + custom_tooltip = { + text = holy_site_relic_will_get_reclaim_relic_cb + } + + # Your vassals / fellow vassals / liege doesn't like it + scope:actor = { + every_vassal = { + limit = { + OR = { + faith != scope:actor.faith + scope:replacing_with_better_artifact = no + } + root = { + is_holy_relic_for = prev.faith + } + } + add_opinion = { + modifier = removed_holy_relic_from_holy_site + target = scope:actor + } + } + if = { + limit = { liege != this } + liege = { + every_vassal = { + limit = { + OR = { + faith != scope:actor.faith + scope:replacing_with_better_artifact = no + } + root = { + is_holy_relic_for = prev.faith + } + } + add_opinion = { + modifier = removed_holy_relic_from_holy_site + target = scope:actor + } + } + } + every_liege_or_above = { + limit = { + OR = { + faith != scope:actor.faith + scope:replacing_with_better_artifact = no + } + root = { + is_holy_relic_for = prev.faith + } + } + add_opinion = { + modifier = removed_holy_relic_from_holy_site + target = scope:actor + } + } + } + } + } + } +} + + +# Fired whenever an artifact's holy-site ownership has changed. +# (artifact is now owned by a holy site, or no longer owner by a holy site) +# +# root = the artifact +# scope:holy_site = the holy site that now owns the artifact, if any +# scope:old_holy_site = the holy site that used to own the artifact, if any +# scope:old_owner = the character who used to own the artifact, if any +# +# Either or both of the old_* scopes may be present depending on what the previous +# owner was. The new holy_site scope is absent only if the artifact was cleared of +# holy-site ownership without immediately being given to a new one. +on_artifact_changed_holy_site_owner = { + effect = { + } +} diff --git a/common/on_action/province_on_actions.txt b/common/on_action/province_on_actions.txt index 22d6a8ec5..f117887a5 100644 --- a/common/on_action/province_on_actions.txt +++ b/common/on_action/province_on_actions.txt @@ -2,10 +2,33 @@ # scope:character: The character that paid for the construction, if available on_building_completed = { effect = { + # Bonus only come with buildings acctually constructed by you + scope:character ?= { + if = { + limit = { + is_available_quick = { + alive = yes + advanced_ruler = yes + } + has_personal_tenet_flag = spiritual_fulfillment_from_building_personal + NOT = { has_variable = spiritual_fulfillment_from_building_personal } + } + send_interface_toast = { + title = spiritual_fulfillment_from_building_personal_toast + left_icon = root.county + change_spiritual_fulfillment = miniscule_spiritual_fulfillment_value + set_variable = { + name = spiritual_fulfillment_from_building_personal + value = yes + days = 30 + } + } + } + } #save the county holder as the character in case the construction wasn't started through GUI or by the AI if = { limit = { - NOT = { exists = scope:character } + NOT = { scope:character ?= { is_alive = yes } } } root.county.holder = { save_scope_as = character @@ -15,7 +38,7 @@ on_building_completed = { # Preservation tenet if = { limit = { - scope:character.faith = { has_doctrine_parameter = building_temples_gives_development } + scope:character.rite = { rite_has_parameter = building_temples_gives_development } OR = { has_holding_type = church_holding has_holding_type = temple_citadel_holding @@ -25,7 +48,7 @@ on_building_completed = { scope:character = { send_interface_toast = { title = building_temples_gives_development_toast - left_icon = root + left_icon = root.county root.county = { change_development_progress_with_overflow = minor_development_progress_gain set_variable = { @@ -38,6 +61,29 @@ on_building_completed = { } } + # Pentarchy tenet + if = { + limit = { + scope:character = { has_personal_tenet_flag = tenet_pentarchy_development_growth_in_holy_sites } + barony = { is_holy_site_of = scope:character.faith } + NOT = { county = { has_variable = dev_gain_cooldown } } + } + scope:character = { + send_interface_toast = { + title = tenet_pentarchy_development_growth_in_holy_sites_toast + left_icon = scope:character + root.county = { + change_development_progress_with_overflow = medium_development_progress_gain + set_variable = { + name = dev_gain_cooldown + value = yes + days = 365 + } + } + } + } + } + # Hard working Tradition if = { limit = { @@ -131,6 +177,45 @@ on_building_completed = { } } + # PAM - Khachkar Personal Tenet + if = { + limit = { + scope:character = { has_personal_tenet_flag = tenet_khachkar_building_bonuses } + OR = { + has_holding_type = church_holding + has_holding_type = temple_citadel_holding + } + } + scope:character = { + send_interface_toast = { + title = pam_khachkar_building_toast + left_icon = root + add_piety = minor_piety_gain + change_spiritual_fulfillment = medium_spiritual_fulfillment_value + } + } + } + + # PAM - Megaliths Personal Tenet + if = { + limit = { + scope:character = { has_personal_tenet_flag = tenet_megaliths_rough_terrain_construction_fulfillment } + OR = { + terrain = hills + terrain = terraced_hills + terrain = mountains + terrain = desert_mountains + } + } + scope:character = { + send_interface_toast = { + title = pam_megaliths_rough_terrain_construction_toast + left_icon = root + change_spiritual_fulfillment = minor_spiritual_fulfillment_value + } + } + } + # FP2 Dynasty perk if = { limit = { @@ -351,7 +436,24 @@ on_building_completed = { } } } - + #The Christian Church Situation catalysts +# if = { +# limit = { +# has_variable = pam_temple_holding_under_construction +# has_holding_type = church_holding +# scope:character = { +# any_character_situation = { +# situation_type = the_christian_church +# situation_top_has_catalyst = catalyst_the_christian_church_temple_holding_created +# } +# } +# } +# remove_variable = pam_temple_holding_under_construction +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_the_christian_church_temple_holding_created +# } +# } + # Points of Interest # Apply them here directly so they are more promptly added than monthly via the POI update if = { @@ -425,7 +527,7 @@ on_building_completed = { if = { limit = { is_alive = yes - is_landed_or_landless_administrative = yes + is_landed_or_landless_administrative_or_theocratic = yes is_available = yes } #Then remove the safeguard event that would clean up the Builder @@ -611,7 +713,7 @@ on_building_completed = { scope:character = { send_interface_toast = { title = coronation_vassal_building_tt - left_icon = root + left_icon = root.barony add_prestige = medium_prestige_gain } } @@ -624,7 +726,10 @@ on_building_completed = { scope:character = { if = { - limit = { government_has_flag = government_is_mandala } + limit = { + is_alive = yes + government_has_flag = government_is_mandala + } if = { limit = { exists = house @@ -658,6 +763,53 @@ on_building_completed = { } } } + + #Created Monastic church holding + if = { + limit = { + has_variable = monastic_order_capital + has_building = temple_01 + county.holder ?= { + faith = root.var:monastic_order_capital + } + } + county.holder = { + save_scope_as = founder + } + root.barony = { save_scope_as = barony } + scope:founder = { + create_character = { + template = monastic_order_leader_character + location = scope:barony.title_province + save_scope_as = leader + } + scope:leader = { + add_character_flag = { + flag = temp_monastic_leader + days = 5 + } + } + create_holy_order_neutral_effect = { + LEADER = scope:leader + CAPITAL = scope:barony + NEW_HO_SCOPE = new_holy_order + FOUNDER = scope:founder + ORDER_TYPE = monastic + } + scope:leader = { + every_courtier = { + add_trait = devoted + } + } + #Choose a tenet and a leader + trigger_event = holy_order.2010 + add_achievement_global_variable_effect = { + VARIABLE = holy_order_give_a_dog_a_bone_achievement + VALUE = yes + } + } + remove_variable = monastic_order_capital + } } } @@ -674,6 +826,14 @@ on_building_started = { save_scope_as = character } } + if = { + limit = { + has_pam_dlc_trigger = yes + has_holding = no + has_construction_with_flag = temple + } + set_variable = pam_temple_holding_under_construction + } if = { limit = { OR = { @@ -738,7 +898,12 @@ on_building_started = { # root: The province in which the building was cancelled # scope:character: The character that paid for the construction, if available on_building_cancelled = { - effect = {} + effect = { + if = { + limit = { has_variable = pam_temple_holding_under_construction } + remove_variable = pam_temple_holding_under_construction + } + } } # root: The holder of the province doing the razing diff --git a/common/on_action/religion_on_actions.txt b/common/on_action/religion_on_actions.txt index cae3e35e9..047bbef7b 100644 --- a/common/on_action/religion_on_actions.txt +++ b/common/on_action/religion_on_actions.txt @@ -1,11 +1,357 @@ #On actions related to religion -# Code on-action: character creates a faith -# Root is the creator +# Code on-action: a new faith is created (character create/convert, or a rite detaching into its own faith) +# Root is the new faith; its head/leader is root.main_rite.head_of_rite (use it for faith-setup effects) +# scope:founder is the acting character that triggered the creation (creator/converter, heresy declarer, or on a divergence the head of the diverging rite) +# scope:founder can be absent - the game creates faiths with no acting character, so it is entered with ?= # scope:old_faith is the faith they used to have +# scope:old_rite is the rite they used to have +# scope:diverged (true/false) optional scope, true if the faith was created because of a Rite diverging too much. Notice create a 100+ divergence heresy at the start does not count. on_faith_created = { effect = { + main_rite = { force_refresh_head_of_rite = yes } + # Faiths created by a rite diverging too far start at 0 fervor + if = { + limit = { + scope:diverged ?= yes + } + diverged_faith_starting_fervor_effect = yes + } + # Sanctification is per faith + if = { + limit = { + exists = scope:old_faith + scope:old_faith.religion = religion + } + every_artifact = { + limit = { is_sanctified_for_faith = scope:old_faith } + add_sanctified_for_faith = root + } + } + # Remove Antipopes + if = { + limit = { + scope:diverged ?= yes + any_faith_character = { has_character_flag = antipope_flag } + } + ordered_faith_character = { + limit = { has_character_flag = antipope_flag } + order_by = head_of_faith_selection_weight + save_scope_as = pam_diverged_antipope + } + every_faith_character = { + limit = { has_character_flag = antipope_flag } + pam_strip_antipope_office_effect = yes + } + scope:pam_diverged_antipope = { + if = { + limit = { faith = { has_doctrine = doctrine_temporal_head } } + set_up_dynamic_temporal_hof_title_effect = { NEW_HOLDER = scope:pam_diverged_antipope } + } + else_if = { + limit = { faith = { has_doctrine = doctrine_spiritual_head } } + set_up_dynamic_spiritual_hof_title_effect = { CREATOR = scope:pam_diverged_antipope } + } + } + } + scope:founder ?= { + if = { + limit = { faith = root } + pam_on_conversion_effect = yes + remove_character_modifier = religious_reformer_modifier + # If you have a legend maybe we change it? + if = { + limit = { + has_legend_chapter_trigger = { CHAPTER = opening } + promoted_legend ?= { + exists = legend_property:faith + exists = legend_property:religion + } + NOT = { + promoted_legend ?= { + has_legend_chapter = { + name = opening + localization_key = legend_chapter_opening_new_faith + } + } + } + } + send_interface_toast = { + title = legend_chapter_change_toast + left_icon = scope:founder + promoted_legend = { + set_legend_chapter = { + name = opening + localization_key = legend_chapter_opening_new_faith + } + } + } + } + else_if = { + limit = { + has_legend_chapter_trigger = { CHAPTER = opening } + } + random = { + chance = 75 + send_interface_toast = { + title = legend_chapter_change_toast + left_icon = scope:founder + promoted_legend = { + set_legend_chapter = { + name = opening + localization_key = legend_chapter_opening_new_faith_generic + } + } + } + } + } + } + } + scope:old_faith = { + if = { + limit = { has_doctrine_parameter = unreformed } + set_variable = { name = has_been_reformed } + root = { + if = { + limit = { has_doctrine = unreformed_faith_doctrine } + remove_doctrine = unreformed_faith_doctrine + } + if = { + limit = { has_doctrine = west_african_unreformed_faith_doctrine } + remove_doctrine = west_african_unreformed_faith_doctrine + } + } + # Use the new faith's head for state faith, never scope:founder (may not follow) + root.main_rite.head_of_rite ?= { + if = { + limit = { + government_allows = state_faith + liege = this + primary_title.state_rite.faith = scope:old_faith + } + primary_title = { + set_state_rite = rite + pam_tenet_popularity_boost_rite_effect = { RITE = state_rite } + } + } + } + scope:founder ?= { + if = { + limit = { + faith = root + NOT = { has_character_flag = reformer_legend } + has_dlc_feature = legends + NOT = { has_game_rule = historical_legends_only } + } + add_character_flag = reformer_legend + create_legend_seed = { + type = holy + quality = famed + chronicle = new_faith_legend + properties = { + reformer = scope:founder + faith = root + religion = root.religion + reason = flag:pagan_reformation + } + } + } + } + every_faith_character = { + limit = { + has_character_flag = forced_conversion_on_reform + } + set_character_faith = root + every_vassal_or_below = { + limit = { faith = scope:old_faith } + random = { + chance = 75 + set_character_faith = root + } + } + every_sub_realm_county = { + limit = { faith = scope:old_faith } + random = { + chance = 75 + set_county_faith = root + } + } + } + # The founding wave (founder and vassals who already accepted) brings their courts, as with a new rite + # Listed first, since the conversions below add characters to the faith being iterated + if = { + limit = { + NOT = { scope:diverged ?= yes } + } + root = { + every_faith_character = { + limit = { is_ruler = yes } + add_to_temporary_list = pam_reform_founding_wave + } + } + every_in_list = { + list = pam_reform_founding_wave + pam_convert_court_to_faith_effect = { + FAITH = root + OLD_FAITH = scope:old_faith + } + } + } + } + else = { + scope:founder ?= { + if = { + limit = { + faith = root + NOT = { has_character_flag = reformer_legend } + has_dlc_feature = legends + NOT = { has_game_rule = historical_legends_only } + } + add_character_flag = reformer_legend + create_legend_seed = { + type = holy + quality = famed + chronicle = new_faith_legend + properties = { + reformer = scope:founder + faith = root + religion = root.religion + reason = flag:new_faith + } + } + } + } + } + + scope:founder ?= { play_music_cue = "mx_cue_faith_conversion" } + } + # A faith founded during the game may reshape its holy sites three times for free. + set_variable = { + name = free_holy_site_actions + value = 3 + } + # Clear the old faith's holy-site lock so it cannot use up the free actions + # Locks sit on the founder, so swapping puppets cannot skip the cooldown + scope:founder ?= { + if = { + limit = { faith = root } + set_variable = has_created_a_faith + remove_variable = holy_site_creation_cooldown + remove_decision_cooldown = elevate_holy_site_decision + remove_decision_cooldown = demote_holy_site_decision + remove_decision_cooldown = abandon_holy_site_decision + remove_decision_cooldown = adopt_holy_site_decision + check_for_equal_doctrine_effect = yes + } + } + # Set up diff-faith HoFs. + # If we have a diff-faith HoF, we want to account for that. + ## Islamic use-case: we want same-Mohammad's Succession faiths to keep following their appropriate caliphs. + if = { + limit = { + # Are we in the correct religion? + religion = religion:islam_religion + # Faiths with no HoF or a spiritual head aren't relevant for these calculations. + has_doctrine = doctrine_temporal_head + } + # We save_scope_as = reformer for tooltip loc, because the events complain about root + root.main_rite.head_of_rite ?= { save_scope_as = reformer } + # Sunni path. + if = { + limit = { main_rite = { rite_has_doctrine = muhammad_succession_sunni_doctrine } } + root.main_rite.head_of_rite ?= { trigger_event = head_of_faith.0001 } + } + # Shia path. + else_if = { + limit = { main_rite = { rite_has_doctrine = muhammad_succession_shia_doctrine } } + root.main_rite.head_of_rite ?= { trigger_event = head_of_faith.0011 } + } + # Muhakkima path. + else_if = { + limit = { main_rite = { rite_has_doctrine = muhammad_succession_muhakkima_doctrine } } + root.main_rite.head_of_rite ?= { trigger_event = head_of_faith.0021 } + } + # Zandaqa path. + else_if = { + limit = { main_rite = { rite_has_doctrine = muhammad_succession_zandaqa_doctrine } } + root.main_rite.head_of_rite ?= { trigger_event = head_of_faith.0031 } + } + } + # PAM - Christian Situation, add them to the correct group +# if = { +# limit = { +# exists = situation:the_christian_church +# religion = religion:christianity_religion +# } +# root.main_rite.head_of_rite ?= { recalculate_participant_group = situation:the_christian_church } +# } + # Faiths with a College (Catholicism) need a seeded College or AI vacancy spam follows + hidden_effect = { + if = { + limit = { has_doctrine_parameter = has_clerical_electors } + pam_seed_cardinals_effect = yes + } + } + # These events need a character, so they fire on the new faith's head, never a founder outside the faith + root.main_rite.head_of_rite ?= { + trigger_event = faith_conversion.0001 # Convert capital county + trigger_event = faith_conversion.0006 # Same-religion capital joins the new faith + trigger_event = faith_conversion.0003 # Convert close family + trigger_event = faith_creation.0001 # Temporal rel head setup + trigger_event = faith_creation.0002 # Spiritual rel head setup + trigger_event = faith_creation.0003 # Faith flags + } + # Notifications go to the acting character. + scope:founder ?= { + if = { + limit = { faith = root } + trigger_event = faith_creation.1000 # Notification event + trigger_event = faith_creation.1002 # Notification event - rite diverged into a new faith + } + } + } +} + +# Code on-action: character creates a rite +# Root is the creator +# scope:old_faith is the faith they used to have +# scope:old_rite is the rite they used to have +on_rite_created = { + effect = { + pam_on_conversion_effect = yes remove_character_modifier = religious_reformer_modifier + # The rite is brand new, so everyone already holding it (creator, realm priest, AI vassals who accepted the code-sent offer) is part of the founding wave and brings their court and domain along + faith = { + every_faith_character = { + limit = { + rite = root.rite + } + pam_convert_court_to_rite_effect = { RITE = root.rite } + if = { + limit = { + is_landed = yes + highest_held_title_tier >= tier_county + } + pam_convert_domain_counties_to_rite_effect = { RITE = root.rite } + } + } + } + # Same grace var as rite_growth and heresy events, since create_dynamic_rite skips this on-action + rite = { + set_variable = { + name = pam_rite_grace_period + value = yes + days = rite_growth_grace_period_days + } + } + # Vassals answering the creation-time conversion offer later (players) also bring their court and domain; checked in pam_sway_to_rite_on_accept_effect + rite = { + set_variable = { + name = pam_rite_founding_window + value = yes + years = 1 + } + } # If you have a legend maybe we change it? if = { limit = { @@ -56,15 +402,17 @@ on_faith_created = { if = { limit = { has_doctrine_parameter = unreformed } set_variable = { name = has_been_reformed } - root = { + root.faith = { if = { - limit = { - government_allows = state_faith - liege = this - primary_title.state_faith = scope:old_faith - } - primary_title = { set_state_faith = faith } + limit = { has_doctrine = unreformed_faith_doctrine } + remove_doctrine = unreformed_faith_doctrine } + if = { + limit = { has_doctrine = west_african_unreformed_faith_doctrine } + remove_doctrine = west_african_unreformed_faith_doctrine + } + } + root = { if = { limit = { NOT = { has_character_flag = reformer_legend } @@ -129,7 +477,7 @@ on_faith_created = { } } } - + root = { play_music_cue = "mx_cue_faith_conversion" } } set_variable = { @@ -137,57 +485,9 @@ on_faith_created = { } check_for_equal_doctrine_effect = yes # Set up diff-faith HoFs. - faith = { - # If we have a diff-faith HoF, we want to account for that. - ## Islamic use-case: we want same-Mohammad's Succession faiths to keep following their appropriate caliphs. - if = { - limit = { - # Are we in the correct religion? - religion = religion:islam_religion - # Faiths with no HoF or a spiritual head aren't relevant for these calculations. - has_doctrine = doctrine_temporal_head - } - # Grab a scope for tooltip loc, since they complain about root. - root = { save_scope_as = reformer } - # Sunni path. - if = { - limit = { has_doctrine = muhammad_succession_sunni_doctrine } - root = { trigger_event = head_of_faith.0001 } - } - # Shia path. - else_if = { - limit = { has_doctrine = muhammad_succession_shia_doctrine } - root = { trigger_event = head_of_faith.0011 } - } - # Muhakkima path. - else_if = { - limit = { has_doctrine = muhammad_succession_muhakkima_doctrine } - root = { trigger_event = head_of_faith.0021 } - } - # Zandaqa path. - else_if = { - limit = { has_doctrine = muhammad_succession_zandaqa_doctrine } - root = { trigger_event = head_of_faith.0031 } - } - } - ## Faiths with the Rite tenet get to keep their old HoF. - else_if = { - limit = { - # Assuming they exist. - exists = scope:old_faith.religious_head - # & have the appropriate doctrine parameter. - has_doctrine_parameter = maintains_head_of_faith_on_creation - } - set_religious_head_title = scope:old_faith.religious_head_title - # Christian faiths also get to keep ecumenism. - if = { - limit = { - scope:old_faith = { has_doctrine = special_doctrine_ecumenical_christian } - } - add_doctrine = special_doctrine_ecumenical_christian - } - } - ## Otherwise, everyone else should lose their HoF, so we don't need to do anything. + if = { + limit = { exists = faith.religious_head } + trigger_event = head_of_faith.0100 } # Achievements. root = { @@ -290,21 +590,31 @@ on_faith_created = { # } # } } +} +# Code on-action: an interface rite edit was committed that changed tenets or doctrines +# root is the rite that was edited +# Unlike on_rite_updated (delayed), this fires immediately when the edit is applied, so the +# once-per-lifetime edit lock is set before the player can reopen the rite editor. +# WARNING: Please do not misuse this! (use on_rite_updated instead) +on_rite_edited = { events = { - faith_conversion.0001 # Convert capital county - faith_conversion.0003 # Convert close family - faith_creation.0001 # Temporal rel head setup - faith_creation.0002 # Spiritual rel head setup - faith_creation.0003 # Faith flags - faith_creation.1000 # Notification event + } + + effect = { + head_of_rite ?= { + set_variable = { + name = has_edited_a_rite + } + } } } # Code on-action: character converts faith. Only fired when using the convert window, or the script effect that uses the same logic # Root is the converted character # scope:old_faith is the faith they used to have -# scope:actor is the character instigating the conversion +# scope:old_rite is the rite they used to have +# scope:founder is the character instigating the conversion on_faith_conversion = { events = { faith_conversion.0001 # Convert capital county @@ -375,25 +685,46 @@ on_faith_conversion = { } } - # Character is converted to state faith and gains influence + # Character is converted to state rite and gains influence if = { limit = { - faith = top_liege.primary_title.state_faith - government_allows = administrative + rite = top_liege.primary_title.state_rite + government_has_flag = government_has_influence } change_influence = minor_influence_gain hidden_effect = { - faith = { save_scope_as = old_faith } - top_liege.faith = { save_scope_as = new_faith } + top_liege.primary_title.state_rite = { save_scope_as = new_rite } create_character_memory = { type = adopted_state_faith_memory } scope:new_memory = { + if = { + limit = { exists = scope:old_rite } + set_variable = { + name = old_rite + value = scope:old_rite + } + # Savegame and non-English loc compatibility; do not rename or remove + set_variable = { + name = old_faith + value = scope:old_rite.faith + } + } + else = { + set_variable = { + name = old_rite + value = root.rite + } + set_variable = { + name = old_faith + value = root.faith + } + } set_variable = { - name = old_faith - value = scope:old_faith + name = new_rite + value = scope:new_rite } set_variable = { name = new_faith - value = scope:new_faith + value = scope:new_rite.faith } set_variable = { name = title @@ -403,12 +734,1135 @@ on_faith_conversion = { } } } + # PAM Acts of Apostles tenet Effects + if = { + limit = { + exists = scope:founder + scope:founder.rite = { rite_has_parameter = tenet_acts_of_apostles_legitimacy_from_converts } + } + scope:founder = { + send_interface_message = { + type = event_religious_good + title = tenet_acts_of_apostles_toast_conversion_title + left_icon = root + if = { + limit = { exists = root.primary_title } + add_legitimacy = { + value = minor_legitimacy_gain + multiply = root.primary_title.tier + } + } + else = { + add_legitimacy = minor_legitimacy_gain + } + if = { + limit = { is_playable_character = yes } + change_spiritual_fulfillment = medium_spiritual_fulfillment_value + } + } + } + } + # Antipope removal + pam_remove_sponsored_antipope_effect = { + SPONSOR = root + FAITH = scope:old_faith + } } } -# Code on-action: character changes faith. Not called when a character gets a faith on birth, creation, and similar +# Code on-action: character changes faith or rite. Not called when a character gets a faith on birth, creation, and similar # Root is the character # scope:old_faith is the faith they used to have +# scope:old_rite is the rite they used to have (can be equal to current rite) +on_rite_change = { + effect = { + pam_on_conversion_effect = yes + christian_clergy_learn_liturgical_language_effect = yes + pam_remove_forbidden_personal_tenet_secret_if_invalid_effect = yes + check_for_equal_doctrine_effect = yes + every_held_title = { + update_dynamic_coa = yes + } + + add_character_flag = changed_rite_flag + + # Conversion memories + create_conversion_memory_effect = yes + + # Struggles + ## Struggle Catalysts + ### Heir changes culture while under age + if = { + limit = { + catalyst_very_important_child_change_culture_or_faith_preliminary_trigger = yes + } + random_parent = { + limit = { + any_character_struggle = { + involvement = involved + } + } + every_character_struggle = { + involvement = involved + activate_struggle_catalyst = { + catalyst = catalyst_very_important_child_change_culture_or_faith + character = root + } + } + } + } +# ## Struggle Effects +## ### persian_struggle: switching faith to anything that isn't an orthodox Sunni creed'll flip you to detractor. +## if = { +## limit = { +## # Gotta be in the appropriate struggle. +## any_character_struggle = { this = struggle:persian_struggle } +## # Filter out pre-existing detractors. +## NOT = { has_trait = fp3_struggle_detractor } +## # Now, check the new faith. +## exists = title:d_sunni.holder +## OR = { +## NOT = { exists = faith.religious_head } +## NOT = { faith.religious_head = title:d_sunni.holder } +## } +## } +## send_interface_toast = { +## type = event_toast_effect_neutral +## title = persian_struggle.tt.converted_away_from_sunni_orthodoxy +## left_icon = root +## hidden_effect = { remove_trait = fp3_struggle_supporter } +## add_trait_force_tooltip = fp3_struggle_detractor +## } +## } +# +# # Local conversion +# if = { +# limit = { +# exists = root.capital_province +# root.capital_province.faith = root.faith +# any_character_struggle = { +# involvement = involved +# phase_has_catalyst = catalyst_convert_local_culture_faith +# is_faith_involved_in_struggle = root.faith +# } +# } +# every_character_struggle = { +# involvement = involved +# activate_struggle_catalyst = { +# catalyst = catalyst_convert_local_culture_faith +# character = root +# } +# } +# } +# else_if = { # Forced conversion +# limit = { +# any_character_struggle = { +# involvement = involved +# is_faith_involved_in_struggle = root.faith +# phase_has_catalyst = catalyst_forced_conversion +# } +# } +# every_character_struggle = { +# involvement = involved +# activate_struggle_catalyst = { +# catalyst = catalyst_forced_conversion +# character = root +# } +# } +# } +# else_if = { +# limit = { +# has_trait = fp3_struggle_supporter +# any_character_struggle = { +# involvement = involved +# is_faith_involved_in_struggle = root.faith +# phase_has_catalyst = catalyst_supporter_forced_conversion +# } +# } +# every_character_struggle = { +# involvement = involved +# activate_struggle_catalyst = { +# catalyst = catalyst_supporter_forced_conversion +# character = root +# } +# log_debug_variable_for_persian_struggle_effect = { VAR = unrest_catalyst_supporter_forced_conversion } +# } +# } +# else_if = { +# limit = { +# has_trait = fp3_struggle_detractor +# any_character_struggle = { +# involvement = involved +# is_faith_involved_in_struggle = root.faith +# phase_has_catalyst = catalyst_detractor_forced_conversion +# } +# } +# every_character_struggle = { +# involvement = involved +# activate_struggle_catalyst = { +# catalyst = catalyst_detractor_forced_conversion +# character = root +# } +# log_debug_variable_for_persian_struggle_effect = { VAR = stabil_catalyst_detractor_forced_conversion } +# } +# } + + # Achievements + if = { + limit = { is_ai = no } + + if = { # FP2 - Basque In My Glory + limit = { faith = faith:basque_pagan } + add_achievement_global_variable_effect = { + VARIABLE = fp2_basque_in_my_glory_achievement_unlocked + VALUE = yes + } + } + } + + # Hostage story cycle + if = { + limit = { + is_hostage = yes + is_adult = no + # Did they just change to their captor's culture + faith = warden.faith + } + save_scope_as = hostage + warden = { + trigger_event = bp2_yearly.8050 + } + } + + if = { + limit = { + has_variable = japan_1010_discount + var:japan_1010_discount = faith + } + remove_variable = japan_1010_discount + } + + if = { + limit = { + has_character_flag = tgp_japan_1040_discount + faith.religion = religion:shintoism_religion + } + remove_character_flag = tgp_japan_1040_discount + } + + #Lose Mandala if you change to a monotheist faith + mandala_no_longer_polytheist_effect = yes + #Invalidate Military Order creation + if = { + limit = { + any_held_title = { + tier = tier_county + any_county_province = { + has_variable = monastic_order_capital + var:monastic_order_capital = { save_temporary_scope_as = faith_temp } + } + } + NOT = { + faith = scope:faith_temp + } + } + random_held_title = { + limit = { + tier = tier_county + any_county_province = { + has_variable = monastic_order_capital + } + } + random_county_province = { + limit = { + has_variable = monastic_order_capital + } + remove_variable = monastic_order_capital + } + } + } + # PAM - Catalysts +# if = { +# limit = { +# has_pam_dlc_trigger = yes +# exists = situation:the_christian_church +# } +# if = { +# limit = { +# highest_held_title_tier >= tier_county +# scope:old_faith ?= { +# religion = religion:christianity_religion +# } +# religion != religion:christianity_religion +# situation:the_christian_church ?= { +# situation_top_has_catalyst = catalyst_the_christian_church_ruler_converted_from_christianity +# } +# } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_the_christian_church_ruler_converted_from_christianity +# } +# } +# if = { +# limit = { +# highest_held_title_tier >= tier_county +# scope:old_faith ?= { +# religion != religion:christianity_religion +# } +# religion = religion:christianity_religion +# situation:the_christian_church ?= { +# situation_top_has_catalyst = catalyst_the_christian_church_ruler_converted_to_christianity +# } +# } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_the_christian_church_ruler_converted_to_christianity +# } +# } +# # Great Schism: kings+ and landed prelates crossing between the schism-pair rites face a confrontation +# pam_schism_rite_conversion_dissent_effect = yes +# pam_offer_great_schism_stance_effect = yes +# } + # Tenet popularity + pam_tenet_popularity_on_rite_change_effect = yes + + if = { + limit = { + exists = clerical_elector_title + rite = { NOT = { rite_has_parameter = has_clerical_electors } } + } + pam_destroy_cardinal_title_effect = { CARDINALATE = clerical_elector_title } + } + + } + events = { + faith_conversion.0001 # convert capital + faith_conversion.0003 # Convert close family + faith_conversion.0002 # Remove obsolete modifiers + faith_conversion.0004 # Convert Theocracies + faith_conversion.0005 # Update marriage opinions + great_holy_war.0025 # Replace Recipient for ongoing GHW + great_holy_war.0029 # Beneficiary converted, remove and replace. + great_holy_war.0059 # Clear Crusader traits on conversion. + great_holy_war.0084 # Replace fallback ghw recipient + great_holy_war.0085 # Remove pledged vassals upon conversion of their liege. + war_event.3100 # Handles invalidation of religious wars + } +} + +# Code on-action: once a month for each faith +# Root is the faith +on_faith_monthly = { + on_actions = { + update_main_rite_action + faith_holy_order_land_acquisition_pulse + delay = { days = { 5 10 } } + faith_rite_growth_pulse + delay = { days = { 15 20 } } + faith_rite_additional_growth_chance_pulse + delay = { days = { 25 30 } } + faith_heresy_events_pulse + } + events = { + hajj.0010 #Someone changed their capital to Mecca without having the Hajjaj trait + great_holy_war.0010 #Great Holy Wars are unlocked for a Faith. + great_holy_war.0001 + great_holy_war.0022 #Pope harasses players for not pledging support to Crusade yet. + great_holy_war.0030 #Monthly cleanup for Beneficiaries becoming unfit for various reasons. + } + effect = { + # Religious migrants created by the County Conversion council task move somewhere safe + random = { + chance = 4 # Roughly once every 2 years + every_faith_rite = { + limit = { + exists = var:converted_development + var:converted_development >= 1 + NOT = { + rite_has_parameter = unreformed + } + } + save_scope_as = target_rite + # Save all suitable rulers + random = { + chance = var:converted_development + save_scope_as = faith_target + every_independent_ruler = { + limit = { + is_landed = yes + NOT = { government_has_flag = government_is_herder } + # A very large area - enough for a province in north-western india to reach all of Borneo + "this.capital_province.squared_distance(scope:target_rite.var:associated_county.title_province)" <= squared_distance_mega + any_sub_realm_county = { + faith = prev.faith + } + trigger_if = { + limit = { + has_variable_list = rites_converted_in_counties + } + NOT = { + is_target_in_variable_list = { + name = rites_converted_in_counties + target = scope:target_rite + } + } + } + } + add_to_list = migration_targets + every_vassal = { + limit = { + is_landed = yes + highest_held_title_tier >= tier_duchy + any_sub_realm_county = { + faith = prev.faith + } + trigger_if = { + limit = { + has_variable_list = rites_converted_in_counties + } + NOT = { + is_target_in_variable_list = { + name = rites_converted_in_counties + target = scope:target_rite + } + } + } + } + add_to_list = migration_targets + } + } + every_player = { + limit = { + is_landed = yes + NOT = { government_has_flag = government_is_herder } + NOT = { is_in_list = migration_targets } + # A vary large area - enough for a province in north-western india to reach all of Borneo + "this.capital_province.squared_distance(scope:target_rite.var:associated_county.title_province)" <= squared_distance_mega + any_sub_realm_county = { + faith = prev.faith + } + trigger_if = { + limit = { + has_variable_list = rites_converted_in_counties + } + NOT = { + is_target_in_variable_list = { + name = rites_converted_in_counties + target = scope:target_rite + } + } + } + } + add_to_list = migration_targets + } + # If the rite is still large, they only want to move to same-rite rulers + if = { + limit = { + scope:target_rite = { + num_rite_county_followers >= 40 + } + } + random_in_list = { + list = migration_targets + limit = { + rite = scope:target_rite + any_sub_realm_county = { + rite = scope:target_rite + } + # Do NOT go within the same realm as you were converted from + top_liege != scope:target_rite.var:associated_county.holder.top_liege + } + weight = { + base = 1 + modifier = { + add = 3 + is_ai = no + } + modifier = { + add = 3 + government_has_flag = government_is_mandala + } + modifier = { + add = 10 + highest_held_title_tier >= tier_kingdom + } + modifier = { + add = scope:target_rite.var:converted_development + NOT = { government_has_flag = government_is_nomadic } + any_sub_realm_county = { + count >= { + value = scope:target_rite.var:converted_development + divide = 2 + } + rite = scope:target_rite + } + } + modifier = { + add = 0.1 + government_has_flag = government_is_nomadic + } + modifier = { + add = 0.1 + highest_held_title_tier <= tier_county + } + } + save_scope_as = ruler_target + save_scope_as = seeking_same_rite_counties + trigger_event = global_religion.1000 + } + } + # Smaller faiths can go wherever + else = { + random_in_list = { + list = migration_targets + limit = { + NOR = { + top_liege = scope:target_rite.var:associated_county.holder.top_liege # Do NOT go within the same realm as you were converted from + rite = { rite_has_doctrine = doctrine_pluralism_fundamentalist } + culture = { has_cultural_tradition = tradition_zealous_people } + } + OR = { + rite = { + rite_hostility_level = { + target = scope:target_rite + value <= faith_astray_level + } + } + rite = { rite_has_tenet = tenet_adaptive } + rite = { rite_has_parameter = unreformed } + rite = { rite_has_doctrine = doctrine_pluralism_pluralistic } + culture = { has_cultural_tradition = tradition_religion_blending } + culture = { has_cultural_parameter = less_likely_to_force_conversion } + has_trait = nomadic_philosophy + AND = { + is_ai = no + has_perk = open_minded_perk + } + } + any_held_title = { + tier = tier_county + faith = prev.faith + trigger_if = { + limit = { + has_variable_list = rites_converted_in_the_county + } + NOT = { + is_target_in_variable_list = { + name = rites_converted_in_the_county + target = scope:target_rite + } + } + } + trigger_if = { + limit = { + holder = { + is_ai = yes + } + } + holder = { + is_ai = yes + } + } + } + } + weight = { + base = 1 + modifier = { + add = 3 + is_ai = no + } + modifier = { + add = 3 + government_has_flag = government_is_mandala + } + modifier = { + add = 10 + highest_held_title_tier >= tier_kingdom + } + modifier = { + add = scope:target_rite.var:converted_development + NOT = { government_has_flag = government_is_nomadic } + any_sub_realm_county = { + count >= { + value = scope:target_rite.var:converted_development + divide = 2 + } + faith = prev.faith + } + } + modifier = { + add = 0.1 + government_has_flag = government_is_nomadic + } + modifier = { + add = 0.1 + highest_held_title_tier <= tier_county + } + } + save_scope_as = ruler_target + save_scope_as = seeking_any_counties + trigger_event = global_religion.1000 + } + } + } + } + } + } +} + +faith_holy_order_land_acquisition_pulse = { + trigger = { + any_faith_holy_order = { + is_military_order_trigger = yes + } + } + + random_events = { + chance_to_happen = 17 # ~1 every six months + chance_of_no_event = { + value = 100 + every_faith_holy_order = { + subtract = 5 + } + every_ruler = { + limit = { + holy_order_1000_request_target_trigger = yes + } + subtract = 5 + } + if = { + limit = { + NOT = { + any_faith_holy_order = { + is_military_order_trigger = yes + num_leased_titles < holy_order_barony_number_soft_threshold + } + } + } + add = 80 + } + min = 30 + } + 100 = 0 + 500 = holy_order.1000 + } +} + +faith_monastic_order_land_acquisition_pulse = { + trigger = { + any_faith_holy_order = { + is_monastic_order_trigger = yes + } + } + + random_events = { + chance_to_happen = 17 # ~1 every six months + chance_of_no_event = { + value = 100 + every_faith_holy_order = { + subtract = 5 + } + every_ruler = { + limit = { + holy_order_1010_request_target_trigger = yes + } + subtract = 5 + } + if = { + limit = { + NOT = { + any_faith_holy_order = { + is_monastic_order_trigger = yes + num_leased_titles < holy_order_barony_number_soft_threshold + } + } + } + add = 80 + } + min = 30 + } + 100 = 0 + 600 = holy_order.1010 + } +} + +faith_heresy_events_pulse = { + trigger = { + fervor <= 40 + NOR = { + has_doctrine_parameter = unreformed + has_variable = current_heresy + } + } + + random_events = { + # Sharp curve via chance_of_no_event weight: + # with event weight 1 the per-month probability is roughly 1/(no_event + 1) - approximately 1/3/8/30 % across the fervor band + # modified by Christian Situation phase. + chance_of_no_event = pam_heresy_pulse_no_event_value + 1 = heresy_pulse.0001 + } +} + +pagan_conversion_pulse = { + trigger = { #Is the character ready to convert? + is_ai = yes + OR = { + top_liege = this + AND = { # Steppe people convert a bit more often & freely + capital_province ?= { geographical_region = world_steppe } + primary_title.tier >= tier_duchy + } + } + government_has_flag = government_is_tribal + OR = { + has_realm_law = tribal_authority_2 + has_realm_law = tribal_authority_3 + } + faith = { has_doctrine_parameter = unreformed } + prestige_level >= 1 #lower than the regular requirement to make sure some rulers can convert + trigger_if = { # Lighten the dev requirements progressively + limit = { + OR = { + current_date <= 950.1.1 + AND = { + capital_province ?= { geographical_region = world_steppe } + primary_title.tier >= tier_duchy + } + } + } + capital_province.county = { + development_level >= 7 #lower than the regular requirement to make sure some rulers can convert + } + } + trigger_else_if = { + limit = { + current_date <= 1000.1.1 + } + capital_province.county = { + development_level >= 6 #lower than the regular requirement to make sure some rulers can convert + } + } + trigger_else = { + capital_province.county = { + development_level >= 5 #lower than the regular requirement to make sure some rulers can convert + } + } + + culture = { + calc_true_if = { + amount >= 7 + has_innovation = innovation_motte + has_innovation = innovation_catapult + has_innovation = innovation_barracks + has_innovation = innovation_mustering_grounds + has_innovation = innovation_bannus + has_innovation = innovation_quilted_armor + has_innovation = innovation_gavelkind + has_innovation = innovation_crop_rotation + has_innovation = innovation_city_planning + has_innovation = innovation_casus_belli + has_innovation = innovation_plenary_assemblies + has_innovation = innovation_ledger + has_innovation = innovation_development_01 + has_innovation = innovation_currency_01 + } + } + } + + events = { + # global_religion.0001 #Pagan reformed by neighbor, spouse, soulmate, friend, or geographic location + } +} + +# Code on-action: when a great holy war no longer has a valid target, and there was no one left in the target kingdom to replace them. The target scopes will still point to the last target at this point +# If a new target is not picked in script, the GHW will be invalidated +# Root is the great holy war +on_potential_great_holy_war_invalidation = { + events = { + great_holy_war.0004 + } +} + +# Code on-action: when on_potential_great_holy_war_invalidation did not find a new target, and the GHW is about to be destroyed. no way out at this point +# Root is the great holy war +on_great_holy_war_invalidation = { + events = { + great_holy_war.0055 #Send notifications to players. + } +} + +# Code on-action: when the GHW's war launch countdown hits zero. If a war is not started at this point, the GHW will invalidate, bypassing on_potential_great_holy_war_invalidation but not on_great_holy_war_invalidation +# Root is the great holy war +on_great_holy_war_countdown_end = { + trigger = { #Only launch the holy war if attacker strength is above one third of defender. + ghw_attackers_strength >= third_of_defenders_strength + } + events = { + great_holy_war.0005 + } +} + +# Code on-action: when a character in a GHW is replaced. This can only happen when the war has begun, and a participant dies; if they get replaced in the war by someone of the right faith, then this will get called. Can be used to validate their benficiary, for instance +# Root is character being replaced +# scope:great_holy_war is the GHW +# scope:replacement is the replacement character +on_great_holy_war_participant_replaced = { + events = { + great_holy_war.0027 #Refresh Beneficiary for AI. + } +} + +# Code on-action: when a character selects a new personal tenet successfully this onaction is called. +# Root is character picking the tenet +# scope:tenet is the tenet they just picked +on_personal_tenet_gain = { + effect = { + if = { + limit = { + faith.main_rite = { + has_tenet_status = { + tenet = scope:tenet + status = prohibited + } + } + } + custom_tooltip = { + text = on_personal_tenet_gain_secret_gain_effect_tt + on_personal_tenet_gain_secret_gain_effect = yes + } + } + # Ora et Labora Gardener trait gain + ora_et_labora_gardener_gain_effect = yes + # Asceticism Inappetetic trait gain + asceticism_inappetetic_gain_effect = yes + # Mortification of the Flesh Scarred trait gain + mortification_holy_scars_gain_effect = yes + # Unrelenting Faith Blademaster trait gain + unrelenting_faith_blademaster_gain_effect = yes + # Hedonistic Reveler trait gain + hedonistic_reveler_gain_effect = yes + hedonistic_obesity_modifier_sync_effect = yes + # Vows of Poverty cannot be claimed for an activity that is already running + pam_vows_of_poverty_block_ongoing_activity_effect = yes + # Takamin Hunter trait gain + pam_tenet_takamin_hunter_gain_effect = yes + # Religious Law Scholar trait gain + pam_tenet_religious_law_scholar_gain_effect = yes + # Sacred Mountains Rough Terrain Expert trait gain + pam_tenet_mountain_worship_rough_terrain_expert_gain_effect = yes + # Exaltation of Pain Flagellant trait gain + exaltation_of_pain_flagellant_gain_effect = yes + # Literalism Scholar trait gain + literalism_scholar_gain_effect = yes + # Scholasticism Scholar trait gain + scholasticism_scholar_gain_effect = yes + # Miles Christi Holy Warrior trait gain + miles_christi_holy_warrior_gain_effect = yes + # Astrology Mystic trait gain + astrology_mystic_gain_effect = yes + # Anachoresis Mystic trait gain + anachoresis_mystic_gain_effect = yes + # Righteous Rebirth Aggressive Attacker trait gain + pure_land_aggressive_attacker_gain_effect = yes + # Righteous Rebirth Prestige Level loss + pure_land_prestige_level_loss_effect = yes + reincarnation_piety_courage_gain_effect = yes + # Divine Liturgy Tenet - the officiating chaplain + if = { + limit = { + has_personal_tenet_flag = tenet_divine_liturgy_well_sung_liturgy + } + pam_tenet_divine_liturgy_officiant_effect = yes + } + # Tenet popularity + pam_tenet_popularity_on_personal_tenet_gain_effect = yes + } +} + +# Code on-action: when a character swaps out or removes a new personal tenet successfully this onaction is called. +# Root is character picking the tenet +# scope:tenet is the tenet they just dropped +on_personal_tenet_loss = { + effect = { + if = { + limit = { + is_ai = no + NOT = { has_fulfillment_parameter = default_sf_personal_tenet_change_no_stress } + } + add_stress = major_stress_gain + } + hedonistic_obesity_modifier_sync_effect = yes + if = { + limit = { + NOT = { has_personal_tenet_flag = tenet_divine_liturgy_well_sung_liturgy } + has_character_modifier = tenet_divine_liturgy_officiant_modifier + } + remove_character_modifier = tenet_divine_liturgy_officiant_modifier + } + pam_remove_forbidden_personal_tenet_secret_if_invalid_effect = yes + # Tenet popularity + pam_tenet_popularity_on_personal_tenet_loss_effect = yes + } +} + +update_main_rite_action = { + # you should win your position via the antipope system if there is a religious head, + trigger = { + NOT = { exists = religious_head } + } + effect = { + main_rite = { + save_scope_as = main_rite + save_scope_value_as = { name = rite_counties value = rite_counties } + save_scope_value_as = { name = rite_holy_sites value = rite_holy_sites } + } + if = { + limit = { + any_faith_rite = { + this != scope:main_rite + rite_counties > scope:rite_counties + rite_holy_sites >= scope:rite_holy_sites + } + } + ordered_faith_rite = { + limit = { + this != scope:main_rite + rite_holy_sites >= scope:rite_holy_sites + } + order_by = rite_counties + save_scope_as = new_main_rite + every_player = { + limit = { faith = root } + send_interface_message = { + title = msg_faith_main_rite_changed.title + desc = msg_faith_main_rite_changed.desc + right_icon = scope:new_main_rite + + show_as_tooltip = { + scope:new_main_rite = { + set_main_rite = yes + } + } + } + } + set_main_rite = yes + } + } + } +} + +############################ +# Faith Rite Growth System # +############################ + +# Faith scope. Once a month per faith. +# Slowly spawns new rites until the faith reaches its target rite count: floor(counties / X) - 1 +# branched rites besides the mainline, so the first branched rite arrives at 2 * X counties. +# Cooldown and target count live in game/common/script_values/02_religion_values.txt. + +faith_rite_growth_pulse = { + trigger = { + NOR = { + has_doctrine_parameter = unreformed + has_game_rule = none_branched_rite_frequency + exists = var:rite_growth_recent_spawn + exists = var:rite_growth_recent_heresy + } + rite_growth_rites_needed > 0 + years_from_game_start >= 2 + } + random_events = { + chance_to_happen = 3 + chance_of_no_event = { + value = 0 + if = { + limit = { fervor >= 25 } + value = fervor + max = 90 + } + if = { + limit = { rite_growth_rites_needed >= 5 } + max = 40 + } + else_if = { + limit = { rite_growth_rites_needed >= 3 } + max = 60 + } + } + 100 = rite_growth.0001 + } +} + +faith_rite_additional_growth_chance_pulse = { + trigger = { + NOR = { + has_doctrine_parameter = unreformed + has_game_rule = none_branched_rite_frequency + # Shorter cooldown than the primary pulse so a faith at target can still trickle an extra rite + exists = var:rite_growth_recent_spawn_fallback + exists = var:rite_growth_recent_heresy + } + rite_growth_active_rite_count < rite_growth_rites_soft_max_cap + num_county_followers >= rite_growth_fallback_min_counties + years_from_game_start >= 2 + } + random_events = { + chance_to_happen = 1 + chance_of_no_event = 90 + 100 = rite_growth.0001 + } +} + +# Called after Holy Site is added for a faith +# +# Root scope: Faith holy site is added for +# scope:title - barony title of location where holy site is created +# scope:holy_site - holy site being added (warning! may not be set, if generating description, and holy site is new) +# scope:is_eminent_site - if the holy site is eminent (else it is regular) +# scope:is_new_holy_site - if the holy site was newly created (else it was adopted) +# scope:actor - character responsible, only set when a character drove the change +on_faith_holy_site_added = { + effect = { + if = { + limit = { + scope:holy_site ?= { + any_holy_site_faith = { count = 1 } + } + } + record_dynamic_holy_site_kingdom_effect = { BARONY = scope:title } + } + # Send Toasts + if = { + limit = { scope:is_new_holy_site = yes } + notify_faith_of_holy_site_change_effect = { + MESSAGE = msg_holy_site_created + MESSAGE_BY_ACTOR = msg_holy_site_created_by_character + } + } + else = { + notify_faith_of_holy_site_change_effect = { + MESSAGE = msg_holy_site_adopted + MESSAGE_BY_ACTOR = msg_holy_site_adopted_by_character + } + } + # CE3 achievement: Father's best side — record the founding dynasty on runtime-created holy sites + if = { + limit = { + scope:is_new_holy_site = yes + exists = scope:actor.dynasty + } + scope:title = { + set_variable = { + name = ce3_holy_site_founder_dynasty + value = scope:actor.dynasty + } + } + } + } +} + +# Called after Holy Site is removed for a faith +# +# Root scope: Faith holy site is removed for +# scope:title - barony title of location where holy site was +# scope:holy_site - holy site being removed +# scope:is_eminent_site - if the holy site was eminent (else it was regular) +# scope:actor - character responsible, only set when a character drove the change +on_faith_holy_site_removed = { + effect = { + release_dynamic_holy_site_kingdom_effect = { BARONY = scope:title } + # We record the last faith left on a shared site here, since no add fires for them + scope:holy_site ?= { + if = { + limit = { any_holy_site_faith = { count = 1 } } + random_holy_site_faith = { + record_dynamic_holy_site_kingdom_effect = { BARONY = scope:title } + } + } + } + # Send Toasts + notify_faith_of_holy_site_change_effect = { + MESSAGE = msg_holy_site_abandoned + MESSAGE_BY_ACTOR = msg_holy_site_abandoned_by_character + } + } +} + +# Called after a Holy Site of a faith becomes eminent, or stops being eminent +# +# Root scope: Faith the holy site belongs to +# scope:title - barony title of location where the holy site is +# scope:holy_site - holy site changing eminence +# scope:is_eminent_site - if the holy site is now eminent (else it is now regular) +# scope:actor - character responsible, only set when a character drove the change +on_faith_holy_site_eminence_changed = { + effect = { + if = { + limit = { scope:is_eminent_site = yes } + notify_faith_of_holy_site_change_effect = { + MESSAGE = msg_holy_site_elevated + MESSAGE_BY_ACTOR = msg_holy_site_elevated_by_character + } + } + else = { + notify_faith_of_holy_site_change_effect = { + MESSAGE = msg_holy_site_demoted + MESSAGE_BY_ACTOR = msg_holy_site_demoted_by_character + } + } + } +} + +# Called when a Character creates a new Holy Site. +# Note: Also used to show effects in GUI before creation +# +# Root scope: Character creating holy site +# scope:title - barony title of location where holy site is created +# scope:holy_site_type - holy site type being created +# scope:faith - Faith the holy site is created for +# scope:artifacts - List of artifacts being enshrined +on_character_holy_site_created = { + effect = { + # Same holy-site slot rules as game start + scope:title.title_province = { + add_holy_site_fallback_special_building_slot_effect = { FAITH = scope:faith } + } + hidden_effect = { + if = { + limit = { scope:faith = { faith_has_free_holy_site_action_trigger = yes } } + scope:faith = { consume_free_holy_site_action_effect = yes } + } + else = { + set_variable = { + name = holy_site_creation_cooldown + years = holy_site_action_cooldown_years + } + } + } + # CE3 achievement: Father's best side — a relic from a saint of the actor's family, enshrined in a holy site the actor's dynasty founded + if = { + limit = { + exists = dynasty + scope:title.var:ce3_holy_site_founder_dynasty ?= dynasty + any_in_list = { + list = artifacts + exists = var:pam_saint_relic_saint + save_temporary_scope_as = relic_temp + root = { + OR = { + is_close_or_extended_family_of = scope:relic_temp.var:pam_saint_relic_saint + scope:relic_temp.var:pam_saint_relic_saint.dynasty ?= dynasty + } + } + } + } + add_achievement_global_variable_effect = { + VARIABLE = ce3_06_fathers_best_side_achievement_unlocked + VALUE = yes + } + } + } +} + on_character_faith_change = { effect = { check_for_equal_doctrine_effect = yes @@ -565,7 +2019,7 @@ on_character_faith_change = { if = { limit = { has_variable = japan_1010_discount - var:japan_1010_discount = faith + var:japan_1010_discount = faith } remove_variable = japan_1010_discount } @@ -594,328 +2048,6 @@ on_character_faith_change = { } } -# Code on-action: once a month for each faith -# Root is the faith -on_faith_monthly = { - on_actions = { - faith_holy_order_land_acquisition_pulse - delay = { days = { 5 10 }} - faith_heresy_events_pulse - delay = { days = { 15 20 }} - faith_fervor_events_pulse - } - events = { - hajj.0010 #Someone changed their capital to Mecca without having the Hajjaj trait - great_holy_war.0010 #Great Holy Wars are unlocked for a Faith. - great_holy_war.0001 - great_holy_war.0022 #Pope harasses players for not pledging support to Crusade yet. - great_holy_war.0030 #Monthly cleanup for Beneficiaries becoming unfit for various reasons. - } - effect = { - # Religious migrants created by the County Conversion council task move somewhere safe - random = { - chance = 4 # Roughly once every 2 years - save_scope_as = target_faith - if = { - limit = { - exists = var:converted_development - var:converted_development >= 1 - NOT = { - has_doctrine_parameter = unreformed - } - } - # Save all suitable rulers - random = { - chance = var:converted_development - save_scope_as = faith_target - every_independent_ruler = { - limit = { - is_landed = yes - NOT = { government_has_flag = government_is_herder } - # A very large area - enough for a province in north-western india to reach all of Borneo - "this.capital_province.squared_distance(root.var:associated_county.title_province)" <= squared_distance_mega - any_sub_realm_county = { - faith = prev.faith - } - trigger_if = { - limit = { - has_variable_list = faiths_converted_in_counties - } - NOT = { - is_target_in_variable_list = { - name = faiths_converted_in_counties - target = scope:target_faith - } - } - } - } - add_to_list = migration_targets - every_vassal = { - limit = { - is_landed = yes - highest_held_title_tier >= tier_duchy - any_sub_realm_county = { - faith = prev.faith - } - trigger_if = { - limit = { - has_variable_list = faiths_converted_in_counties - } - NOT = { - is_target_in_variable_list = { - name = faiths_converted_in_counties - target = scope:target_faith - } - } - } - } - add_to_list = migration_targets - } - } - every_player = { - limit = { - is_landed = yes - NOT = { government_has_flag = government_is_herder } - NOT = { is_in_list = migration_targets } - # A vary large area - enough for a province in north-western india to reach all of Borneo - "this.capital_province.squared_distance(root.var:associated_county.title_province)" <= squared_distance_mega - any_sub_realm_county = { - faith = prev.faith - } - trigger_if = { - limit = { - has_variable_list = faiths_converted_in_counties - } - NOT = { - is_target_in_variable_list = { - name = faiths_converted_in_counties - target = scope:target_faith - } - } - } - } - add_to_list = migration_targets - } - # If the faith is still large, they only want to move to same-faith rulers - if = { - limit = { - num_county_followers >= 40 - } - random_in_list = { - list = migration_targets - limit = { - faith = root - any_sub_realm_county = { - faith = root - } - # Do NOT go within the same realm as you were converted from - top_liege != scope:target_faith.var:associated_county.holder.top_liege - } - weight = { - base = 1 - modifier = { - add = 3 - is_ai = no - } - modifier = { - add = 3 - government_has_flag = government_is_mandala - } - modifier = { - add = 10 - highest_held_title_tier >= tier_kingdom - } - modifier = { - add = root.var:converted_development - NOT = { government_has_flag = government_is_nomadic } - any_sub_realm_county = { - count >= { - value = root.var:converted_development - divide = 2 - } - faith = root - } - } - modifier = { - add = 0.1 - government_has_flag = government_is_nomadic - } - modifier = { - add = 0.1 - highest_held_title_tier <= tier_county - } - } - save_scope_as = ruler_target - save_scope_as = seeking_same_faith_counties - trigger_event = global_religion.1000 - } - } - # Smaller faiths can go wherever - else = { - random_in_list = { - list = migration_targets - limit = { - NOR = { - top_liege = scope:target_faith.var:associated_county.holder.top_liege # Do NOT go within the same realm as you were converted from - faith = { has_doctrine = doctrine_pluralism_fundamentalist } - culture = { has_cultural_tradition = tradition_zealous_people } - } - OR = { - faith = { - faith_hostility_level = { - target = root - value <= faith_astray_level - } - } - faith = { has_doctrine = tenet_adaptive } - faith = { has_doctrine_parameter = unreformed } - faith = { has_doctrine = doctrine_pluralism_pluralistic } - culture = { has_cultural_tradition = tradition_religion_blending } - culture = { has_cultural_parameter = less_likely_to_force_conversion } - has_trait = nomadic_philosophy - AND = { - is_ai = no - has_perk = open_minded_perk - } - } - any_held_title = { - tier = tier_county - faith = prev.faith - trigger_if = { - limit = { - has_variable_list = faiths_converted_in_the_county - } - NOT = { - is_target_in_variable_list = { - name = faiths_converted_in_the_county - target = scope:target_faith - } - } - } - trigger_if = { - limit = { - holder = { - is_ai = yes - } - } - holder = { - is_ai = yes - } - } - } - } - weight = { - base = 1 - modifier = { - add = 3 - is_ai = no - } - modifier = { - add = 3 - government_has_flag = government_is_mandala - } - modifier = { - add = 10 - highest_held_title_tier >= tier_kingdom - } - modifier = { - add = root.var:converted_development - NOT = { government_has_flag = government_is_nomadic } - any_sub_realm_county = { - count >= { - value = root.var:converted_development - divide = 2 - } - faith = prev.faith - } - } - modifier = { - add = 0.1 - government_has_flag = government_is_nomadic - } - modifier = { - add = 0.1 - highest_held_title_tier <= tier_county - } - } - save_scope_as = ruler_target - save_scope_as = seeking_any_counties - trigger_event = global_religion.1000 - } - } - } - } - } - } -} - -faith_holy_order_land_acquisition_pulse = { - trigger = { - any_faith_holy_order = { - always = yes - } - } - - random_events = { - chance_to_happen = 17 # ~1 every six months - chance_of_no_event = { - value = 100 - every_faith_holy_order = { - subtract = 5 - } - every_ruler = { - limit = { - holy_order_1000_request_target_trigger = yes - } - subtract = 5 - } - if = { - limit = { - NOT = { - any_faith_holy_order = { - num_leased_titles < holy_order_barony_number_soft_threshold - } - } - } - add = 80 - } - min = 30 - } - 100 = 0 - 500 = holy_order.1000 - } -} - -faith_heresy_events_pulse = { - trigger = { - fervor <= 40 - NOR = { - has_doctrine_parameter = unreformed - has_variable = current_heresy - } - } - - random_events = { - chance_to_happen = 25 - chance_of_no_event = { - if = { - limit = { fervor > 30 } - value = 90 - } - else_if = { - limit = { fervor > 20 } - value = 70 - } - else_if = { - limit = { fervor > 10 } - value = 40 - } - } - 100 = heresy.0001 - 100 = heresy.0005 - } -} - faith_fervor_events_pulse = { trigger = { NOR = { @@ -931,111 +2063,103 @@ faith_fervor_events_pulse = { } } -pagan_conversion_pulse = { - trigger = { #Is the character ready to convert? - is_ai = yes - OR = { - top_liege = this - AND = { # Steppe people convert a bit more often & freely - capital_province ?= { geographical_region = world_steppe } - primary_title.tier >= tier_duchy - } +on_rite_updated = { + events = { + } + + effect = { + root = { + save_scope_as = rite } - government_has_flag = government_is_tribal - OR = { - has_realm_law = tribal_authority_2 - has_realm_law = tribal_authority_3 - } - faith = { has_doctrine_parameter = unreformed } - prestige_level >= 1 #lower than the regular requirement to make sure some rulers can convert - trigger_if = { # Lighten the dev requirements progressively + + if = { # slient it for EC since EC has unique evvent to inform limit = { + exists = scope:changed_tenets_or_doctrines OR = { - current_date <= 950.1.1 - AND = { - capital_province ?= { geographical_region = world_steppe } - primary_title.tier >= tier_duchy + NOT = { + faith = { has_variable = ecumenical_council_ongoing } + } + exists = scope:consume_rite_edit_token + } + } + + # The message icon slot must never be left unset, hence the fall-through to the rite itself + if = { + limit = { any_in_list = { list = added_tenets count >= 1 } } + every_in_list = { + list = added_tenets + save_scope_as = rite_change_icon + } + } + else_if = { + limit = { any_in_list = { list = added_doctrines count >= 1 } } + every_in_list = { + list = added_doctrines + save_scope_as = rite_change_icon + } + } + else_if = { + limit = { any_in_list = { list = removed_tenets count >= 1 } } + every_in_list = { + list = removed_tenets + save_scope_as = rite_change_icon + } + } + else_if = { + limit = { any_in_list = { list = removed_doctrines count >= 1 } } + every_in_list = { + list = removed_doctrines + save_scope_as = rite_change_icon + } + } + else = { + root = { save_scope_as = rite_change_icon } + } + + every_player = { + limit = { + OR = { + rite = root + AND = { + faith = root.faith + root.faith.main_rite = root + } + } + } + send_interface_message = { + type = msg_rite_updated + title = msg_rite_updated + left_icon = scope:rite_change_icon + + show_as_tooltip = { + every_in_list = { + list = removed_doctrines + root = { remove_rite_doctrine = prev } + } + every_in_list = { + list = added_doctrines + root = { add_rite_doctrine = prev } + } + every_in_list = { + list = removed_tenets + root = { remove_rite_tenet = prev } + } + every_in_list = { + list = added_tenets + root = { add_rite_tenet = prev } + } } } } - capital_province.county = { - development_level >= 7 #lower than the regular requirement to make sure some rulers can convert - } - } - trigger_else_if = { - limit = { - current_date <= 1000.1.1 - } - capital_province.county = { - development_level >= 6 #lower than the regular requirement to make sure some rulers can convert - } - } - trigger_else = { - capital_province.county = { - development_level >= 5 #lower than the regular requirement to make sure some rulers can convert - } } - culture = { - calc_true_if = { - amount >= 7 - has_innovation = innovation_motte - has_innovation = innovation_catapult - has_innovation = innovation_barracks - has_innovation = innovation_mustering_grounds - has_innovation = innovation_bannus - has_innovation = innovation_quilted_armor - has_innovation = innovation_gavelkind - has_innovation = innovation_crop_rotation - has_innovation = innovation_city_planning - has_innovation = innovation_casus_belli - has_innovation = innovation_plenary_assemblies - has_innovation = innovation_ledger - has_innovation = innovation_development_01 - has_innovation = innovation_currency_01 - } + head_of_rite ?= { + trigger_event = faith_creation.0004 # Update HoF succession law + trigger_event = faith_creation.0001 # Temporal rel head setup + trigger_event = faith_creation.0002 # Spiritual rel head setup + trigger_event = faith_creation.0011 # Restore Temporal rel head + trigger_event = faith_creation.0012 # Restore Spiritual rel head + trigger_event = faith_creation.1100 # Destroy HoF title if no longer valid } } - - events = { - # global_religion.0001 #Pagan reformed by neighbor, spouse, soulmate, friend, or geographic location - } -} - -# Code on-action: when a great holy war no longer has a valid target, and there was no one left in the target kingdom to replace them. The target scopes will still point to the last target at this point -# If a new target is not picked in script, the GHW will be invalidated -# Root is the great holy war -on_potential_great_holy_war_invalidation = { - events = { - great_holy_war.0004 - } -} - -# Code on-action: when on_potential_great_holy_war_invalidation did not find a new target, and the GHW is about to be destroyed. no way out at this point -# Root is the great holy war -on_great_holy_war_invalidation = { - events = { - great_holy_war.0055 #Send notifications to players. - } -} - -# Code on-action: when the GHW's war launch countdown hits zero. If a war is not started at this point, the GHW will invalidate, bypassing on_potential_great_holy_war_invalidation but not on_great_holy_war_invalidation -# Root is the great holy war -on_great_holy_war_countdown_end = { - trigger = { #Only launch the holy war if attacker strength is above one third of defender. - ghw_attackers_strength >= third_of_defenders_strength - } - events = { - great_holy_war.0005 - } -} - -# Code on-action: when a character in a GHW is replaced. This can only happen when the war has begun, and a participant dies; if they get replaced in the war by someone of the right faith, then this will get called. Can be used to validate their benficiary, for instance -# Root is character being replaced -# scope:great_holy_war is the GHW -# scope:replacement is the replacement character -on_great_holy_war_participant_replaced = { - events = { - great_holy_war.0027 #Refresh Beneficiary for AI. - } } diff --git a/common/on_action/title_on_actions.txt b/common/on_action/title_on_actions.txt index 3564f2529..4e7b60e30 100644 --- a/common/on_action/title_on_actions.txt +++ b/common/on_action/title_on_actions.txt @@ -21,6 +21,10 @@ # flag:faction_demand # flag:swear_fealty # flag:stepped_down +# flag:appointment +# flag:appointment_succession +# flag:migration +# flag:confederation # A title is destroyed # root = the holder before destruction @@ -28,10 +32,13 @@ # Does *not* provide scope:transfer_type on_title_destroyed = { effect = { + scope:landed_title.var:administrative_ui_special_title ?= { + owner = { destroy_title = prev } + } # If the title of an independent admin ruler is destroyed, let's make sure we handle any stray admin vassals if = { limit = { - government_allows = administrative + government_has_mechanic = administrative top_liege = this administrative_counts_can_be_independent = no NOT = { @@ -58,6 +65,20 @@ on_title_destroyed = { target = scope:landed_title } } + # Empire Faith Gate: remove holder from empire-holders list when they lose their last empire. + else_if = { + limit = { + scope:landed_title = { tier >= tier_empire } + root = { NOT = { any_held_title = { tier >= tier_empire } } } + } + root = { + remove_list_global_variable = { + name = efg_empire_holders + target = this + } + efg_remove_contested_empire_modifiers_effect = yes + } + } #Notify folks the latin empire has fallen # else_if = { # limit = { scope:landed_title = title:e_latin_empire } @@ -251,6 +272,16 @@ on_title_gain = { } } } + + # Empire Faith Gate: refresh contested-empire modifiers immediately when an empire is destroyed. + if = { + limit = { + empire_faith_gate_enabled_trigger = yes + scope:landed_title = { tier >= tier_empire } + } + root = { efg_recalculate_contested_empire_for_faith_effect = yes } + } + if = { limit = { government_has_flag = government_is_urepublic @@ -476,8 +507,33 @@ on_title_gain = { } title_domicile = { add_domicile_building = yurt_main_02 - add_domicile_building = yurt_main_03 - add_domicile_building = yurt_main_04 + if = { + limit = { + has_domicile_building = yurt_main_02 + owner ?= { + OR = { + has_realm_law = nomadic_authority_2 + has_realm_law = nomadic_authority_3 + has_realm_law = nomadic_authority_4 + has_realm_law = nomadic_authority_5 + } + } + } + add_domicile_building = yurt_main_03 + if = { + limit = { + has_domicile_building = yurt_main_03 + owner ?= { + OR = { + has_realm_law = nomadic_authority_3 + has_realm_law = nomadic_authority_4 + has_realm_law = nomadic_authority_5 + } + } + } + add_domicile_building = yurt_main_04 + } + } add_random_yurt_external_building_effect = yes add_random_yurt_external_building_effect = yes add_random_yurt_external_building_effect = yes @@ -494,8 +550,33 @@ on_title_gain = { } title_domicile = { add_domicile_building = yurt_main_02 - add_domicile_building = yurt_main_03 - add_domicile_building = yurt_main_04 + if = { + limit = { + has_domicile_building = yurt_main_02 + owner ?= { + OR = { + has_realm_law = nomadic_authority_2 + has_realm_law = nomadic_authority_3 + has_realm_law = nomadic_authority_4 + has_realm_law = nomadic_authority_5 + } + } + } + add_domicile_building = yurt_main_03 + if = { + limit = { + has_domicile_building = yurt_main_03 + owner ?= { + OR = { + has_realm_law = nomadic_authority_3 + has_realm_law = nomadic_authority_4 + has_realm_law = nomadic_authority_5 + } + } + } + add_domicile_building = yurt_main_04 + } + } add_random_yurt_external_building_effect = yes add_random_yurt_external_building_effect = yes add_random_yurt_external_building_effect = yes @@ -779,6 +860,25 @@ on_title_gain = { } } + ########### + # PAM - New holder of a county with an ancestral Khachkar + ########### + if = { + limit = { + has_pam_dlc_trigger = yes + pam_remove_khachkar_new_holder_trigger = { + TITLE = scope:title + PREVIOUS_HOLDER = scope:previous_holder + NEW_HOLDER = root + } + } + scope:title = { + remove_county_modifier = pam_khachkar_ancestral_county + remove_variable = pam_khachkar_ancestor + remove_variable = pam_khachkar_commissioner + } + } + ########### # EP3 ADVENTURERS BECOMING LANDED ########### @@ -839,9 +939,10 @@ on_title_gain = { if = { limit = { scope:title = { is_noble_family_title = yes } - NOT = { government_has_flag = government_is_administrative } + NOT = { government_has_mechanic = administrative } + top_liege ?= { government_has_mechanic = administrative } } - change_government = administrative_government + change_government = top_liege.government_type } } } @@ -1046,10 +1147,29 @@ on_title_gain = { limit = { scope:title = { is_holy_order = yes } NOT = { has_trait = order_member } - government_has_flag = government_is_holy_order + government_has_flag = government_is_military_holy_order } add_trait = order_member } + else_if = { + limit = { + scope:title = { is_holy_order = yes } + NOT = { has_trait = devoted } + government_has_flag = government_is_monastic_holy_order + } + # Full monastic vows supersede a deacon's ordination + remove_trait = cleric + add_trait = devoted + } + + # Ordained court clergy who rise to lay rule set the office aside + if = { + limit = { + has_trait = cleric + NOT = { pam_is_clergy_ruler_trigger = yes } + } + remove_trait = cleric + } # Apply Created Title opinion to Courtly Vassals (This is present in two places in this on_action) if = { @@ -1316,7 +1436,7 @@ on_title_gain = { # Not for meritocratic NOT = { government_has_flag = government_has_merit } # Admin only - government_allows = administrative + government_has_mechanic = administrative has_ep3_dlc_trigger = yes # Independent rulers only this = top_liege @@ -2048,7 +2168,7 @@ on_title_gain = { } if = { limit = { - government_allows = administrative + government_has_mechanic = administrative NOT = { has_variable = laamp_invasion_flag } } # EP3 - apply unique domicile building bonus if appropriate @@ -2109,7 +2229,6 @@ on_title_gain = { top_liege = this highest_held_title_tier >= tier_kingdom scope:title = root.primary_title - has_ep3_dlc_trigger = yes #Checks so this event doesn't fire after character creation, although it's not really a problem if it does current_date_is_start_date_trigger = no } @@ -2188,10 +2307,11 @@ on_title_gain = { primary_title.tier <= scope:title.tier NOT = { has_character_flag = admin_title_gain_notification_sent } exists = house + NOT = { exists = scope:title.var:ceremonial_title } any_player = { house ?= root.house top_liege = root.top_liege - government_allows = administrative + government_has_mechanic = administrative this != root } } @@ -2204,7 +2324,7 @@ on_title_gain = { limit = { house ?= root.house top_liege = root.top_liege - government_allows = administrative + government_has_mechanic = administrative this != scope:title_gainer # scope:title != title:k_chrysanthemum_throne } @@ -2277,13 +2397,13 @@ on_title_gain = { } } } - + # Merit based candidate score bonus is removed when successfully getting a new governorship if = { limit = { - OR = { - has_variable = merit_civilian_career_score_bonus - has_variable = merit_military_career_score_bonus + has_variable = { + name = merit_civilian_career_score_bonus + name = merit_military_career_score_bonus } is_landed = yes scope:title.tier >= primary_title.tier @@ -2406,7 +2526,7 @@ on_title_gain = { var:homage_liege_scope ?= scope:previous_holder NOT = { has_character_flag = currently_invalidating_petition_liege_travel } } - current_travel_plan = { + current_travel_plan = { if = { limit = { can_cancel = yes } cancel_travel_plan = yes @@ -2429,7 +2549,7 @@ on_title_gain = { var:pledge_loyalty_to_liege_scope ?= scope:previous_holder NOT = { has_character_flag = currently_invalidating_petition_liege_travel } } - current_travel_plan = { + current_travel_plan = { if = { limit = { can_cancel = yes } cancel_travel_plan = yes @@ -2463,7 +2583,7 @@ on_title_gain = { } } } - scope:previous_holder.house_head = { save_scope_as = house_feud_rival } + scope:previous_holder.house.house_head = { save_scope_as = house_feud_rival } trigger_event = bp1_house_feud.7000 } } @@ -2534,7 +2654,7 @@ on_title_gain = { is_ruler = no highest_held_title_tier <= scope:title.tier government_has_flag = government_is_landless_adventurer - government_allows = administrative + government_has_mechanic = administrative } } if = { @@ -2614,6 +2734,57 @@ on_title_gain = { } scope:bloc = { add_confederation_member = scope:bloc_joiner } } + # Empire Faith Gate: maintain global list of independent empire-tier rulers for perf. + if = { + limit = { + scope:title = { tier >= tier_empire } + root = { is_independent_ruler = yes } + NOT = { + is_target_in_global_variable_list = { + name = efg_empire_holders + target = root + } + } + } + add_to_global_variable_list = { + name = efg_empire_holders + target = root + } + } + if = { + limit = { + scope:title = { tier >= tier_empire } + scope:previous_holder ?= { + NOT = { any_held_title = { tier >= tier_empire } } + } + } + scope:previous_holder ?= { + remove_list_global_variable = { + name = efg_empire_holders + target = this + } + efg_remove_contested_empire_modifiers_effect = yes + } + } + # Empire Faith Gate: refresh contested-empire modifiers immediately for affected faith groups. + if = { + limit = { + empire_faith_gate_enabled_trigger = yes + scope:title = { tier >= tier_empire } + NOT = { scope:transfer_type = flag:created } + } + root = { efg_recalculate_contested_empire_for_faith_effect = yes } + if = { + limit = { + scope:previous_holder ?= { + NOT = { faith = root.faith } + } + } + scope:previous_holder ?= { efg_recalculate_contested_empire_for_faith_effect = yes } + } + } + # Empire Faith Gate: contested-empire legitimacy is handled by + # empire_faith_gate.0001 in the events section below. #Coronation modifier is lost if = { limit = { @@ -2784,7 +2955,6 @@ on_title_gain = { is_independent_ruler = yes government_has_flag = government_is_celestial scope:title ?= { - tier >= tier_kingdom has_custom_title_name = yes this != root.primary_title } @@ -2793,6 +2963,180 @@ on_title_gain = { reset_title_name = yes } } + #Invalidate holy order creation + if = { + limit = { + scope:title = { + tier = tier_county + any_county_province = { + has_variable = monastic_order_capital + var:monastic_order_capital = { save_temporary_scope_as = faith_temp } + } + } + NOT = { + faith = scope:faith_temp + } + } + scope:title = { + random_county_province = { + limit = { + has_variable = monastic_order_capital + } + remove_variable = monastic_order_capital + } + } + } + + + ######### + # PAM # + ######### + if = { + limit = { has_pam_dlc_trigger = yes } + if = { + # title is a clerical region now held by a christian ruler (archbishop) + limit = { + scope:title = { + has_clerical_region = yes + } + OR = { + religion = religion:eastern_orthodox_religion + religion = religion:oriental_orthodox_religion + religion = religion:catholic_religion + religion = religion:protestant_religion + } + } + + # flip county rite to the holder to initiate spread if they are of the same faith as current faith of county + if = { + limit = { + scope:title.title_capital_county.faith = root.faith + } + scope:title.title_capital_county = { set_county_rite = root.rite } + } + +# situation:the_christian_church ?= { +# situation_sub_region:core = { +# add_clerical_realm_to_sub_region = scope:title +# } +# } + } + # Clerical Christian appointment succession to a holder from the same house as the previous holder + if = { + limit = { + exists = scope:previous_holder + scope:previous_holder != root + OR = { + scope:title = { has_title_law = clerical_appointment_law } + scope:previous_holder = { has_realm_law = clerical_appointment_law } + } + scope:previous_holder = { + OR = { + religion = religion:eastern_orthodox_religion + religion = religion:oriental_orthodox_religion + religion = religion:catholic_religion + religion = religion:protestant_religion + } + exists = house + house = root.house + } + root = { OR = {religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion} } +# situation:the_christian_church ?= { +# situation_top_has_catalyst = catalyst_clergy_appointed_from_same_family +# } + } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_clergy_appointed_from_same_family +# } + } +# if = { +# limit = { +# scope:title = title:c_jerusalem +# religion = religion:christianity_religion +# scope:previous_holder ?= { +# NOT = { religion = religion:christianity_religion } +# } +# NOR = { +# scope:transfer_type = flag:created +# scope:transfer_type = flag:inheritance +# } +# any_character_situation = { +# situation_type = the_christian_church +# situation_top_has_catalyst = catalyst_the_christian_church_jerusalem_reclaimed +# } +# } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_the_christian_church_jerusalem_reclaimed +# } +# } +# if = { +# limit = { +# scope:title.tier = tier_county +# NOT = { scope:title = title:c_jerusalem } +# religion = religion:christianity_religion +# scope:previous_holder ?= { +# NOT = { religion = religion:christianity_religion } +# } +# NOR = { +# scope:transfer_type = flag:created +# scope:transfer_type = flag:inheritance +# } +# religion:christianity_religion = { +# any_faith = { +# save_temporary_scope_as = faith_check +# scope:title = { +# any_county_province = { +# barony = { is_holy_site_of = scope:faith_check } +# } +# } +# } +# } +# any_character_situation = { +# situation_type = the_christian_church +# situation_top_has_catalyst = catalyst_the_christian_church_christian_holy_site_reclaimed +# } +# } +# situation:the_christian_church = { +# trigger_situation_catalyst = catalyst_the_christian_church_christian_holy_site_reclaimed +# } +# } + } + if = { + limit = { + house ?= { + has_variable = cleric_support + var:cleric_support = { + is_alive = yes + is_ruler = yes + } + } + NOT = { + has_variable = recent_cleric_support_bonus + } + } + set_variable = { + name = recent_cleric_support_bonus + days = 15 + } + save_scope_as = house_person + house.var:cleric_support = { + send_interface_message = { + type = msg_cleric_support_title_gain + title = cleric_support_title_gained.tt + desc = cleric_support_title_gained.desc + left_icon = root + right_icon = scope:title + add_prestige = { + value = minor_prestige_gain + multiply = scope:title.tier + } + add_piety = { + value = minor_piety_gain + multiply = scope:title.tier + } + } + } + } } events = { realm_maintenance.2001 #Big notification about inheriting emperor tier title @@ -2800,6 +3144,7 @@ on_title_gain = { # 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 } } @@ -3188,6 +3533,7 @@ on_title_lost = { #If they've ventured far outside Europe, they're unlikely to come back, so we don't #want them. scope:title = { tier = tier_county + exists = title_province title_province = { OR = { geographical_region = world_europe @@ -3283,7 +3629,7 @@ on_title_lost = { custom_tooltip = msg_rival_dethroned_desc - stress_impact = { + stress_and_fulfillment_impact = { base = medium_stress_loss vengeful = medium_stress_loss } @@ -3561,9 +3907,9 @@ on_title_lost = { additional_flavor_check_effect = yes if = { - limit = { + limit = { OR = { - scope:title = title:h_roman_empire + scope:title = title:h_roman_empire scope:title = title:h_eastern_roman_empire } } @@ -3573,6 +3919,7 @@ on_title_lost = { if = { limit = { scope:title.tier > tier_barony + NOT = { exists = scope:title.var:ceremonial_title } trigger_if = { # Prevent msg spam when rulers give away or lose lower tier titles limit = { is_landed = yes @@ -3581,7 +3928,7 @@ on_title_lost = { } is_alive = yes NOT = { has_character_flag = admin_title_loss_notification_sent } - government_allows = administrative + government_has_mechanic = administrative house ?= { any_house_member = { is_ai = no @@ -3589,7 +3936,7 @@ on_title_lost = { limit = { exists = root.top_liege } top_liege = root.top_liege } - government_allows = administrative + government_has_mechanic = administrative this != root } } @@ -3607,7 +3954,7 @@ on_title_lost = { limit = { exists = root.top_liege } top_liege = root.top_liege } - government_allows = administrative + government_has_mechanic = administrative this != scope:title_loser } send_interface_message = { @@ -3732,9 +4079,7 @@ on_title_lost = { limit = { exists = root.player_heir exists = root.dynasty - player_heir = { - dynasty ?= story_owner.dynasty - } + player_heir.dynasty ?= root.dynasty } player_heir ?= { trigger_event = { @@ -3934,6 +4279,22 @@ on_title_lost = { scope:house_head_court = { add_courtier = root } } } + + ######### + # PAM # + ######### +# if = { +# limit = { +# scope:title = { +# has_clerical_region = yes +# root = { religion = religion:christianity_religion } +# scope:new_holder = { NOT = { religion = religion:christianity_religion } } +# } +# } +# situation:the_christian_church.situation_sub_region:core = { +# remove_clerical_realm_from_sub_region = scope:landed_title +# } +# } } } @@ -4038,7 +4399,7 @@ on_rank_up = { # Will not fire during history execution or for dying characters # EP3 - Ensure Emperor keeps old realm capital in admin realms if = { limit = { - government_allows = administrative + government_has_mechanic = administrative NOT = { has_variable = laamp_invasion_flag } top_liege = this trigger_if = { @@ -4102,15 +4463,15 @@ on_rank_up = { # Will not fire during history execution or for dying characters is_ai = no primary_title.tier >= tier_kingdom has_realm_law = uncrowned - NOR = { - has_variable = crowned_king_var - has_variable = crowned_emperor_var + has_none_of_variables = { + name = crowned_king_var + name = crowned_emperor_var } NOR = { has_character_flag = had_coronation_reminder any_sponsored_inspiration = { has_inspiration_type = smith_inspiration } } - is_available_adult = yes + is_available_adult = yes } trigger_event = { id = ach_yearly_events.1005 @@ -4163,7 +4524,7 @@ on_rank_up = { # Will not fire during history execution or for dying characters limit = { is_ai = no is_landed = yes - highest_held_title_tier = tier_empire + highest_held_title_tier >= tier_empire } add_achievement_global_variable_effect = { VARIABLE = rags_to_riches_to_rags_to_riches_first_empire @@ -4174,7 +4535,7 @@ on_rank_up = { # Will not fire during history execution or for dying characters limit = { is_ai = no is_landed = yes - highest_held_title_tier = tier_empire + highest_held_title_tier >= tier_empire exists = global_var:rags_to_riches_to_rags_to_riches_adventurer } add_achievement_global_variable_effect = { @@ -4217,7 +4578,7 @@ on_rank_up = { # Will not fire during history execution or for dying characters if = { limit = { is_independent_ruler = yes - government_allows = administrative + government_has_mechanic = administrative scope:title ?= { any_title_maa_regiment = { count >= 1 @@ -4234,7 +4595,6 @@ on_rank_up = { # Will not fire during history execution or for dying characters is_independent_ruler = yes government_has_flag = government_is_celestial scope:title ?= { - tier >= tier_kingdom has_custom_title_name = yes } primary_title = { @@ -4256,7 +4616,7 @@ on_rank_up = { # Will not fire during history execution or for dying characters type = conquest_populist days = 1 } - previous_holder = { + previous_holder ?= { tgp_use_chinese_naming_trigger = yes } } @@ -4270,7 +4630,10 @@ on_rank_up = { # Will not fire during history execution or for dying characters primary_title ?= { has_custom_title_name = no } - primary_title.previous_holder.dynasty != root.dynasty + AND = { + exists = primary_title.previous_holder + primary_title.previous_holder.dynasty != root.dynasty + } } trigger_if = { limit = { @@ -4336,6 +4699,9 @@ on_rank_up = { # Will not fire during history execution or for dying characters } resolve_title_and_vassal_change = scope:change } + + # Clear tier-based HoF interaction blockers + remove_character_flag = hof_request_cooldown } } @@ -4381,13 +4747,13 @@ on_rank_down = { # Will not fire during history execution or for dying character } } } - + # Additional Flavor Title additional_flavor_check_effect = yes - + # ACH - Remove variables if they are going below certain ranks coronation_reset_realm_law_variable_effect = yes - + # ACH - if you are below king tier, remove all oaths if = { limit = { @@ -4412,7 +4778,7 @@ on_rank_down = { # Will not fire during history execution or for dying character } if = { - limit = { + limit = { exists = scope:new_wedding_host has_variable = promised_grand_wedding_to } @@ -4550,10 +4916,12 @@ on_vassal_gained = { # It is also fired for rulers gaining independence, those can be identified by checking current liege on_vassal_change = { effect = { + # usually, diarch must be vassal or courtier + diarchy_validation_check_effect = yes ### If a admin duke-tier character becomes the top-liege's direct vassal, ensure that they have a noble family title if = { limit = { - government_allows = administrative + government_allows = noble_families is_house_head = yes trigger_if = { # This trigger is intentionally different from the similar effect in on_title_gain up above. We want all direct vassals of the top liege to have a family title if they can @@ -4563,7 +4931,7 @@ on_vassal_change = { trigger_else = { highest_held_title_tier >= tier_duchy } liege = { top_liege = this - government_allows = administrative + government_allows = noble_families } NOR = { any_held_title = { is_noble_family_title = yes } @@ -4580,10 +4948,10 @@ on_vassal_change = { ### If an admin ruler becomes independent... if = { limit = { - government_has_flag = government_is_administrative + government_has_mechanic = administrative } if = { - limit = { + limit = { liege = root # I.e. root is independent } # And is not of a high enough rank, change government @@ -4596,10 +4964,9 @@ on_vassal_change = { # If they can be independent, make sure they have a noble family title else_if = { limit = { + government_allows = noble_families NOT = { - any_held_title = { - is_noble_family_title = yes - } + exists = house.noble_family } } create_noble_family_effect = { GOVERNMENT_GIVER = this } @@ -4609,6 +4976,7 @@ on_vassal_change = { # Byz admin landless NF should always be direct vassal of top liege else_if = { limit = { + government_has_flag = government_is_administrative liege != top_liege primary_title = { is_noble_family_title = yes @@ -4626,6 +4994,43 @@ on_vassal_change = { resolve_title_and_vassal_change = scope:change } } + # Empire Faith Gate: sync the empire-holders list when an empire-tier ruler gains or loses independence. + if = { + limit = { + empire_faith_gate_enabled_trigger = yes + highest_held_title_tier >= tier_empire + } + if = { + limit = { liege = root } + if = { + limit = { + NOT = { + is_target_in_global_variable_list = { + name = efg_empire_holders + target = root + } + } + } + add_to_global_variable_list = { + name = efg_empire_holders + target = root + } + } + } + else_if = { + limit = { + is_target_in_global_variable_list = { + name = efg_empire_holders + target = root + } + } + remove_list_global_variable = { + name = efg_empire_holders + target = root + } + } + root = { efg_recalculate_contested_empire_for_faith_effect = yes } + } ### Independent Celestial rulers who become direct vassals of a top liege adopt Military obligations if they have title troops - Everyone else will default to Standard. if = { limit = { @@ -4645,7 +5050,7 @@ on_vassal_change = { } vassal_contract_set_obligation_level = { type = celestial_provinces level = 3 } } - + ### If a minister becomes independent we destroy the ministry title # if = { # limit = { @@ -4718,7 +5123,7 @@ on_vassal_change = { reset_title_name = yes } } - + # Destroy ceremonial titles of vassalized realms if = { limit = { @@ -4738,7 +5143,7 @@ on_vassal_change = { remove_trait = former_emperor } } - + # Bloc if = { # Let code trigger this if this is due to succession @@ -4769,10 +5174,17 @@ on_baron_found_or_created_for_title = { # Called when realm capital changes. It can be manual move, loss in conquest, move after inheritance, # move when granted a better title, becoming landed for the first time # root: New realm capital barony +# scope:holder character changing capital. The same character can change capital multiple times at once +# depending on what is happening, so check if the holders match. # scope:old_capital - previous capital barony. Can be empty, can be owned by someone else on_realm_capital_change = { effect = { holder ?= { + # Landed-only royal court: landless Pope re-lands with a culture-derived one on_title_gain never sees + if = { + limit = { has_title = title:k_papal_state } + enforce_papal_latin_court_language_effect = yes + } # Do we need to refresh their vizier's modifiers? if = { limit = { has_diarchy_parameter = diarchy_is_vizierate } @@ -4912,13 +5324,10 @@ on_realm_capital_change = { # Move ministers to realm capital. if = { - limit = { - tgp_has_access_to_ministry_trigger = yes - } + limit = { tgp_has_access_to_ministry_trigger = yes } + capital_province = { save_scope_as = capital_province } every_vassal = { - limit = { - tgp_has_minister_title = yes - } + limit = { tgp_has_minister_title = yes } every_held_title = { limit = { OR = { @@ -4926,13 +5335,10 @@ on_realm_capital_change = { tgp_is_minister_title = yes } } - set_capital_county = ROOT.county + set_capital_county = scope:capital_province.county } - if = { - limit = { is_ai = yes } - domicile ?= { - move_domicile = ROOT.title_province - } + domicile ?= { + move_domicile = scope:capital_province } # don't move them in such cases if = { diff --git a/common/on_action/travel_on_actions.txt b/common/on_action/travel_on_actions.txt index 4cd4596be..d53d29cf5 100644 --- a/common/on_action/travel_on_actions.txt +++ b/common/on_action/travel_on_actions.txt @@ -28,6 +28,8 @@ on_travel_plan_movement = { # Used for loc in the travel completion event # Variable cleanup in the completion event (travel_completion_event.1000) effect = { + # Passive learning from foreign-rite provinces/locals. + passive_rite_learning_travel_province_effect = yes # Wandering Lifestyle XP wandering_lifestyle_exp_post_travel_effect = yes # Increase xp for traveler trait @@ -409,7 +411,7 @@ on_travel_plan_movement = { province = root.current_travel_plan.current_location is_physically_able_adult = yes NOR = { - faith = root.faith + rite = root.rite has_relation_rival = root has_character_flag = ai_will_not_convert has_trait = zealous @@ -427,7 +429,7 @@ on_travel_plan_movement = { limit = { is_physically_able_adult = yes NOR = { - faith = root.faith + rite = root.rite has_relation_rival = root has_character_flag = ai_will_not_convert has_trait = zealous @@ -445,7 +447,7 @@ on_travel_plan_movement = { left_icon = scope:wanderer_to_convert add_piety = miniscule_piety_value scope:wanderer_to_convert = { - set_character_faith = root.faith + set_character_rite = root.rite } } } @@ -484,13 +486,27 @@ on_travel_plan_movement = { } } } + # PAM Scholasticism personal tenet - the travelling studium + if = { + limit = { + has_personal_tenet_flag = tenet_scholasticism_travelling_studium + current_travel_plan ?= { + any_entourage_character = { + NOT = { this = root } + is_physically_able_ai_adult = yes + ep1_is_valid_character_for_inspiration_trigger = yes + } + } + } + pam_tenet_scholasticism_studium_effect = yes + } if = { limit = { has_perk = church_and_state_perk has_government = landless_adventurer_government location = { has_holding_type = church_holding } } - add_piety = miniscule_piety_gain + add_piety = adventurer_church_and_state_perk_2_value } # laamp_base_1041/Ambush Travellers task contract minigame. current_travel_plan ?= { @@ -509,6 +525,8 @@ on_travel_plan_movement = { } else_if = { limit = { var:encounters_tally < var:encounters_max } + # 1782 picks its victim through the contract's previous_victims_list + save_scope_as = task_contract root = { trigger_event = laamp_base_contract_schemes.1782 } set_variable = { name = event_ratio_tracker @@ -550,6 +568,33 @@ on_travel_plan_movement = { } trigger_event = migration_events.1051 } + #Christians get the opportunity to acquire pilgrim badges from other Christian faiths, if out traveling + if = { + limit = { + faith.religion = religion:catholic_religion + religion:catholic_religion = { + any_faith = { + any_holy_site_barony = { + title_province = { this = root.current_travel_plan.current_location } + } + } + } + NOR = { + #Not if you already have a badge originating from this place + any_character_artifact = { + has_variable = is_pilgrim_badge + var:pilgrim_badge_location.title_province ?= root.current_travel_plan.current_location + } + #Nor if you can go on a pilgrimage here, sheesh + faith = { + any_holy_site_barony = { + title_province = { this = root.current_travel_plan.current_location } + } + } + } + } + trigger_event = travel_events.2310 + } } } @@ -724,6 +769,8 @@ travel_events_on_action = { effect = { #Invalidate Tribute Missions tribute_mission_invalidation_effect = yes + # Invalidate Petition Head of Faith travel + petition_head_of_faith_invalidation_effect = yes # Invalidate travelling hostages hostage_travel_invalidation_effect = yes # Invalidate travelling wards @@ -777,6 +824,7 @@ travel_events_on_action = { 100 = travel_events.2037 #Visit some hunting grounds - Sadistic province owner is manhunting 150 = travel_events.2038 #Visit some hunting grounds - Friendly competition with an entourage member 100 = travel_events.2200 #A local knight wants to fight someone + 100 = travel_events.2300 #Thieves stole your pilgrim badge (and other things) in the night! 100 = travel_events.3000 #Rumours about grotesque creatures 100 = travel_events.3010 #Lost pet 200 = travel_events.3030 #Infatuated knight @@ -907,6 +955,9 @@ travel_events_on_action = { 100 = legend_spread_events.8010 #Someone challenges you to a duel 100 = travel_events.5001 #You come across a local legend + # PAM Travel Events + 50 = pam_generic_events.0010 # Meet a same-faith ruler hunting in their holding + #EP3 Travel Events 1000 = ep3_travel_events.3000 #Waters of the Jordan 300 = ep3_travel_events.3002 #Where Armenians Govern @@ -949,6 +1000,13 @@ travel_events_on_action = { 50 = tgp_japan_yearly_events.1040 # 1040 - You come across a red bridge 50 = tgp_japan_yearly_events.1120 # 1120 - You meet a warrior monk 50 = tgp_japan_yearly_events.1140 # 1140 - You are stopped in Soryo lands as a Ritsuryo ruler + + # PAM Travel Events + 100 = pam_theocratic_ruler_events.0012 # Theocratic ruler: sacred grove in the forest while traveling through realm + + #Passive Rite Learning travel events + 150 = rite_travel_events.1000 # Fascinating Stranger - full rite learn + 150 = rite_travel_events.2000 # Revelation - resonant core tenet } } @@ -1351,7 +1409,7 @@ on_travel_plan_start = { title = wanderer_restlessness_removal_title right_icon = root add_wanderer_lifestyle_xp = 250 - stress_impact = { base = -25 } + stress_and_fulfillment_impact = { base = -25 } remove_character_modifier = wanderer_restlessness_modifier } } @@ -1362,13 +1420,18 @@ on_travel_plan_start = { has_variable = prepare_travels_value var:prepare_travels_value >= 1 } - current_travel_plan = { - set_variable = { - name = prepare_travels_modifier_value - value = root.var:prepare_travels_value - } - add_travel_plan_modifier = prepare_travels_modifier + #current_travel_plan = { + # set_variable = { + # name = prepare_travels_modifier_value + # value = root.var:prepare_travels_value + # } + # add_travel_plan_modifier = prepare_travels_modifier + #} + set_variable = { + name = prepare_travels_modifier_value + value = root.var:prepare_travels_value } + add_character_modifier = prepare_travels_character_modifier remove_variable = prepare_travels_value } } @@ -1701,6 +1764,14 @@ on_travel_plan_complete = { #Remove characters added by travel options at the start of travel plan remove_travel_option_added_character_effect = yes + + if = { + limit = { + has_character_modifier = prepare_travels_character_modifier + } + remove_character_modifier = prepare_travels_character_modifier + remove_variable = prepare_travels_modifier_value + } } } @@ -1718,6 +1789,21 @@ on_travel_plan_abort = { limit = { has_variable = ep3_laamp_decision_1000_is_excavating } remove_variable = ep3_laamp_decision_1000_is_excavating } + #PAM Holy Myron: a landed chaplain's journey was interrupted + #Unlanded chaplains never reach this on_action + #Death and cancel hooks plus thirty-year variable lifetimes cover them instead + if = { + limit = { has_variable = pam_holy_myron_journey_tier } + var:pam_holy_myron_liege ?= { + send_interface_toast = { + type = event_toast_effect_bad + title = pam_holy_myron_journey_abandoned_toast + left_icon = root + remove_decision_cooldown = pam_prepare_holy_myron_decision + } + } + pam_holy_myron_journey_cleanup_effect = yes + } if = { limit = { exists = var:travel_plan_start_date @@ -1803,6 +1889,17 @@ on_travel_plan_abort = { #Remove characters added by travel options at the start of travel plan remove_travel_option_added_character_effect = yes + + if = { + limit = { + has_character_modifier = prepare_travels_character_modifier + } + remove_character_modifier = prepare_travels_character_modifier + remove_variable = prepare_travels_modifier_value + } + } + on_actions = { + petition_head_of_faith_travel_planner_exit } } @@ -1815,6 +1912,19 @@ on_travel_plan_cancel = { limit = { has_variable = ep3_laamp_decision_1000_is_excavating } remove_variable = ep3_laamp_decision_1000_is_excavating } + #PAM - Holy Myron: the herb-gathering journey was called off; tell the sender and clean up + if = { + limit = { has_variable = pam_holy_myron_journey_tier } + var:pam_holy_myron_liege ?= { + send_interface_toast = { + type = event_toast_effect_bad + title = pam_holy_myron_journey_abandoned_toast + left_icon = root + remove_decision_cooldown = pam_prepare_holy_myron_decision + } + } + pam_holy_myron_journey_cleanup_effect = yes + } if = { limit = { has_character_flag = petition_liege_character_flag @@ -1947,6 +2057,9 @@ on_travel_plan_cancel = { requested_tribute_mission_penalty_effect = yes tribute_mission_clean_up_variables_effect = yes } + on_actions = { + petition_head_of_faith_travel_planner_exit + } } # If the travel is due to an activity and the activity is now complete, this will trigger. @@ -2015,17 +2128,8 @@ on_visited_ep3_monument = { } #Used in the debug interaction debug_move_domicile_interaction +# handled in ep3_contract_event.0002 on_travel_relocation_start = { - effect = { - every_courtier_or_guest = { #take everyone you have with you - limit = { - NOT = { exists = current_travel_plan } - } - root.current_travel_plan = { - add_companion = prev - } - } - } } #Used in the debug interaction debug_move_domicile_interaction @@ -2115,4 +2219,4 @@ zone_rouge_death_event = { 85 = 0 15 = NEOW_travel_event.0001 } -} \ No newline at end of file +} diff --git a/common/on_action/yearly_groups_on_actions.txt b/common/on_action/yearly_groups_on_actions.txt index 9752c733c..e1fad6694 100644 --- a/common/on_action/yearly_groups_on_actions.txt +++ b/common/on_action/yearly_groups_on_actions.txt @@ -423,3 +423,135 @@ fp3_yearly_events = { } } } + +pam_christian_yearly_events = { + trigger = { + pam_secular_faith_clergy_ok_actor_trigger = yes + OR = { + religion = religion:eastern_orthodox_religion + religion = religion:oriental_orthodox_religion + religion = religion:catholic_religion + religion = religion:protestant_religion + } + NOT = { has_character_flag = recently_got_pam_christian_event } + } + weight_multiplier = { + base = 1 + modifier = { + add = 2 + government_has_flag = government_is_theocracy + } + modifier = { + add = 1 + OR = { + has_focus = learning_scholarship_focus + has_focus = learning_theology_focus + has_trait = lifestyle_scholar + has_trait = lifestyle_mystic + } + } + modifier = { + factor = 0.5 + OR = { + has_trait = cynical + ai_zeal <= -50 + } + } + } + + random_events = { + 200 = 0 + + # PAM - Christian Rulers Events + 100 = pam_religious_artifact_events.0001 # Courtier asks for sponsoring for making a religious artifact + 100 = pam_theocratic_ruler_events.0001 # Theocratic ruler: ecclesiastical subordinate brings news of a noble bequest + 100 = pam_theocratic_ruler_events.0002 # Prince-bishop: neighbouring unreformed ruler passes through / visits court + 100 = pam_theocratic_ruler_events.0003 # Marshal/steward council after war or raids: alliance, levies, or relief + 100 = pam_theocratic_ruler_events.0004 # Monastic order in realm: collaboration audience with prior/abbot + 100 = pam_theocratic_ruler_events.0005 # Military holy order in realm: audience with order master + 100 = pam_theocratic_ruler_events.0006 # Peasant leader withholds church taxes: enforce, forgive, or scapegoat steward + 100 = pam_theocratic_ruler_events.0007 # Theocratic ruler: realm at peace; a moment of blissful harmony + 100 = pam_theocratic_ruler_events.0008 # Theocratic ruler: inherited secular stone; repurpose for episcopal palace + 100 = pam_theocratic_ruler_events.0009 # Theocratic ruler: heir loses temper during sermon; counsel or discipline + 100 = pam_theocratic_ruler_events.0010 # Theocratic ruler: proven warrior and pilgrim; marshal and chaplain counsel sword or crozier + 100 = pam_theocratic_ruler_events.0011 # Theocratic ruler: landed subject seeks church burial for fallen crusader kinsman + 100 = pam_theocratic_ruler_events.0013 # Theocratic ruler: angelic voice at mass; recruit for choir, seduce, or reject worldly song + 50 = pam_theocratic_ruler_events.0014 # Theocratic ruler: neighbouring convert urges adopting foreign core tenets at sermon + 50 = pam_theocratic_ruler_events.0015 # Theocratic ruler: prayer hearing with top two succession candidates + + # PAM Flavor Events + 50 = pam_generic_events.0001 # Gain Religious Scholar + 50 = pam_generic_events.0002 # Child doubts their goodness + 50 = pam_generic_events.0003 # Spouse worries about your sinful ways + 100 = pam_generic_events.0004 # Friend/chaplain comforts after family death + 100 = pam_generic_events.0005 # Excommunicated: loyal vassal offers to thrash clerical region holder + 20 = pam_generic_events.0008 # You hear the voice of god telling you how virtuous you are + 50 = pam_generic_events.0009 # Clergy member has a hellish nightmare + 50 = pam_generic_events.0011 # Scold a courtier for their sins + 100 = pam_secular_faith_events.0001 # Holy Smoke - a holy-day censing draws the ruler into the congregation's devotion + 100 = pam_secular_faith_events.0003 # A Vision in the Night - a vivid divine vision demands interpretation + 25 = pam_secular_faith_events.0004 # Forbidden Truth - temptation toward a secret, forbidden personal tenet + 100 = pam_secular_faith_events.0005 # By Candlelight - evening study reveals a foreign tenet or doctrine + 100 = pam_secular_faith_events.0006 # Bones of a Saint - a relic-seller offers dubious holy bones + 100 = pam_secular_faith_events.0007 # Arrogant Bishop - a proud theocrat vassal scorns his lord + 100 = pam_secular_faith_events.0008 # The Weight of Sin - a penance for the personality trait the rite holds sinful + 50 = pam_secular_faith_events.0009 # A Christlike Stranger - a beggar at the gate may be more than he seems + 100 = pam_secular_faith_events.0011 # The Penitents - a flagellant procession reaches the capital + 100 = pam_secular_faith_events.0012 # Blessing of Arms - a peacetime consecration of the ruler's arms + 100 = pam_secular_faith_events.0013 # A Death Foretold - a mad preacher foretells the natural death of an aged or ailing courtier; the prophecy comes due in a follow-up + 75 = pam_secular_faith_events.0015 # The Weeping Icon - a holy image is said to weep + 100 = pam_secular_faith_events.0016 # A Price for the Pulpit - a wanderer offers gold for the realm-priest office (simony) + 100 = pam_secular_faith_events.0017 # A Heretic at Court - a courtier is exposed as a heretic + 100 = pam_secular_faith_events.0018 # A Child for God - an offer to pledge a child to the Church (oblation) + 100 = pam_secular_faith_events.0019 # The Peace of God - end the feuds between your vassals in a holy peace + 100 = pam_secular_faith_events.0021 # A Sign in the Heavens - a portent appears in the night sky + 100 = pam_secular_faith_events.0022 # The King's Touch - a sick courtier begs the ruler's healing touch + 100 = pam_secular_faith_events.0023 # A Wandering Scribe - a lettered wanderer offers their services + 100 = pam_secular_faith_events.0024 # Into the Cloister - force a rival courtier to take holy vows + 100 = pam_secular_faith_events.0025 # Godfather/Godmother - sponsoring a convert's baptism + 100 = pam_secular_faith_events.0026 # A Besieged Soul - a courtier is tormented as if possessed; exorcise or treat them + 150 = pam_secular_faith_events.0027 # Crisis of Faith - low Spiritual Fulfillment; realign a personal tenet + 150 = pam_secular_faith_events.0028 # My Soul, at Peace - high Spiritual Fulfillment; spread or change personal tenets + 75 = pam_secular_faith_events.0029 # A Visit from the Dead - a dream of a departed family member + 75 = pam_secular_faith_events.0030 # The Anchorite - a devout courtier asks to be walled into a church cell + 100 = pam_secular_faith_events.0031 # An Argument of Scholars - two learned courtiers clash over doctrine + 100 = pam_secular_faith_events.0032 # The Tempting Hour - a fast tested in the night + 100 = pam_secular_faith_events.0033 # Pillow Sermons - a spouse who believes differently + 25 = pam_secular_faith_events.0034 # The Foundling - an abandoned child left at the church + 100 = pam_secular_faith_events.0035 # The Mortification - a courtier's holy self-destruction + 100 = pam_secular_faith_events.0036 # Wisdom of the Anchorite - a hermit's hard counsel + 50 = pam_secular_faith_events.0037 # Carnal Revelation - a glimpse of Carnal Exaltation + 50 = pam_secular_faith_events.0038 # A Taste of Paradise - a glimpse of Hedonism + 50 = pam_secular_faith_events.0039 # A Prayer in the Dark - the spymaster uncovers a secret at prayer (Sacred Shadows) + 50 = pam_secular_faith_events.0040 # Flesh of the Faithful - a glimpse of Ritual Cannibalism + 50 = pam_secular_faith_events.0041 # The Naked Truth - an Adamite preaches, and a secret temptation + 100 = pam_secular_faith_events.0042 # The Road Made Easy - a patron offers to fund the next pilgrimage + 100 = pam_secular_faith_events.0043 # A Pilgrim's Welcome - the realm priest pledges acclaim for the next completed pilgrimage + 100 = pam_secular_faith_events.0044 # The Ear of the Clergy - clerical petitions are more readily accepted for a time + 5 = pam_secular_faith_events.0045 # Epiphany - a temporary faith/rite creation cost discount + 100 = pam_secular_faith_events.0046 # Shared Conviction - adopting an intimate's personal tenet + 100 = pam_secular_faith_events.0047 # Priestly Devotion - a free loyalty hook on the realm priest + 25 = pam_secular_faith_events.0048 # Demonic Dreams - a tormenting dream, lifted by a temple or pilgrimage + 50 = pam_secular_faith_events.0049 # "Celestial Hierarchy" - a lustful priest's secret midnight rite + 50 = pam_secular_faith_events.0050 # Confession - lustful thoughts about the court chaplain; take a lover or resist + 5 = pam_secular_faith_events.0051 # The Lord your God - a mad ruler obeys a divine voice; a gamble of blessing, apoplexy, or death + 100 = pam_secular_faith_events.0052 # After You're Gone - an old ruler settles where they will lie + 50 = pam_secular_faith_events.0053 # The Saint Goes Forth - a held relic is borne in procession + 100 = pam_secular_faith_events.0054 # The Basin and the Towel - the ruler washes the feet of the poor + 100 = pam_secular_faith_events.0055 # The Voice of Bronze - a newly recast church bell is baptized + 100 = pam_secular_faith_events.0056 # A Sparrow in the Hall - Bede's sparrow flies through the evening meal + 100 = pam_secular_faith_events.0057 # The Church Ale - the parish brews to pay for the church roof + 100 = pam_secular_faith_events.0058 # Quid Mus Sumit? - a mouse has eaten of the reserved Host + 100 = pam_secular_faith_events.0059 # The Lord's Day - the chaplain bars the hunt on the day of rest + 1000 = pam_secular_faith_events.0060 # A Life Unburdened - a beggar is happier than you + } + + effect = { + root = { + add_character_flag = { + flag = recently_got_pam_christian_event + days = 1095 + } + } + } +} diff --git a/common/on_action/yearly_on_actions.txt b/common/on_action/yearly_on_actions.txt index 40e4d0d5e..bbf17f3dc 100644 --- a/common/on_action/yearly_on_actions.txt +++ b/common/on_action/yearly_on_actions.txt @@ -1261,6 +1261,7 @@ yearly_playable_pulse = { else = { } ai_budget_manipulation_effect = yes + hedonistic_obesity_modifier_sync_effect = yes #Mandala if = { @@ -1379,6 +1380,7 @@ yearly_playable_pulse = { has_treasury = yes } trigger_event = tgp_china_ministry.0100 + trigger_event = pam_theocratic_budget_events.0001 } } # Assign or level up court type trait for courtiers in a royal court @@ -1423,9 +1425,9 @@ yearly_playable_pulse = { save_scope_as = unity_target if = { limit = { - OR = { - has_character_flag = steer_unity_towards_harmonious_passive_gain - has_character_flag = steer_unity_towards_antagonistic_passive_loss + has_variable = { + name = steer_unity_towards_harmonious_passive_gain + name = steer_unity_towards_antagonistic_passive_loss } } house = { @@ -1537,7 +1539,7 @@ yearly_playable_pulse = { limit = { is_ai = yes } is_available = yes } - NOT = { has_government = celestial_government } + NOT = { government_has_flag = government_is_celestial } } random = { chance = { @@ -1624,7 +1626,25 @@ yearly_playable_pulse = { } } - if = { # Is Admin + if = { + limit = { + OR = { + NOT = { government_allows = noble_families } + AND = { + liege = this + any_held_title = { + count = all + is_noble_family_title = yes + } + } + } + } + every_held_title = { + limit = { is_noble_family_title = yes } + prev = { destroy_title = prev } + } + } + else_if = { # Is Admin limit = { government_has_flag = government_is_administrative is_landed = yes @@ -1796,7 +1816,11 @@ yearly_playable_pulse = { } every_courtier = { limit = { - location != root.capital_province + trigger_if = { + limit = { exists = location } + location != root.capital_province + } + trigger_else = { always = yes } is_imprisoned = no is_travelling = no is_commanding_army = no @@ -1814,7 +1838,11 @@ yearly_playable_pulse = { } every_courtier = { limit = { - location != root.domicile.domicile_location + trigger_if = { + limit = { exists = location } + location != root.domicile.domicile_location + } + trigger_else = { always = yes } is_imprisoned = no is_travelling = no is_commanding_army = no @@ -2169,53 +2197,51 @@ yearly_playable_pulse = { } #If you need to be anointed... + coronation_save_anointment_authority_effect = { SCOPE = anointment_authority } #First step is being un-excommunicated if = { limit = { highest_held_title_tier >= tier_empire has_trait = excommunicated - faith = { - has_doctrine = doctrine_spiritual_head - has_doctrine = doctrine_imperial_anointment - } + rite = { rite_has_doctrine = doctrine_imperial_anointment } + exists = scope:anointment_authority custom_tooltip = { text = anointment_request_already_supported - NOT = { - is_target_in_variable_list = { - name = supported_anointments - target = scope:actor + scope:anointment_authority = { + NOT = { + is_target_in_variable_list = { + name = supported_anointments + target = root + } } } } is_character_interaction_valid = { - recipient = faith.religious_head + recipient = scope:anointment_authority interaction = declaration_of_repentance_interaction } } run_interaction = { interaction = declaration_of_repentance_interaction actor = this - recipient = faith.religious_head + recipient = scope:anointment_authority execute_threshold = maybe } } #Next step is getting approval else_if = { limit = { - exists = faith.religious_head + exists = scope:anointment_authority is_character_interaction_valid = { - recipient = faith.religious_head + recipient = scope:anointment_authority interaction = coronation_anointment_request } - faith = { - has_doctrine = doctrine_spiritual_head - has_doctrine = doctrine_imperial_anointment - } + rite = { rite_has_doctrine = doctrine_imperial_anointment } } run_interaction = { interaction = coronation_anointment_request actor = this - recipient = faith.religious_head + recipient = scope:anointment_authority execute_threshold = maybe } } @@ -2251,6 +2277,8 @@ three_year_playable_pulse = { # 600 = global_culture.3012 # } effect = { + # Replace the monks a clerical court has lost, so it does not drift back to reading as secular + pam_seed_monk_courtiers_effect = yes if = { # Nomadic herd starves if you're landless limit = { is_landed = no @@ -2481,6 +2509,23 @@ three_year_playable_pulse = { five_year_playable_pulse = { effect = { ai_chance_to_become_conqueror_effect = yes + pam_ai_personal_tenet_pulse_effect = yes + ############### + # PAM Peace of God Tenet + ############### + if = { + limit = { + OR = { + rite = { rite_has_tenet = tenet_peace_of_god } + has_personal_tenet = tenet_peace_of_god + } + days_of_continuous_peace >= 1825 # 5 years + } + trigger_event = { + id = pam_tenet_events.0001 + days = { 21 37 } + } + } # Special Holy Seeds drops if = { limit = { @@ -2767,6 +2812,7 @@ random_yearly_playable_pulse = { } } 6 = on_yearly_events + 1 = pam_christian_yearly_events 5 = fp1_yearly_events 4 = fp2_yearly_events 4 = fp3_yearly_events @@ -2816,9 +2862,9 @@ random_yearly_playable_pulse = { limit = { is_ai = yes OR = { - has_commander_trait_trigger = yes + has_trait_with_flag = commander_trait_flag any_knight = { - has_commander_trait_trigger = yes + has_trait_with_flag = commander_trait_flag } } } @@ -2826,7 +2872,7 @@ random_yearly_playable_pulse = { every_knight = { limit = { is_ai = yes - has_commander_trait_trigger = yes + has_trait_with_flag = commander_trait_flag } commander_trait_lvling_ai_effect = yes } @@ -2916,7 +2962,7 @@ random_yearly_everyone_pulse = { } random_events = { 500 = 0 - 100 = holy_order.0202 #Holy order demands payment + 100 = holy_order.0202 #Military Order demands payment } } @@ -3036,6 +3082,27 @@ five_year_everyone_pulse = { } trigger_event = ep3_yearly.3000 } + if = { + limit = { + NOT = { + exists = puppeteer + } + OR = { + has_character_modifier = skilled_puppeteer_modifier_diplomacy + has_character_modifier = skilled_puppeteer_modifier_martial + has_character_modifier = skilled_puppeteer_modifier_stewardship + has_character_modifier = skilled_puppeteer_modifier_intrigue + has_character_modifier = skilled_puppeteer_modifier_learning + has_character_modifier = skilled_puppeteer_modifier_general + has_character_modifier = spiritual_puppeteer_modifier_cleric + has_character_modifier = spiritual_puppeteer_modifier_secular + has_character_modifier = dreadful_puppeteer_modifier + has_character_modifier = beloved_puppeteer_modifier + has_character_modifier = deranging_puppeteer_modifier + } + } + remove_puppet_modifiers_effect = yes + } } on_actions = { disease_outbreak_pulse # moved from health_on_actions.txt @@ -3101,7 +3168,7 @@ ai_character_pulse = { chance_to_happen = 25 500 = 0 100 = learn_commander_trait.0001 - 100 = holy_order.0100 #Give pilgrim trait to holy order members + 100 = holy_order.0100 #Give pilgrim trait to Military Order members } } @@ -3273,10 +3340,10 @@ on_yearly_events = { 20 = pet_animal.5001 # Rival has cat... 20 = pet_animal.5002 # Rival has dog... - #Holy Order - 100 = holy_order.2001 # Child wishes to join Holy Order - 100 = holy_order.2002 # Sibling wants to join a Holy Order - 200 = holy_order.2003 # Holy Order suggests you send them a child + #Military Order + 100 = holy_order.2001 # Child wishes to join Military Order + 100 = holy_order.2002 # Sibling wants to join a Military Order + 200 = holy_order.2003 # Military Order suggests you send them a child 1000 = holy_order.2004 # Child returns to pick up the mantle 100 = holy_order.2005 # A - Possibly Undesirable - Child Returns Home 1000 = fp1_jomsvikings.0011 # FP1 - Jomsvikings terrorise their neighbours