N3OW/common/scripted_effects/00_administrative_effects.txt
2026-11-03 16:04:32 +00:00

577 lines
14 KiB
Text

change_to_administrative_hereditary_effect = {
scope:recipient = {
save_scope_as = petition_vassal
every_held_title = {
limit = {
tier = scope:petition_vassal.highest_held_title_tier
is_landless_type_title = no
is_noble_family_title = no
}
custom_tooltip = {
text = petition_liege_house_governorship_rights_tt
set_variable = {
name = petition_house_rights
value = scope:petition_vassal.house
years = 100
}
}
}
}
}
change_to_administrative_holding_effect = {
# Structured like this for clean tooltips
capital_province = {
if = {
limit = { holding_is_tribal = yes }
county.holder = { custom_tooltip = change_to_administrative_holding_tt }
hidden_effect = {
holding_pre_feudalize_effect = yes
set_holding_type = castle_holding
}
}
county = {
if = {
limit = { has_county_modifier = mpo_siberian_permafrost_modifier }
holder = { custom_tooltip = change_to_administrative_permafrost_tt }
}
else_if = {
limit = { has_county_modifier = mpo_siberian_permafrost_modifier_bad }
holder = { custom_tooltip = change_to_administrative_permafrost_bad_tt }
}
}
}
}
change_to_administrative_effect = {
if = {
limit = {
exists = scope:new_liege
trigger_if = {
limit = {
independent = no
}
NOR = {
has_character_flag = granted_title_government_cooldown
prestige_level > 2
piety_level > 2
AND = {
dynasty ?= {
dynasty_prestige_level > 2
}
}
}
}
}
scope:new_liege = { save_scope_as = governor_liege }
}
else = {
top_liege = { save_scope_as = governor_liege }
}
# exactly 0 treasury, i.e. newly get this feature
if = {
limit = {
OR = {
has_treasury = no
treasury = 0
}
trigger_if = {
limit = {
independent = no
}
NOR = {
has_character_flag = granted_title_government_cooldown
prestige_level > 2
piety_level > 2
AND = {
dynasty ?= {
dynasty_prestige_level > 2
}
}
}
}
}
save_scope_as = new_treasury
}
# Set the correct government
if = {
limit = {
OR = {
NOT = { government_has_mechanic = administrative }
AND = {
scope:governor_liege = { government_has_mechanic = administrative }
government_type != scope:governor_liege.government_type
}
}
trigger_if = {
limit = {
independent = no
}
NOR = {
has_character_flag = granted_title_government_cooldown
prestige_level > 2
piety_level > 2
AND = {
dynasty ?= {
dynasty_prestige_level > 2
}
}
}
}
}
# Only case where Estate type is shared between Admin and non-Admin
if = {
limit = {
NAND = {
government_has_flag = government_is_japan_feudal
scope:governor_liege = { government_has_flag = government_is_japan_administrative }
}
}
save_scope_as = new_admin
}
# If we are greek, let's ensure we become administrative
if = {
limit = {
NOT = { exists = scope:has_selected_a_government }
scope:governor_liege = {
this = scope:governor # not vassal of some other admin liege
culture = {
OR = {
this = culture:greek
any_parent_culture_or_above = { this = culture:greek }
}
}
}
}
save_scope_value_as = {
name = has_selected_a_government
value = flag:administrative
}
}
# Change government
# We first check if you have a selected government, then if you are independent, then what your liege has
if = { # Ritsuryo
limit = {
trigger_if = {
limit = {
exists = scope:has_selected_a_government
}
scope:has_selected_a_government = flag:japan_administrative
}
trigger_else_if = {
limit = {
top_liege = this
}
has_tgp_dlc_trigger = yes
tgp_can_become_japan_administrative_trigger = yes
}
trigger_else = {
scope:governor_liege = { government_has_flag = government_is_japan_administrative }
}
}
change_to_administrative_holding_effect = yes
tgp_domicile_conversion_when_changing_government_type = {
NEW_DOMICILE_TYPE = japanese_manor
NEW_GOVERNMENT_TYPE = japan_administrative_government
}
change_government = japan_administrative_government
}
else_if = { # Celestial
limit = {
trigger_if = {
limit = {
exists = scope:has_selected_a_government
}
scope:has_selected_a_government = flag:celestial
}
trigger_else_if = {
limit = {
scope:governor_liege ?= this
}
has_tgp_dlc_trigger = yes
OR = {
tgp_can_become_celestial_trigger = yes
#This is Mongol breakup and they are hegemon
AND = {
exists = scope:great_yuan_ruler
this = scope:great_yuan_ruler
primary_title = title:h_china
}
}
}
trigger_else = {
scope:governor_liege = { government_has_flag = government_is_celestial }
}
}
change_to_administrative_holding_effect = yes
tgp_domicile_conversion_when_changing_government_type = {
NEW_DOMICILE_TYPE = east_asian_estate
NEW_GOVERNMENT_TYPE = celestial_government
}
change_government = celestial_government
}
else_if = { # Meritocratic Khanate
limit = {
trigger_if = {
limit = {
exists = scope:has_selected_a_government
}
# There's a separate decision to go from Nomad to Meritocratic Khanate, so you cannot pick it from here
always = no
}
trigger_else = {
scope:governor_liege = { government_has_flag = government_is_steppe_admin }
}
}
change_to_administrative_holding_effect = yes
tgp_domicile_conversion_when_changing_government_type = {
NEW_DOMICILE_TYPE = east_asian_estate
NEW_GOVERNMENT_TYPE = steppe_admin_government
}
change_government = steppe_admin_government
}
else_if = { # Meritocratic
limit = {
trigger_if = {
limit = {
exists = scope:has_selected_a_government
}
scope:has_selected_a_government = flag:meritocratic
}
trigger_else_if = {
limit = {
scope:governor_liege ?= this
}
has_tgp_dlc_trigger = yes
tgp_should_become_meritocratic_trigger = yes
}
trigger_else = {
scope:governor_liege = { government_has_flag = government_is_meritocratic }
}
}
change_to_administrative_holding_effect = yes
tgp_domicile_conversion_when_changing_government_type = {
NEW_DOMICILE_TYPE = east_asian_estate
NEW_GOVERNMENT_TYPE = meritocratic_government
}
change_government = meritocratic_government
}
else = { # Administrative
add_character_flag = new_government_is_byz_admin
change_to_administrative_holding_effect = yes
tgp_domicile_conversion_when_changing_government_type = {
NEW_DOMICILE_TYPE = estate
NEW_GOVERNMENT_TYPE = administrative_government
}
change_government = administrative_government
remove_character_flag = new_government_is_byz_admin
}
}
# Set up a noble family title
if = {
limit = {
primary_title.tier >= min_appointment_tier
liege = {
scope:governor_liege = this
government_allows = noble_families
}
house.house_head = {
top_liege = scope:governor_liege
NOT = {
any_held_title = { is_noble_family_title = yes }
}
}
}
create_noble_family_effect = { GOVERNMENT_GIVER = top_liege }
}
# Add the governor trait if applicable
hidden_effect = {
if = {
limit = {
is_governor = yes
NOT = { has_trait = governor }
}
add_trait = governor
}
}
# Set up the domicile
if = {
limit = {
exists = scope:new_admin
exists = domicile
}
domicile ?= {
set_up_domicile_estate_effect = yes
}
}
if = {
limit = {
has_treasury = yes
exists = scope:new_treasury # do not give it mutiple times
}
add_treasury = {
value = gold
min = 100
}
}
}
change_to_administrative_interaction_effect = {
scope:actor = {
if = {
limit = { has_treasury = yes }
pay_short_term_treasury = {
target = scope:recipient
treasury = {
value = 50
scope:recipient = {
if = {
limit = { highest_held_title_tier >= tier_kingdom }
multiply = 10
}
else_if = {
limit = { highest_held_title_tier >= tier_duchy }
multiply = 6
}
else_if = {
limit = { highest_held_title_tier >= tier_county }
multiply = 3
}
}
if = {
limit = { scope:gold ?= yes }
add = scope:actor.medium_gold_value
}
if = {
limit = {
scope:actor = { has_realm_law_flag = admin_change_vassal_gov_cheaper }
}
multiply = 0.5
}
}
}
}
else = {
pay_short_term_gold = {
target = scope:recipient
gold = {
value = 50
scope:recipient = {
if = {
limit = { highest_held_title_tier >= tier_kingdom }
multiply = 10
}
else_if = {
limit = { highest_held_title_tier >= tier_duchy }
multiply = 6
}
else_if = {
limit = { highest_held_title_tier >= tier_county }
multiply = 3
}
}
if = {
limit = { scope:gold ?= yes }
add = scope:actor.medium_gold_value
}
if = {
limit = {
scope:actor = { has_realm_law_flag = admin_change_vassal_gov_cheaper }
}
multiply = 0.5
}
}
}
}
}
scope:recipient = {
change_to_administrative_effect = yes
#And now we also convert all the administrative vassals below so they also match the actor's form of admin.
#For non admin sub-vassals the newly converted main vassal can still ask using the same interaction but we
hidden_effect = {
every_vassal_or_below = {
limit = {
government_has_mechanic = administrative
is_ai = yes #Humans get to be asked directly
}
change_to_administrative_effect = yes
}
}
}
if = {
limit = {
scope:hook = yes
scope:actor = { has_usable_hook = scope:recipient }
}
scope:actor = { use_hook = scope:recipient }
}
if = {
limit = { scope:hereditary = yes }
scope:recipient = { save_scope_as = petition_vassal }
change_to_administrative_hereditary_effect = yes
}
if = {
limit = { scope:influence = yes }
scope:actor = {
change_influence = {
value = massive_influence_loss
}
}
}
}
give_new_noble_family_title_effect = {
if = {
limit = {
is_house_head = yes
government_allows = noble_families
trigger_if = {
limit = {
government_has_flag = government_has_county_tier_noble_families
}
highest_held_title_tier >= tier_county
}
trigger_else = { highest_held_title_tier >= tier_duchy }
liege = {
government_allows = noble_families
}
trigger_if = {
limit = { any_held_title = { is_noble_family_title = yes } }
has_domicile = no
}
}
create_noble_family_effect = { GOVERNMENT_GIVER = this }
domicile ?= { set_up_domicile_estate_effect = yes }
}
}
set_up_domicile_estate_effect = {
if = {
limit = { is_domicile_type = estate }
# Intentionally one level lower than what you can get
if = {
limit = {
NOT = { has_domicile_building_or_higher = estate_main_02 }
owner.culture ?= { has_innovation = innovation_city_planning }
}
add_domicile_building = estate_main_02
}
if = {
limit = {
has_domicile_building = estate_main_02
NOT = { has_domicile_building_or_higher = estate_main_03 }
owner.culture ?= { has_innovation = innovation_manorialism }
}
add_domicile_building = estate_main_03
}
hidden_effect = {
switch = {
trigger = has_domicile_building
estate_main_03 = {
while = {
count = 2
add_random_internal_estate_building = yes
}
}
estate_main_02 = {
add_random_internal_estate_building = yes
}
}
}
fill_external_estate_building_effect = yes
}
else_if = {
limit = { is_domicile_type = japanese_manor }
# Intentionally one level lower than what you can get
if = {
limit = {
NOT = { has_domicile_building_or_higher = japanese_manor_main_02 }
owner.culture ?= { has_innovation = innovation_city_planning }
}
add_domicile_building = japanese_manor_main_02
}
if = {
limit = {
has_domicile_building = japanese_manor_main_02
NOT = { has_domicile_building_or_higher = japanese_manor_main_03 }
owner.culture ?= { has_innovation = innovation_manorialism }
}
add_domicile_building = japanese_manor_main_03
}
hidden_effect = {
switch = {
trigger = has_domicile_building
japanese_manor_main_03 = {
while = {
count = 2
add_random_internal_japanese_manor_building = yes
}
}
japanese_manor_main_02 = {
add_random_internal_japanese_manor_building = yes
}
}
}
fill_external_japanese_manor_building_effect = yes
}
else_if = {
limit = { is_domicile_type = east_asian_estate }
# Intentionally one level lower than what you can get
if = {
limit = {
NOT = { has_domicile_building_or_higher = east_asian_estate_main_02 }
owner.culture ?= { has_innovation = innovation_city_planning }
}
add_domicile_building = east_asian_estate_main_02
}
if = {
limit = {
has_domicile_building = east_asian_estate_main_02
NOT = { has_domicile_building_or_higher = east_asian_estate_main_03 }
owner.culture ?= { has_innovation = innovation_manorialism }
}
add_domicile_building = east_asian_estate_main_03
}
hidden_effect = {
switch = {
trigger = has_domicile_building
east_asian_estate_main_03 = {
while = {
count = 2
add_random_internal_east_asian_estate_building = yes
}
}
east_asian_estate_main_02 = {
add_random_internal_east_asian_estate_building = yes
}
}
}
fill_external_east_asian_estate_building_effect = yes
}
}
noble_family_title_realm_setup_effect = {
save_scope_as = top_liege
every_noble_family = {
save_scope_as = nf_title
holder ?= {
save_scope_as = nf_holder
house ?= {
save_scope_as = nf_house
# Ensure holders of historical noble family titles are the default house heads
if = {
limit = { house_head != scope:nf_holder }
set_house_head = scope:nf_holder
}
}
}
scope:nf_title = {
set_color_from_title = scope:nf_holder.capital_county
# Ensure Noble Family CoA match House
set_coa = scope:nf_house
}
}
}