scripted effects fixed somewhat

This commit is contained in:
trashmasteruni 2026-10-10 19:37:00 +02:00
parent 5cf05a176b
commit 227466a9e9
14 changed files with 2057 additions and 37875 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,672 +0,0 @@
steal_artifact_in_siege_effect = {
if = {
limit = { NOT = { has_variable = artifact_prevent_transfer } }
# Save scopes for localization
$LOCATION$ = { save_scope_as = SAISE_location }
$ATTACKER$ = { save_scope_as = SAISE_attacker }
$DEFENDER$ = { save_scope_as = SAISE_defender }
$ARTIFACT$ = { save_scope_as = this_artifact }
scope:this_artifact = {
# Suppress generic notifications, as we will send custom ones
set_variable = {
name = suppress_artifact_notifications
value = yes
days = 1
}
if = {
limit = {
NOT = { has_variable = stolen_artifact }
}
set_variable = {
name = stolen_artifact
value = 1
}
}
else = {
change_variable = {
name = stolen_artifact
add = 1
}
}
# Transfer the artifact to its new owner
if = {
limit = {
has_variable = ai_to_ai_destroy_in_sieges
scope:SAISE_attacker = {
is_ai = yes
}
scope:SAISE_defender = {
is_ai = yes
}
}
destroy_artifact = this
}
else = {
set_owner = {
target = scope:SAISE_attacker
history = {
location = scope:SAISE_location
actor = scope:SAISE_defender
recipient = scope:SAISE_attacker
type = taken_in_siege
}
}
scope:SAISE_defender = { add_personal_artifact_claim = scope:this_artifact }
if = {
limit = {
scope:SAISE_attacker = {
has_ep3_dlc_trigger = yes
is_roman_emperor_trigger = yes
culture = { has_cultural_parameter = holds_triumphs }
}
}
scope:SAISE_attacker = {
set_variable = {
name = byz_valid_for_trophy
value = scope:this_artifact
years = 9
}
}
}
# Send notifications to the relevant parties
scope:SAISE_defender = {
send_interface_toast = {
type = msg_artifact_lost
title = artifact_lost_toast
left_icon = scope:this_artifact
right_icon = scope:SAISE_attacker
if = {
limit = { $IS_RAID$ = yes }
custom_tooltip = artifact_lost_in_raid
}
else = {
custom_tooltip = artifact_lost_in_siege
}
}
}
scope:SAISE_attacker = {
send_interface_toast = {
type = msg_artifact_gained
right_icon = scope:this_artifact
}
if = {
limit = {
NOT = { any_claimed_artifact = { this = scope:this_artifact } }
}
scope:this_artifact = {
set_variable = {
name = last_person_to_steal
value = scope:SAISE_attacker
}
}
}
}
}
}
}
}
steal_artifact_in_event_effect = {
if = {
limit = { exists = $VICTIM$.capital_province }
set_local_variable = {
name = location
value = $VICTIM$.capital_province
}
}
else_if = {
limit = { exists = $VICTIM$.location }
set_local_variable = {
name = location
value = $VICTIM$.location
}
}
$ARTIFACT$ = {
save_scope_as = artifact_to_steal
hidden_effect = {
if = {
limit = {
exists = local_var:location
}
set_owner = {
target = $THIEF$
history = {
type = stolen
actor = $VICTIM$ #stolen from
recipient = $THIEF$ #stealer
location = local_var:location
}
}
}
else = { #If no location exists it is "conquered"
set_owner = {
target = $THIEF$
history = {
type = conquest
actor = $THIEF$ #stealer
recipient = $VICTIM$ #stolen from
}
}
}
if = {
limit = {
NOT = { has_variable = stolen_artifact }
}
set_variable = {
name = stolen_artifact
value = 1
}
}
else = {
change_variable = {
name = stolen_artifact
add = 1
}
}
}
}
$VICTIM$ = {
add_personal_artifact_claim = scope:artifact_to_steal
}
}
damage_artifact_in_battle_effect = {
# Save scopes for localization
$OWNER$ = {
save_scope_as = DAIBE_owner
}
$OPPONENT$ = { save_scope_as = DAIBE_opponent }
$LOCATION$ = { save_scope_as = DAIBE_location }
$ARTIFACT$ = {
save_scope_as = DAIBE_artifact
# Suppress generic notifications, as we will send custom ones
set_variable = {
name = suppress_artifact_notifications
value = yes
days = 1
}
set_variable = {
name = DAIBE_damage
value = $DURABILITY_LOSS$
days = 1
}
# Damage the artifact by the specified amount
add_durability = {
value = 0
subtract = var:DAIBE_damage
}
}
# Transformed into an if / else as I found the following note somewhere else:
# NOTE: We must not run ANY script after we destroy an artifact, or we will cause errors
if = {
# If the artifact has no durability left, destroy it now.
limit = { scope:DAIBE_artifact.artifact_durability <= 0 }
destroy_artifact = scope:DAIBE_artifact
}
# Send notifications to the relevant party IF the artifact was not destroyed
else = {
$OWNER$ = {
# Send the toast
send_interface_toast = {
title = artifact_damaged_toast
left_icon = scope:DAIBE_artifact
right_icon = scope:DAIBE_opponent
if = {
limit = {
$IS_DUEL$ = yes
}
custom_tooltip = artifact_damaged_in_duel
}
else = {
custom_tooltip = artifact_damaged_in_siege
}
}
}
}
}
flag_as_trash_artifact = {
set_variable = {
name = ai_to_ai_destroy_in_sieges
value = yes
}
}
flag_as_unwanted_artifact = {
set_variable = {
name = unwanted_artifact
value = yes
}
}
flag_as_cursed_artifact = {
set_variable = {
name = cursed_artifact
value = yes
}
}
#For use with trinket looks / call this effect (set_up_trinket_adjective_effect = yes) in the line before creating the trinket
#Use this in the trinket's name/description in the loc-file [ROOT.Char.Custom('TrinketLookAdjective')] /and/ [ROOT.Char.Custom('TrinketLookAdverbFollowup')]
#Remember to clear the var:trinket_adjective_followup in your after = { ... }
set_up_trinket_adjective_effect = {
random_list = {
50 = {
set_variable = {
name = trinket_adjective_followup
value = flag:adorned
}
}
50 = {
set_variable = {
name = trinket_adjective_followup
value = flag:decorated
}
}
50 = {
set_variable = {
name = trinket_adjective_followup
value = flag:embellished
}
}
50 = {
set_variable = {
name = trinket_adjective_followup
value = flag:ornamented
}
}
}
}
# Grant claims on familial banners
grant_banner_house_claim_effect = {
save_scope_as = familial_banner
hidden_effect = {
if = { # Dynasty banner not owned or claimed by all child house's already
limit = {
exists = var:banner_dynasty
var:banner_dynasty = {
any_dynasty_member = {
this = house.house_head
house = { artifact_house_not_owns_or_claims_trigger = yes } # House not owns or claims already
}
}
}
var:banner_dynasty = {
every_dynasty_member = {
limit = {
this = house.house_head
house = { artifact_house_not_owns_or_claims_trigger = yes } # House not owns or claims already
}
house = { add_house_artifact_claim = scope:familial_banner }
}
}
}
else_if = { # House banner not owned or claimed by creating house already
limit = {
exists = var:banner_house
var:banner_house = { artifact_house_not_owns_or_claims_trigger = yes } # House not owns or claims already
}
var:banner_house = { add_house_artifact_claim = scope:familial_banner }
}
}
}
#Determine what type of artifact a court artifact is, for defacement
determine_artifact_damage_type_effect = {
$ARTIFACT$ = { save_scope_as = artifact_to_determine }
scope:artifact_to_determine = {
random_list = {
10 = {
trigger = {
OR = {
artifact_type = chest
artifact_type = box
artifact_type = cabinet
artifact_type = pedestal
artifact_type = tapestry
artifact_type = animal_hide
artifact_type = animal_hide_big
artifact_type = wall_big
artifact_type = wall_shield
artifact_type = throne
artifact_type = throne_special
artifact_type = book
}
}
set_variable = artifact_burned
}
10 = {
trigger = {
OR = {
artifact_type = sculpture
artifact_type = box
artifact_type = goblet
artifact_type = pedestal
artifact_type = book
artifact_type = elixir
artifact_type = panacea
artifact_type = philosophers_stone
}
}
set_variable = artifact_knocked_over
}
10 = {
trigger = {
OR = {
artifact_type = sculpture
artifact_type = chest
artifact_type = box
artifact_type = cabinet
artifact_type = goblet
artifact_type = pedestal
artifact_type = tapestry #cloth
artifact_type = animal_skull
artifact_type = animal_hide
artifact_type = animal_hide_big
artifact_type = wall_big #shields, banners
artifact_type = wall_small #animal trophy
artifact_type = wall_shield
artifact_type = wall_shield_special #kite shields
artifact_type = throne
artifact_type = throne_special
artifact_type = book
artifact_type = elixir
artifact_type = panacea
artifact_type = philosophers_stone #box
}
}
set_variable = artifact_smeared_food
}
10 = {
trigger = {
OR = {
artifact_type = chest
artifact_type = box
artifact_type = cabinet
artifact_type = pedestal
artifact_type = tapestry
artifact_type = animal_hide
artifact_type = animal_hide_big
artifact_type = wall_big
artifact_type = wall_small
artifact_type = throne
artifact_type = throne_special
artifact_type = book
}
}
set_variable = artifact_spilled_drink
}
10 = {
trigger = {
OR = {
artifact_type = tapestry
artifact_type = animal_hide
artifact_type = animal_hide_big
artifact_type = book
}
}
set_variable = artifact_tear
}
10 = {
trigger = {
OR = {
artifact_type = tapestry
artifact_type = animal_skull
artifact_type = animal_hide
artifact_type = animal_hide_big
artifact_type = wall_big
artifact_type = wall_small
artifact_type = wall_shield
artifact_type = wall_shield_special
}
}
set_variable = artifact_tear_down
}
10 = {
trigger = {
OR = {
artifact_type = chest
artifact_type = box
artifact_type = pedestal
artifact_type = tapestry
artifact_type = animal_hide
artifact_type = animal_hide_big
artifact_type = wall_big
artifact_type = wall_small
artifact_type = wall_shield
artifact_type = wall_shield_special
artifact_type = throne
artifact_type = throne_special
artifact_type = book
}
}
set_variable = artifact_threw_up
}
10 = {
trigger = {
OR = {
artifact_type = sculpture
artifact_type = chest
artifact_type = box
artifact_type = cabinet
artifact_type = goblet
artifact_type = pedestal
artifact_type = tapestry #cloth
artifact_type = animal_skull
artifact_type = animal_hide
artifact_type = animal_hide_big
artifact_type = wall_big #shields, banners
artifact_type = wall_small #animal trophy
artifact_type = wall_shield
artifact_type = wall_shield_special #kite shields
artifact_type = throne
artifact_type = throne_special
artifact_type = book
artifact_type = elixir
artifact_type = panacea
artifact_type = philosophers_stone #box
}
}
set_variable = artifact_unspeakable
}
10 = {
trigger = {
NOR = {
artifact_type = sculpture
artifact_type = chest
artifact_type = box
artifact_type = cabinet
artifact_type = goblet
artifact_type = pedestal
artifact_type = tapestry #cloth
artifact_type = animal_skull
artifact_type = animal_hide
artifact_type = animal_hide_big
artifact_type = wall_big #shields, banners
artifact_type = wall_small #animal trophy
artifact_type = wall_shield
artifact_type = wall_shield_special #kite shields
artifact_type = throne
artifact_type = throne_special
artifact_type = book
artifact_type = elixir
artifact_type = panacea
artifact_type = philosophers_stone #box
}
}
set_variable = artifact_damage_fallback
}
}
}
}
# Destroy Artifact effect
# DESTROYER = Character destroying the artifact
# ARTIFACT = The artifact to destroy
destroy_artifact_aniconist_effect = {
$ARTIFACT$ = {
save_temporary_scope_as = artifact
}
$DESTROYER$ = {
if = {
limit = {
OR = {
$DESTROYER$.faith = { has_doctrine_parameter = destroying_artifacts_is_pious }
$PIETY_BY_DEFAULT$ = yes
}
}
give_destroyed_artifact_piety = yes
}
if = {
limit = {
OR = {
$DESTROYER$.faith = { has_doctrine_parameter = destroying_artifacts_costs_piety }
$PIETY_BY_DEFAULT$ = yes
}
}
add_piety = medium_piety_loss
}
if = {
limit = {
$GIVE_GOLD$ = yes
}
add_gold = {
if = {
limit = {
scope:artifact = { rarity = illustrious }
}
add = {
value = 25
}
}
else_if = {
limit = {
scope:artifact = { rarity = famed }
}
add = {
value = 15
}
}
else_if = {
limit = {
scope:artifact = { rarity = masterwork }
}
add = {
value = 8
}
}
else = {
add = {
value = 4
}
}
# Boost the value up to something meaningful
multiply = {
value = 10
}
# multiply by durability percentage
multiply = {
add = scope:artifact.artifact_durability
divide = scope:artifact.artifact_max_durability
divide = 2
add = 0.5
}
#Nerf it to bits for LAAMPs
if = {
limit = {
$DESTROYER$ = { has_government = landless_adventurer_government }
}
multiply = {
value = 0.1
round = yes
}
}
if = {
limit = {
exists = scope:artifact.var:ai_to_ai_destroy_in_sieges # Trash artifact
}
max = {
value = $DESTROYER$.tiny_gold_value
multiply = 0.5
}
}
min = 1
}
}
destroy_owned_artifact = scope:artifact
}
}
give_destroyed_artifact_piety = {
add_piety = {
# Base value
value = 5
# Add the artifact's quality
if = {
limit = { exists = scope:artifact.var:quality }
add = scope:artifact.var:quality
}
# If none can be found, add its wealth
else_if = {
limit = { exists = scope:artifact.var:wealth }
add = scope:artifact.var:wealth
}
# Artifact has no quality or wealth (typical for court artifacts), add something based on rarity
else_if = {
limit = {
scope:artifact = { rarity = illustrious }
}
add = {
value = 20
}
}
else_if = {
limit = {
scope:artifact = { rarity = famed }
}
add = {
value = 12
}
}
else_if = {
limit = {
scope:artifact = { rarity = masterwork }
}
add = {
value = 8
}
}
else = {
add = {
value = 4
}
}
# Boost the value up to something meaningful
multiply = 20
# Relics are way cooler to burn, double the final value
if = {
limit = {
scope:artifact = { exists = var:relic }
}
multiply = {
value = 2
desc = aniconist_destroying_relic
}
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -105,7 +105,7 @@ assign_random_nickname_effect = {
NOT = {
any_realm_county = {
culture = scope:nickname_root_scope.culture
}
}
}
NOT = {
primary_title ?= {
@ -123,7 +123,7 @@ assign_random_nickname_effect = {
culture = {
cultural_acceptance = { target = scope:nickname_root_scope.culture value >= 40 }
}
}
}
}
factor = 2
}
@ -526,7 +526,7 @@ assign_random_nickname_effect = {
100 = {
trigger = {
has_trait = witch
NOT = { faith = { has_doctrine = doctrine_witchcraft_accepted } }
NOT = { rite = { rite_has_parameter = witchcraft_accepted } }
NOT = { exists = scope:had_nick_the_witch }
}
modifier = {
@ -659,7 +659,7 @@ assign_random_nickname_effect = {
has_trait = gluttonous
}
has_personality_introverted_trigger = no
faith = faith:^
faith = faith:norse_pagan
NOT = { exists = scope:had_nick_foul_fart }
}
modifier = {
@ -1401,7 +1401,7 @@ assign_random_nickname_effect = {
has_trait = intellect_good
has_trait = shrewd
has_trait = theologian
has_trait = scholar
has_trait = erudite
learning >= 16
}
has_personality_introverted_trigger = yes
@ -1571,7 +1571,7 @@ assign_random_nickname_effect = {
top_liege != this
NOR = {
religion = liege.religion
faith = { has_doctrine = doctrine_pluralism_pluralistic }
rite = { rite_has_doctrine = doctrine_pluralism_pluralistic }
}
NOT = { exists = scope:had_nick_the_heathen }
}
@ -1761,7 +1761,7 @@ assign_random_nickname_effect = {
100 = {
trigger = {
is_male = yes
faith = { has_doctrine = doctrine_theocracy_temporal }
rite = { rite_has_doctrine = doctrine_theocracy_temporal }
has_personality_levelheaded_trigger = yes
has_personality_introverted_trigger = yes
has_personality_submissive_trigger = yes
@ -2920,11 +2920,11 @@ assign_random_nickname_effect = {
learning >= 16
OR = {
has_trait = lifestyle_mystic
has_trait = scholar
has_trait = erudite
has_trait = theologian
}
NOR = {
exists = scope:had_nick_the_bearded
NOR = {
exists = scope:had_nick_the_bearded
has_trait = beardless_eunuch
}
}
@ -2993,7 +2993,7 @@ assign_random_nickname_effect = {
100 = {
trigger = {
is_female = yes
faith = { has_doctrine = doctrine_theocracy_temporal }
rite = { rite_has_doctrine = doctrine_theocracy_temporal }
has_personality_levelheaded_trigger = yes
has_personality_introverted_trigger = yes
has_personality_submissive_trigger = yes
@ -4153,15 +4153,15 @@ assign_random_nickname_effect = {
learning <= 6
}
AND = {
government_allows = administrative
government_has_mechanic = administrative
governor_efficiency <= 0.7
}
prestige_level <= 2
}
}
NOT = { exists = scope:had_nick_the_incompetent }
}
modifier = {
government_allows = administrative
government_has_mechanic = administrative
governor_efficiency <= 0.6
factor = 2
}
@ -4327,7 +4327,7 @@ set_random_negative_nickname_effect = {
NOT = {
any_realm_county = {
culture = scope:nick_recipient.culture
}
}
}
NOT = {
primary_title ?= {
@ -4343,7 +4343,7 @@ set_random_negative_nickname_effect = {
culture = {
cultural_acceptance = { target = scope:nick_recipient.culture value >= 40 }
}
}
}
}
factor = 2
}
@ -4544,7 +4544,7 @@ set_random_negative_nickname_effect = {
100 = {
trigger = {
has_trait = witch
NOT = { faith = { has_doctrine = doctrine_witchcraft_accepted } }
NOT = { rite = { rite_has_parameter = witchcraft_accepted } }
}
modifier = {
piety_level <= 1
@ -4579,7 +4579,7 @@ set_random_negative_nickname_effect = {
100 = {
trigger = {
has_trait = drunkard
faith.religion = religion:folk_germanic_religion
faith = faith:norse_pagan
}
modifier = {
prestige_level <= 1
@ -5072,7 +5072,7 @@ set_random_negative_nickname_effect = {
top_liege != this
NOR = {
religion = liege.religion
faith = { has_doctrine = doctrine_pluralism_pluralistic }
rite = { rite_has_doctrine = doctrine_pluralism_pluralistic }
}
}
set_nickname_effect = {
@ -6338,13 +6338,13 @@ set_random_negative_nickname_effect = {
learning <= 6
}
AND = {
government_allows = administrative
government_has_mechanic = administrative
governor_efficiency <= 0.7
}
}
}
}
modifier = {
government_allows = administrative
government_has_mechanic = administrative
governor_efficiency <= 0.6
factor = 2
}
@ -6397,6 +6397,31 @@ set_random_negative_nickname_effect = {
NICKNAME = nick_the_miser
}
}
100 = {
trigger = {
religion = { is_in_family = rf_abrahamic }
piety_level >= 4
num_sinful_traits <= 0
num_virtuous_traits >= 1
NOT = { exists = scope:had_nick_the_angelic }
OR = {
has_trait = theologian
has_trait = lifestyle_mystic
has_trait = zealous
has_trait = reclusive
}
has_trait = lifestyle_mystic
spiritual_fulfillment >= spiritual_fulfillment_2
}
modifier = {
piety_level >= 5
factor = 2
}
give_nickname = nick_the_angelic
# Flag this as having been spat out already, in case we're applying several nicknames in quick succession.
flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_angelic }
trigger_event = lifestyle_nicknames.1000
}
#Fallback
1 = {
trigger = {

View file

@ -30,8 +30,8 @@ grab_appropriate_chronicler_effect = {
has_cultural_tradition = tradition_chanson_de_geste
}
}
faith = {
trait_is_virtue = lifestyle_poet
rite = {
trait_is_virtue_rite = lifestyle_poet
}
}
any_court_position_holder = {
@ -918,6 +918,7 @@ change_legend_quality_effect = {
add = $VALUE$
}
}
custom_tooltip = maximum_legend_quality_discount_reach_tt
set_variable = {
name = legend_quality_progress
value = 100
@ -932,6 +933,7 @@ change_legend_quality_effect = {
add = $VALUE$
}
}
custom_tooltip = minimum_legend_quality_discount_reach_tt
set_variable = {
name = legend_quality_progress
value = 0
@ -1085,14 +1087,14 @@ legend_ending_rewards_mythical_heroic_effect = {
legend_ending_rewards_mythical_holy_effect = {
add_legitimacy = massive_legitimacy_gain
# Chance to become a Saint
# Chance to become a Herald
if = {
limit = {
dynasty ?= {
ce1_heroic_track_perks >= 3
}
}
add_trait = saint
add_trait = herald
if = {
limit = { NOT = { has_global_variable = num_of_saints_var } }
set_global_variable = {
@ -1649,7 +1651,7 @@ get_appropriate_exotic_location = {
religion = religion:christianity_religion
NOT = {
any_character_to_title_neighboring_and_across_water_county = {
holder = { faith = faith:coptic }
holder = { faith = faith:miaphysitism }
}
}
NOT = { # Prester John isn't exciting if Egypt is Christian
@ -1683,14 +1685,14 @@ get_appropriate_exotic_location = {
OR = {
geographical_region = world_india
geographical_region = world_tibet
geographical_region = world_burma
geographical_region = world_asia_southeast_mainland
geographical_region = world_asia_china
}
}
}
culture = { culture_overlaps_geographical_region = world_india }
culture = { culture_overlaps_geographical_region = world_tibet }
culture = { culture_overlaps_geographical_region = world_burma }
culture = { culture_overlaps_geographical_region = world_asia_southeast_mainland }
culture = { culture_overlaps_geographical_region = world_asia_china }
}
}
@ -1873,7 +1875,25 @@ generate_religion_descent_effect = {
$RELIGION$ = religion:theomach_religion
}
generate_godly_descent_seed_support_effect = {
FAITH = theomach
FAITH = finno_ugric
GOD = $GOD$
}
}
else_if = {
limit = {
$RELIGION$ = religion:germanic_religion
}
generate_godly_descent_seed_support_effect = {
FAITH = germanic
GOD = $GOD$
}
}
else_if = {
limit = {
$RELIGION$ = religion:hellenism_religion
}
generate_godly_descent_seed_support_effect = {
FAITH = hellenism
GOD = $GOD$
}
}
@ -2350,12 +2370,12 @@ give_legendary_building_location_standard_effect = {
has_trait_xp = {
trait = lifestyle_hunter
track = hunter
value >= 62
value >= 50
}
has_trait_xp = {
trait = lifestyle_hunter
track = falconer
value >= 62
value >= 50
}
culture ?= {
has_cultural_parameter = always_unlock_legendary_hunting_lodge
@ -2453,12 +2473,15 @@ legend_seed_great_deed_dynasty_effect = {
legend_seed_great_deed_region_effect = {
if = {
limit = { has_dlc_feature = legends }
$REGION$ = {
save_scope_as = legend_region
}
create_legend_seed = {
type = heroic
quality = famed
chronicle = great_deed_region
properties = {
legend_region = $REGION$
legend_region = scope:legend_region
founder = root
}
}
@ -2978,7 +3001,6 @@ create_swan_knight_legend_seed_effect = {
location = {
OR = {
geographical_region = world_india
geographical_region = world_burma
geographical_region = ghw_region_caucasus
geographical_region = world_asia_china
geographical_region = world_asia_japan

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,709 +0,0 @@
# Find debate target
set_debate_target_effect = {
save_scope_as = debate_contender
if = {
limit = {
scope:activity = {
has_activity_option = {
category = special_type
option = debate_type_favor
}
}
}
#Save current empowered movement.
situation:dynastic_cycle ?= {
random_participant_group = {
limit = { exists = var:movement_favored }
save_scope_as = current_empowered_movement
}
}
if = { # Grab the movement leader if available
limit = {
scope:current_empowered_movement = {
var:movement_leader = { involved_activity = scope:activity }
}
}
scope:current_empowered_movement = {
var:movement_leader = { save_scope_as = challenged_movement_leader }
}
}
else_if = { # Else grab a proxy
limit = {
scope:activity = {
any_attending_character = {
top_participant_group:dynastic_cycle ?= scope:current_empowered_movement
}
}
}
scope:activity = {
ordered_attending_character = {
order_by = movement_power_character_value
check_range_bounds = no
limit = {
top_participant_group:dynastic_cycle ?= scope:current_empowered_movement
}
save_scope_as = challenged_movement_leader
}
}
}
else_if = { # Else grab a character from _another_ movement
limit = {
scope:activity = {
any_attending_character = {
NOR = {
top_participant_group:dynastic_cycle ?= { participant_group_type = undecided_movement }
top_participant_group:dynastic_cycle ?= scope:host.top_participant_group:dynastic_cycle
}
}
}
}
scope:activity = {
ordered_attending_character = {
order_by = movement_power_character_value
check_range_bounds = no
limit = {
NOR = {
top_participant_group:dynastic_cycle ?= { participant_group_type = undecided_movement }
top_participant_group:dynastic_cycle ?= scope:host.top_participant_group:dynastic_cycle
}
}
save_scope_as = challenged_movement_leader
}
}
}
else = { # Invalidate activity
trigger_event = activity_system.0552
}
}
else_if = {
limit = {
scope:activity = {
has_activity_option = {
category = special_type
option = debate_type_leadership
}
}
}
scope:activity.special_guest:movement_leader ?= { save_scope_as = challenged_movement_leader }
}
scope:activity = {
set_variable = {
name = challenged_movement_leader
value = scope:challenged_movement_leader
}
set_variable = {
name = debate_contender
value = scope:debate_contender
}
}
}
# > 0 contender won and will become new leader
# <= 0 movement leader won and defended position
debate_determine_outcome_effect = {
random_list = {
10 = { # Contender is winner
modifier = {
add = 240
scope:activity.debate_outcome_value = 3
}
modifier = {
add = 70
scope:activity.debate_outcome_value = 2
}
modifier = {
add = 10
scope:activity.debate_outcome_value = 1
}
modifier = { # If opponents score is TOO high, you cannot win
factor = 0
scope:activity.debate_outcome_value <= -3
}
scope:activity.var:debate_contender = {
save_scope_as = debate_winner
}
scope:activity.var:challenged_movement_leader = {
save_scope_as = debate_loser
}
if = {
limit = {
scope:activity.debate_outcome_value < 0
}
save_scope_as = debate_unexpected_win
}
}
10 = { # challenged leader is winner
modifier = {
add = 240
scope:activity.debate_outcome_value = -3
}
modifier = {
add = 70
scope:activity.debate_outcome_value = -2
}
modifier = {
add = 10
scope:activity.debate_outcome_value = -1
}
modifier = { # If opponents score is TOO high, you cannot win
factor = 0
scope:activity.debate_outcome_value >= 3
}
scope:activity.var:debate_contender = {
save_scope_as = debate_loser
}
scope:activity.var:challenged_movement_leader = {
save_scope_as = debate_winner
}
if = {
limit = {
scope:activity.debate_outcome_value > 0
}
save_scope_as = debate_unexpected_win
}
}
}
# Apply effects
# Seize movement leadership success
if = {
limit = {
scope:activity = {
has_activity_option = {
category = special_type
option = debate_type_leadership
}
}
}
# Set variables for activity conclusion desc - note that for the favor special option, these are set in the hegemon's follow up event.
scope:activity = {
set_variable = {
name = debate_winner
value = scope:debate_winner
}
}
scope:activity = {
set_variable = {
name = debate_loser
value = scope:debate_loser
}
}
# Record it
involved_activity = {
if = {
limit = {
scope:debate_winner = {
is_any_movement_leader = no
}
}
add_activity_log_entry = {
key = debate_become_movement_leader_reward
score = 80
tags = { completed }
character = scope:debate_winner
location = scope:debate_winner.location
}
}
else = {
add_activity_log_entry = {
key = debate_remain_movement_leader_reward
score = 80
tags = { completed }
character = scope:debate_winner
location = scope:debate_winner.location
}
}
}
}
}
debate_disburse_activity_ai_guest_rewards = {
if = {
limit = {
NOT = { exists = var:tgp_debate_success_score }
}
set_variable = {
name = tgp_debate_success_score
value = tgp_debate_success_score_value
}
}
if = {
limit = {
has_activity_intent = debate_increase_movement_power_intent
exists = top_participant_group:dynastic_cycle
}
top_participant_group:dynastic_cycle ?= {
save_scope_as = my_movement
}
random = {
chance = {
value = 25
if = {
limit = { var:tgp_debate_success_score >= 100 }
add = 75
}
else_if = {
limit = { var:tgp_debate_success_score >= 75 }
add = 50
}
else_if = {
limit = { var:tgp_debate_success_score >= 50 }
add = 25
}
}
if = {
limit = { var:tgp_debate_success_score >= 100 }
change_influence = major_influence_gain
scope:my_movement = {
event_change_movement_power_effect = {
VALUE = event_increase_movement_power_major_value
}
}
}
else_if = {
limit = { var:tgp_debate_success_score >= 75 }
change_influence = medium_influence_gain
scope:my_movement = {
event_change_movement_power_effect = {
VALUE = event_increase_movement_power_medium_value
}
}
}
else = {
change_influence = minor_influence_gain
scope:my_movement = {
event_change_movement_power_effect = {
VALUE = event_increase_movement_power_minor_value
}
}
}
}
}
else = {
save_scope_as = ai_guest
if = {
limit = {
NOT = {
any_relation = {
type = elder
is_ai = no
}
}
}
random = {
chance = {
value = 25
}
scope:activity = {
random_attending_character = {
limit = {
is_ai = yes
merit > scope:ai_guest.merit
num_of_relation_disciple < disciples_limit_value
NOR = {
has_relation_elder = scope:ai_guest
has_relation_disciple = scope:ai_guest
}
# Not busy with their own things.
this != scope:host
this != scope:activity.var:challenged_movement_leader
}
weight = {
base = 100
modifier = {
any_relation = {
type = disciple
count > 0
}
# even out the distribution of disciples
add = {
every_relation = {
type = disciple
add = -5
}
}
}
}
save_scope_as = elder
set_elder_relation_effect = {
ELDER = scope:elder
DISCIPLE = scope:ai_guest
MERIT = minor_merit_gain
}
}
}
}
}
}
}
debate_host_rewards_effect = {
if = {
# Host won debate
limit = {
this = scope:activity.var:debate_winner
}
# Activity is imperial debate (determines favored movement)
if = {
limit = {
scope:activity = {
has_activity_option = {
category = special_type
option = debate_type_favor
}
}
}
root.top_participant_group:dynastic_cycle ?= {
# Make favored movement
save_scope_as = my_movement
}
# We raise our own Movement Power
custom_tooltip = event_increase_movement_power_major_effect_tooltip
scope:my_movement = {
make_movement_favored_effect = yes
event_change_movement_power_effect = {
VALUE = event_increase_movement_power_major_value
}
switch = {
trigger = participant_group_type
pro_hegemon_movement = {
if = {
limit = {
situation:dynastic_cycle = {
situation_top_has_catalyst = catalyst_movement_gained_power_pro_hegemon
}
}
situation:dynastic_cycle = {
trigger_situation_catalyst = catalyst_movement_gained_power_pro_hegemon
}
}
}
advancement_movement = {
if = {
limit = {
situation:dynastic_cycle = {
situation_top_has_catalyst = catalyst_movement_gained_power_advancement
}
}
situation:dynastic_cycle = {
trigger_situation_catalyst = catalyst_movement_gained_power_advancement
}
}
}
expansion_movement = {
if = {
limit = {
situation:dynastic_cycle = {
situation_top_has_catalyst = catalyst_movement_gained_power_expansion
}
}
situation:dynastic_cycle = {
trigger_situation_catalyst = catalyst_movement_gained_power_expansion
}
}
}
conservative_movement = {
if = {
limit = {
situation:dynastic_cycle = {
situation_top_has_catalyst = catalyst_movement_gained_power_conservative
}
}
situation:dynastic_cycle = {
trigger_situation_catalyst = catalyst_movement_gained_power_conservative
}
}
}
}
}
}
else = {
make_movement_leader_effect = yes
}
}
# Then dole out secondary rewards
if = {
# We have the intent to gain disciples and gained at least one.
limit = { has_variable_list = debate_disciples }
if = {
# Code math starts at 0
limit = {
variable_list_size = {
name = debate_disciples
value >= 1
}
num_of_relation_disciple >= 1
}
ordered_in_list = {
variable = debate_disciples
order_by = learning
save_scope_as = disciple_1
}
}
if = {
limit = {
variable_list_size = {
name = debate_disciples
value >= 2
}
num_of_relation_disciple >= 2
}
ordered_in_list = {
variable = debate_disciples
order_by = learning
position = 1
save_scope_as = disciple_2
}
}
if = {
limit = {
variable_list_size = {
name = debate_disciples
value >= 3
}
num_of_relation_disciple >= 3
}
ordered_in_list = {
variable = debate_disciples
order_by = learning
position = 2
save_scope_as = disciple_3
}
}
if = {
limit = {
exists = scope:disciple_3
}
custom_tooltip = gained_many_disciples
}
else_if = {
limit = {
exists = scope:disciple_2
}
custom_tooltip = gained_few_disciples
}
else_if = {
limit = {
exists = scope:disciple_1
}
custom_tooltip = gained_one_disciple
}
}
change_influence = {
# Modest reward as a base - you're the host after all!
value = major_influence_value
if = {
limit = {
scope:activity = {
has_activity_option = {
category = special_type
option = debate_type_favor
}
}
this = scope:activity.var:debate_winner
}
add = monumental_influence_value
}
if = {
limit = {
scope:activity = {
has_activity_option = {
category = special_type
option = debate_type_leadership
}
}
this = scope:activity.var:debate_winner
}
add = major_influence_value
}
}
add_prestige = {
# Modest reward as a base - you're the host after all!
value = major_prestige_value
if = {
limit = {
scope:activity = {
has_activity_option = {
category = special_type
option = debate_type_favor
}
}
this = scope:activity.var:debate_winner
}
add = monumental_prestige_value
}
if = {
limit = {
scope:activity = {
has_activity_option = {
category = special_type
option = debate_type_leadership
}
}
this = scope:activity.var:debate_winner
}
add = major_prestige_value
}
}
}
debate_disburse_activity_host_rewards = {
# Regardless of outcome for intents, you should receive some influence and prestige from having hosted debate.
if = {
limit = { this = scope:host }
# Record it
involved_activity = {
add_activity_log_entry = {
key = debate_host_rewards
score = 80
tags = { completed }
show_in_conclusion = yes
character = scope:host
location = scope:host.location
scope:host = { debate_host_rewards_effect = yes }
}
}
pam_vows_of_poverty_host_completion_piety_effect = yes
}
else = {
show_as_tooltip = { debate_host_rewards_effect = yes }
}
}
debate_guest_rewards = {
if = {
limit = {
this = scope:activity.var:challenged_movement_leader
this = scope:activity.var:debate_winner
}
add_prestige = major_prestige_value
change_influence = major_influence_value
}
if = {
limit = {
has_activity_intent = debate_gain_elder_intent
}
if = {
limit = {
has_variable = new_elder
}
custom_tooltip = gained_new_elder_tt
}
change_influence = debate_guest_influence_reward_value
}
if = {
limit = {
has_activity_intent = debate_increase_movement_power_intent
exists = var:tgp_debate_success_score
}
top_participant_group:dynastic_cycle ?= {
save_scope_as = my_movement
}
random = {
chance = {
value = 25
if = {
limit = { var:tgp_debate_success_score >= 100 }
add = 75
}
else_if = {
limit = { var:tgp_debate_success_score >= 75 }
add = 50
}
else_if = {
limit = { var:tgp_debate_success_score >= 50 }
add = 25
}
}
if = {
limit = { var:tgp_debate_success_score >= 100 }
change_influence = major_influence_gain
scope:my_movement = {
event_change_movement_power_effect = {
VALUE = event_increase_movement_power_major_value
}
}
}
else_if = {
limit = { var:tgp_debate_success_score >= 75 }
change_influence = medium_influence_gain
scope:my_movement = {
event_change_movement_power_effect = {
VALUE = event_increase_movement_power_medium_value
}
}
}
else = {
change_influence = minor_influence_gain
scope:my_movement = {
event_change_movement_power_effect = {
VALUE = event_increase_movement_power_minor_value
}
}
}
}
change_influence = debate_guest_influence_reward_value
}
add_trait_xp = {
trait = confucian_education
value = {
value = lifestyle_confucian_education_xp_gain_minor_value
#High Score
if = {
limit = {
has_variable = tgp_debate_success_score
var:tgp_debate_success_score >= 75
}
multiply = 3
}
#Good Score
else_if = {
limit = {
has_variable = tgp_debate_success_score
var:tgp_debate_success_score < 75
var:tgp_debate_success_score >= 50
}
multiply = 1.5
}
#Poor Score
else_if = {
limit = {
has_variable = tgp_debate_success_score
var:tgp_debate_success_score < 50
}
multiply = 0.8
}
}
}
}
debate_disburse_activity_guest_rewards = {
save_scope_as = guest
involved_activity = {
add_activity_log_entry = {
key = debate_guest_rewards
score = 80
tags = { completed }
show_in_conclusion = yes
character = scope:guest
location = scope:guest.location
scope:guest = { debate_guest_rewards = yes }
}
}
}
debate_cleanup_effect = {
if = {
limit = {
has_variable = tgp_debate_success_score
}
set_variable = {
name = tgp_debate_success_score
value = var:tgp_debate_success_score
days = 60
}
}
# Debates
remove_variable ?= debate_selected_tactic
remove_variable ?= debate_crowd_sentiment
}

File diff suppressed because it is too large Load diff

View file

@ -1,678 +0,0 @@
tribute_mission_clean_up_variables_effect = {
remove_variable = tribute_mission_target_scope
remove_variable = offered_gold_value
remove_variable = tribute_mission_type
remove_variable = offered_herd_value
remove_variable = offered_concubine
remove_variable = offered_eunuch
remove_variable = offered_artifact
remove_variable = tribute_reward_fascination_progress
if = {
limit = {
has_character_flag = tribute_mission_character_flag # Under select circumstances it's possible this will be rerun, so this avoids an error
}
remove_character_flag = tribute_mission_character_flag
}
if = {
limit = { exists = scope:receiving_character }
scope:receiving_character = {
if = {
limit = { has_character_flag = created_attendant }
silent_disappearance_effect = yes
}
}
}
}
tribute_mission_clean_up_request_variables_effect = {
remove_variable = requested_tribute_mission
remove_variable = requested_tribute_mission_type_gold
remove_variable = requested_tribute_mission_type_herd
remove_variable = requested_tribute_mission_type_artifact
remove_variable = requested_tribute_mission_type_concubine
remove_variable = requested_tribute_mission_type_eunuch
remove_variable = declined_requested_tribute_recently
remove_variable = predetermined_concubine_tribute
remove_variable = predetermined_eunuch_tribute
remove_variable = predetermined_artifact_tribute
}
requested_tribute_mission_clean_up_variables_effect = {
remove_variable = requested_tribute_mission
remove_variable = invalidation_should_fail_ongoing_requested_tribute_mission
}
tribute_mission_decision_effect = {
if = {
#Are you a tributary of a Hegemon?
limit = { subject_standing >= 0 }
if = {
limit = { is_tributary = yes }
#If it's China, flavorize Imperial Grace
if = {
limit = { suzerain = { primary_title = title:h_china } }
custom_tooltip = tribute_mission_interaction_anticipated_rewards_tt_imperial_grace
}
#Else standard stuff
else = {
custom_tooltip = tribute_mission_interaction_anticipated_rewards_tt_generic_hegemon
}
}
}
else = {
if = {
limit = { $TARGET$ = { primary_title = title:h_china } }
custom_tooltip = tribute_mission_interaction_anticipated_rewards_tt_china
}
else_if = {
limit = { $TARGET$ = { primary_title = title:h_roman_empire } }
custom_tooltip = tribute_mission_interaction_anticipated_rewards_tt_roman_empire
}
else_if = {
limit = { $TARGET$ = { primary_title = title:h_eastern_roman_empire } }
custom_tooltip = tribute_mission_interaction_anticipated_rewards_tt_eastern_roman_empire
}
else_if = {
limit = { $TARGET$ = { primary_title = title:h_dar_al_islam } }
custom_tooltip = tribute_mission_interaction_anticipated_rewards_tt_dar_al_islam
}
else_if = {
limit = { $TARGET$ = { primary_title = title:h_india } }
custom_tooltip = tribute_mission_interaction_anticipated_rewards_tt_india
}
else = { custom_tooltip = tribute_mission_interaction_anticipated_rewards_tt }
}
hidden_effect = {
tribute_mission_clean_up_variables_effect = yes
if = {
limit = { is_tributary = yes }
suzerain = {
save_scope_as = tribute_mission_target
add_character_flag = {
flag = pay_tribute_cooldown
years = 3
}
}
}
else = {
$TARGET$ = {
save_scope_as = tribute_mission_target
}
}
set_variable = { # persist for later interactions
name = tribute_mission_target_scope
value = scope:tribute_mission_target
}
}
# not all tribute decisions have this option
if = {
limit = { NOT = { exists = scope:tribute_mission_bunga_mas } }
save_temporary_scope_value_as = { name = tribute_mission_bunga_mas value = no }
}
#Your Suzerain requested this specifically
if = {
limit = {
has_variable = requested_tribute_mission
is_ai = yes
}
switch = {
trigger = has_variable
requested_tribute_mission_type_gold = { # Gold
run_interaction = {
interaction = tribute_mission_gold_interaction
actor = root
recipient = scope:tribute_mission_target
execute_threshold = accept
}
}
requested_tribute_mission_type_herd = { # Herd
run_interaction = {
interaction = tribute_mission_herd_interaction
actor = root
recipient = scope:tribute_mission_target
execute_threshold = accept
}
}
requested_tribute_mission_type_artifact = { # Artifact
var:predetermined_artifact_tribute ?= { save_scope_as = predetermined_artifact_tribute_scope }
#Do the things from the interaction
scope:predetermined_artifact_tribute_scope = {
set_variable = is_tribute_mission_artifact
}
#Save the Artifact
set_variable = {
name = tribute_mission_type
value = flag:artifact_tribute
}
set_variable = {
name = offered_artifact
value = scope:predetermined_artifact_tribute_scope
}
#Travel
tribute_mission_set_up_tribute_travel_effect = yes
}
requested_tribute_mission_type_concubine = { # Concubine
var:predetermined_concubine_tribute ?= {
save_scope_as = predetermined_concubine_tribute_scope
}
scope:predetermined_concubine_tribute_scope = {
add_character_flag = {
flag = cannot_be_diarch # just enough to make sure they don't succeed to the diarchy while en route
years = 2
}
}
run_interaction = {
interaction = tribute_mission_concubine_interaction
actor = root
recipient = scope:tribute_mission_target
secondary_recipient = scope:predetermined_concubine_tribute_scope
execute_threshold = accept
}
}
requested_tribute_mission_type_eunuch = { # Eunuch
var:predetermined_eunuch_tribute ?= { save_scope_as = predetermined_eunuch_tribute_scope }
run_interaction = {
interaction = tribute_mission_eunuch_interaction
actor = root
recipient = scope:tribute_mission_target
secondary_recipient = scope:predetermined_eunuch_tribute_scope
execute_threshold = accept
}
}
}
}
else_if = {
limit = { is_ai = yes }
switch = {
trigger = yes
scope:tribute_mission_gold = { # Gold
run_interaction = {
interaction = tribute_mission_gold_interaction
actor = root
recipient = scope:tribute_mission_target
execute_threshold = accept
}
}
scope:tribute_mission_herd = { # Herd
run_interaction = {
interaction = tribute_mission_herd_interaction
actor = root
recipient = scope:tribute_mission_target
execute_threshold = accept
}
}
scope:tribute_mission_artifact = { # Artifact
random_character_artifact = {
limit = { is_suitable_artifact_tribute_trigger = yes }
save_scope_as = decision_predetermined_artifact_tribute
}
#Do the things from the interaction
scope:decision_predetermined_artifact_tribute = {
set_variable = is_tribute_mission_artifact
}
#Save the Artifact
set_variable = {
name = tribute_mission_type
value = flag:artifact_tribute
}
set_variable = {
name = offered_artifact
value = scope:decision_predetermined_artifact_tribute
}
#Travel
tribute_mission_set_up_tribute_travel_effect = yes
}
scope:tribute_mission_concubine = { # Concubine
every_courtier_or_guest = {
limit = {
can_be_offered_as_concubine_to_character_trigger = {
GIVER = root
CHARACTER = scope:tribute_mission_target
}
tribute_mission_is_available_concubine_trigger = yes
}
add_to_list = potential_concubine_tribute_list
random_in_list = {
list = potential_concubine_tribute_list
weight = {
#Let's try to make a sane choice here
base = 0
#No marginally relevant court people
modifier = {
add = 10
NOR = {
is_councillor = yes
has_any_court_position = yes
}
}
#No knights
modifier = {
add = 5
is_knight = no
}
#No inspired people?
modifier = {
add = 20
NOT = { exists = inspiration }
}
#No close family
modifier = {
add = 15
NOT = { is_close_or_extended_family_of = root }
}
#No friends?
modifier = {
add = 20
NOT = { has_relation_friend = root }
}
#No children
modifier = {
add = 25
NOT = { is_child_of = root }
}
}
save_scope_as = decision_predetermined_concubine_tribute
}
}
# Fallback in case there's no saved concubine
if = {
limit = {
NOT = { exists = scope:decision_predetermined_concubine_tribute }
}
create_character = {
template = tgp_concubine_template
location = root.location
save_scope_as = decision_predetermined_concubine_tribute
}
}
scope:decision_predetermined_concubine_tribute = {
add_character_flag = {
flag = cannot_be_diarch # just enough to make sure they don't succeed to the diarchy while en route
years = 2
}
}
run_interaction = {
interaction = tribute_mission_concubine_interaction
actor = root
recipient = scope:tribute_mission_target
secondary_recipient = scope:decision_predetermined_concubine_tribute
execute_threshold = accept
}
}
scope:tribute_mission_eunuch = { # Eunuch
every_courtier = {
limit = {
tribute_mission_is_available_eunuch_trigger = yes
NOT = { is_heir_of = root }
}
add_to_list = potential_eunuch_tribute_list
random_in_list = {
list = potential_eunuch_tribute_list
weight = {
#Let's try to make a sane choice here
base = 0
#No marginally relevant court people
modifier = {
add = 10
NOR = {
is_councillor = yes
has_any_court_position = yes
}
}
#No knights
modifier = {
add = 5
is_knight = no
}
#No inspired people?
modifier = {
add = 20
NOT = { exists = inspiration }
}
#No close family
modifier = {
add = 15
NOT = { is_close_or_extended_family_of = scope:tribute_mission_target }
}
#No friends?
modifier = {
add = 20
NOT = { has_relation_friend = scope:tribute_mission_target }
}
#No children
modifier = {
add = 25
NOT = { is_child_of = scope:tribute_mission_target }
}
}
save_scope_as = decision_predetermined_eunuch_tribute
}
}
run_interaction = {
interaction = tribute_mission_eunuch_interaction
actor = root
recipient = scope:tribute_mission_target
secondary_recipient = scope:decision_predetermined_eunuch_tribute
execute_threshold = accept
}
}
scope:tribute_mission_bunga_mas = { # Bunga Mas
random_character_artifact = {
limit = { var:bunga_mas_created_by ?= root }
save_scope_as = decision_predetermined_bunga_mas_tribute
}
#Do the things from the interaction
scope:decision_predetermined_bunga_mas_tribute = {
set_variable = is_tribute_mission_artifact
}
#Save the Artifact
set_variable = {
name = tribute_mission_type
value = flag:bunga_mas_tribute
}
set_variable = {
name = offered_bunga_mas
value = scope:decision_predetermined_bunga_mas_tribute
}
#Travel
tribute_mission_set_up_tribute_travel_effect = yes
}
}
}
#Natural flow of the decision
else_if = {
limit = { is_ai = no }
switch = {
trigger = yes
scope:tribute_mission_gold = { # Gold
open_interaction_window = {
interaction = tribute_mission_gold_interaction
actor = root
recipient = scope:tribute_mission_target
}
}
scope:tribute_mission_herd = { # Herd
open_interaction_window = {
interaction = tribute_mission_herd_interaction
actor = root
recipient = scope:tribute_mission_target
}
}
scope:tribute_mission_artifact = { # Artifact
open_interaction_window = {
interaction = tribute_mission_artifact_interaction
actor = root
recipient = scope:tribute_mission_target
}
}
scope:tribute_mission_concubine = { # Concubine
open_interaction_window = {
interaction = tribute_mission_concubine_interaction
actor = root
recipient = scope:tribute_mission_target
}
}
scope:tribute_mission_eunuch = { # Eunuch
open_interaction_window = {
interaction = tribute_mission_eunuch_interaction
actor = root
recipient = scope:tribute_mission_target
}
}
scope:tribute_mission_bunga_mas = { # Bunga Mas
open_interaction_window = {
interaction = tribute_mission_bunga_mas_interaction
actor = root
recipient = scope:tribute_mission_target
}
}
}
}
if = {
limit = {
is_ai = yes
scope:tribute_mission_target = { highest_held_title_tier = tier_hegemony }
}
scope:tribute_mission_target = {
set_variable = {
name = ai_tribute_mission_cooldown
years = 1
}
}
}
}
set_or_change_offered_tribute_value_effect = {
if = {
limit = { has_variable = offered_$TYPE$_value }
change_variable = {
name = offered_$TYPE$_value
add = $VALUE$
}
}
else = {
set_variable = {
name = offered_$TYPE$_value
value = $VALUE$
}
}
}
tribute_mission_set_up_tribute_travel_effect = {
#Recover the tribute_mission_target scope from saved var if it doesn't already exist
if = {
limit = { exists = var:tribute_mission_target_scope }
var:tribute_mission_target_scope = {
save_scope_as = tribute_mission_target
}
}
else = {
error_log = "Tribute mission target scope variable not set on character intending to travel!"
}
#Travel posted first should look neater in tooltip
hidden_effect = { # ensure we subtract everything we've offered
if = {
limit = { has_variable = offered_gold_value }
remove_short_term_gold = var:offered_gold_value
}
if = {
limit = { has_variable = offered_herd_value }
domicile ?= {
change_herd = { subtract = prev.var:offered_herd_value }
}
}
}
trigger_event = { on_action = tribute_mission_start }
if = {
limit = { location = scope:tribute_mission_target.capital_province }
trigger_event = tribute_mission.0002
}
#Add the concubine
else_if = {
limit = { has_variable = offered_concubine }
start_travel_plan = {
destination = scope:tribute_mission_target.capital_province
companion = var:offered_concubine
on_travel_planner_cancel_on_action = tribute_mission_travel_planner_exit
on_arrival_event = tribute_mission.0002
}
}
#Add the eunuch
else_if = {
limit = { has_variable = offered_eunuch }
start_travel_plan = {
destination = scope:tribute_mission_target.capital_province
companion = var:offered_eunuch
on_travel_planner_cancel_on_action = tribute_mission_travel_planner_exit
on_arrival_event = tribute_mission.0002
}
}
else = {
custom_tooltip = tribute_mission.travel_to.tt
start_travel_plan = {
destination = scope:tribute_mission_target.capital_province
on_travel_planner_cancel_on_action = tribute_mission_travel_planner_exit
on_arrival_event = tribute_mission.0002
}
}
}
tribute_mission_invalidation_effect = {
if = {
limit = { has_variable = tribute_mission_type }
if = {
limit = { # sanity check to ensure we're still a valid tribute provider
OR = {
is_independent_ruler = no # if we have a liege we cannot also pay tribute to someone else
AND = { # if we're not a tributary we are only valid if we're paying tribute to a hegemony
is_tributary = no
OR = {
NOT = { exists = var:tribute_mission_target_scope }
var:tribute_mission_target_scope = { NOT = { highest_held_title_tier = tier_hegemony } }
}
}
}
}
#Return home and refund
trigger_event = tribute_mission.9800
}
else_if = { #If our offerings have perished or been imprisoned along the way, maybe swap to gold
limit = {
has_variable = tribute_mission_type
OR = {
AND = {
has_variable = offered_concubine
OR = {
var:offered_concubine = { is_alive = no }
var:offered_concubine = { is_imprisoned = yes }
}
}
AND = {
has_variable = offered_eunuch
OR = {
var:offered_eunuch = { is_alive = no }
var:offered_eunuch = { is_imprisoned = yes }
}
}
}
}
trigger_event = tribute_mission.9750
}
else_if = {
#We're still a tributary on our way to pay tribute, but our suzerain is not the person we were going to pay tribute to
limit = {
has_variable = tribute_mission_target_scope
OR = {
AND = {
is_tributary = yes
var:tribute_mission_target_scope != suzerain
}
AND = {
is_tributary = no
OR = {
NOT = { exists = var:tribute_mission_target_scope }
var:tribute_mission_target_scope = { NOT = { highest_held_title_tier = tier_hegemony } }
}
}
}
}
var:tribute_mission_target_scope = { save_scope_as = old_overlord }
suzerain = { save_scope_as = new_overlord }
#Clean up Requested Tribute Mission variables
requested_tribute_mission_clean_up_variables_effect = yes
#The new Overlord is in the same place and can accept the tribute
if = {
limit = {
#Make sure they can still accept our offerings; if so, just set the new target
current_travel_plan.next_destination_province = scope:new_overlord.capital_province
has_variable = tribute_mission_type
trigger_if = {
limit = {
has_variable = {
name = offered_concubine
name = offered_eunuch
}
}
OR = {
AND = {
has_variable = offered_concubine
var:offered_concubine = {
can_become_concubine_of_character_valid_trigger = { CHARACTER = scope:new_overlord }
}
}
AND = {
has_variable = offered_eunuch
scope:new_overlord = {
culture = { has_cultural_parameter = can_appoint_chief_eunuch }
}
}
}
}
}
send_interface_message = {
type = msg_mandala_neutral_text
title = tribute_mission_notification.new_overlord.title
left_icon = scope:new_overlord
desc = tribute_mission_notification.new_overlord.desc
}
set_variable = {
name = tribute_mission_target_scope
value = scope:new_overlord
}
}
#The Overlord is somewhere else; please try again
else_if = {
limit = {
current_travel_plan.next_destination_province != scope:new_overlord.capital_province
}
set_variable = new_overlord_somewhere_else
#Return home and refund
trigger_event = tribute_mission.9800
}
else = {
set_variable = new_overlord_unable_to_accept_tribute
#Return home and refund
trigger_event = tribute_mission.9800
}
}
}
}
tribute_mission_mandala_piety_effect = {
if = {
limit = { government_has_flag = government_is_mandala }
overlord = { add_piety = minor_piety_gain }
}
}
requested_tribute_mission_penalty_effect = {
if = {
limit = {
has_variable = invalidation_should_fail_ongoing_requested_tribute_mission
}
trigger_event = {
id = tribute_mission.9500
delayed = yes
}
}
}