unfucking the mod

This commit is contained in:
trashmasteruni 2026-01-06 14:25:21 +01:00
parent cbe3fbcda2
commit d887392b56
1167 changed files with 26982 additions and 13 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,28 @@
create_artifact_excalibur_effect = {
# Get the character the artifact is being made for.
$OWNER$ = { save_scope_as = owner }
# Not really used, but if we don't set the scopes we get errors in the feature selection
set_artifact_rarity_common = yes
# Create the artifact
create_artifact = {
name = excalibur_name
description = excalibur_description
type = pedestal
visuals = excalibur
wealth = scope:wealth
quality = scope:quality
history = {
type = created_before_history
}
modifier = excalibur_modifier
save_scope_as = newly_created_artifact
decaying = no
}
scope:newly_created_artifact = {
set_variable = { name = historical_unique_artifact value = yes }
set_variable = excalibur
save_scope_as = epic
}
}

View file

@ -0,0 +1,64 @@
NEOW_set_bhakti_effect = { #reminder: patron gods will not remove on conversion until a specific base game event is replaced/overwritten. This folder is being created, rather than overwriting a base game folder to reduce overall complexity/troubleshooting
# Remove any previous personal god relation.
## Britannic
#Leviathan
if = {
limit = { portrait_religious_faith_or_foundational_trigger = { FAITH = faith:leviathan } }
if = {
limit = {
has_character_modifier = bhakti_leviathan_nationalisators
}
remove_character_modifier = bhakti_leviathan_nationalisators
add_piety = massive_piety_loss
}
else_if = {
limit = {
has_character_modifier = bhakti_leviathan_technosaurs
}
remove_character_modifier = bhakti_leviathan_technosaurs
add_piety = massive_piety_loss
}
else_if = {
limit = {
has_character_modifier = bhakti_leviathan_mechasaurs
}
remove_character_modifier = bhakti_leviathan_mechasaurs
add_piety = massive_piety_loss
}
else_if = {
limit = {
has_character_modifier = bhakti_leviathan_petrosaurs
}
remove_character_modifier = bhakti_leviathan_petrosaurs
add_piety = massive_piety_loss
}
else_if = {
limit = {
has_character_modifier = bhakti_leviathan_metallurgicals
}
remove_character_modifier = bhakti_leviathan_metallurgicals
add_piety = massive_piety_loss
}
else_if = {
limit = {
has_character_modifier = bhakti_leviathan_nautiluses
}
remove_character_modifier = bhakti_leviathan_nautiluses
add_piety = massive_piety_loss
}
else_if = {
limit = {
has_character_modifier = bhakti_leviathan_aerosaurs
}
remove_character_modifier = bhakti_leviathan_aerosaurs
add_piety = massive_piety_loss
}
}
# Put other religions/modifiers down here
else = {
# If no current bhakti, cost is reduced.
add_piety = medium_piety_loss
}
add_character_modifier = $BHAKTI$
}

View file

@ -0,0 +1,699 @@
# 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
}
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
}
}
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
}
}
trigger_situation_catalyst = catalyst_movement_gained_power_advancement
}
}
expansion_movement = {
if = {
limit = {
situation:dynastic_cycle = {
situation_top_has_catalyst = catalyst_movement_gained_power_expansion
}
}
trigger_situation_catalyst = catalyst_movement_gained_power_expansion
}
}
conservative_movement = {
if = {
limit = {
situation:dynastic_cycle = {
situation_top_has_catalyst = catalyst_movement_gained_power_conservative
}
}
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 }
}
}
}
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

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,664 @@
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
}
}
#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
}
has_any_disease_trigger = no
has_easily_mocked_physical_attribute_trigger = no
NOT = { is_heir_of = root }
}
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
}
}
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 = {
OR = {
has_variable = offered_concubine
has_variable = 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
}
}
}