Skip to content

Instantly share code, notes, and snippets.

@mindryu
Last active November 4, 2020 10:52
Show Gist options
  • Save mindryu/3aeaca9143707193e7758d2209220657 to your computer and use it in GitHub Desktop.
Save mindryu/3aeaca9143707193e7758d2209220657 to your computer and use it in GitHub Desktop.
Grant to faith head and dynasty member
grant_titles_interaction = {
category = interaction_category_vassal
common_interaction = yes
desc = grant_titles_interaction_desc
special_interaction = grant_titles_interaction
interface = grant_titles
target_type = title
target_filter = actor_domain_titles
interface_priority = 60
# actor character giving the titles
# recipient character receiving the titles
is_shown = {
NOT = { scope:actor = scope:recipient }
OR = {
scope:recipient = {
OR = {
target_is_liege_or_above = scope:actor
is_pool_guest_of = scope:actor
}
}
# Mod
AND = {
scope:actor = { is_ai = no }
scope:recipient = {
OR = {
faith.religious_head = this
dynasty = scope:actor.dynasty
}
}
}
}
}
is_valid_showing_failures_only = {
scope:recipient = { can_be_granted_titles_by = { RULER = scope:actor } }
NOT = { scope:actor = { is_at_war_with = scope:recipient } }
NOT = { scope:recipient = { has_trait = devoted } } # Monks are disinherited, and should not have land granted to them
custom_description = {
text = is_not_theocratic_court_chaplain
subject = scope:recipient
NAND = {
scope:actor.faith = {
has_doctrine = doctrine_theocracy_temporal
}
scope:recipient = {
faith = {
has_doctrine = doctrine_theocracy_temporal
}
has_council_position = councillor_court_chaplain
}
}
}
scope:actor = {
any_held_title = {
count > 1
}
}
scope:recipient = { is_diplomatically_available = yes }
trigger_if = {
limit = {
scope:recipient = {
is_ruler = no
}
}
scope:recipient = {
is_imprisoned = no
}
}
}
can_be_picked_title = {
scope:target = {
is_leased_out = no
trigger_if = {
limit = {
scope:recipient = scope:actor.player_heir
scope:actor = { has_partition_succession_realm_law_trigger = yes }
}
custom_description = {
text = partition_primary_heir_unfair
subject = scope:recipient
current_heir = scope:recipient
}
}
}
custom_description = {
text = grant_titles_interaction_children_not_allowed_temple
subject = scope:recipient
NOR = {
AND = {
scope:recipient = {
is_adult = no
}
scope:target = {
tier = tier_barony
title_province = { has_building_with_flag = temple }
}
}
AND = {
scope:recipient = {
is_adult = no
}
scope:target = {
tier = tier_county
title_province = {
is_county_capital = yes
has_building_with_flag = temple
}
}
}
}
}
}
auto_accept = yes
on_auto_accept = {
scope:recipient = {
trigger_event = char_interaction.0110
}
}
on_accept = {
every_in_list = {
list = target_titles
save_temporary_scope_as = this_title
if = {
limit = {
exists = scope:landed_title
}
scope:recipient = {
if = {
limit = {
scope:this_title.tier = tier_barony
}
hidden_effect = {
add_opinion = {
target = scope:actor
modifier = received_title_barony
}
}
scope:this_title = { add_to_temporary_list = titles_to_grant }
hidden_effect = {
if = {
limit = {
is_a_faction_member = yes
}
add_joined_faction_discontent = -5
}
}
}
else_if = {
limit = {
scope:this_title.tier = tier_county
}
hidden_effect = {
add_opinion = {
target = scope:actor
modifier = received_title_county
}
}
scope:this_title = { add_to_temporary_list = titles_to_grant }
hidden_effect = {
if = {
limit = {
is_a_faction_member = yes
}
add_joined_faction_discontent = -10
}
}
}
else_if = {
limit = {
scope:this_title.tier = tier_duchy
}
hidden_effect = {
add_opinion = {
target = scope:actor
modifier = received_title_duchy
}
}
scope:this_title = { add_to_temporary_list = titles_to_grant }
hidden_effect = {
if = {
limit = {
is_a_faction_member = yes
}
add_joined_faction_discontent = -20
}
}
}
else_if = {
limit = {
scope:this_title.tier = tier_kingdom
}
hidden_effect = {
add_opinion = {
target = scope:actor
modifier = received_title_kingdom
}
}
scope:this_title = { add_to_temporary_list = titles_to_grant }
hidden_effect = {
if = {
limit = {
is_a_faction_member = yes
}
add_joined_faction_discontent = -40
}
}
}
else_if = {
limit = { scope:this_title.tier = tier_empire }
add_opinion = {
target = scope:actor
modifier = received_title_empire
}
hidden_effect = {
if = {
limit = {
is_a_faction_member = yes
}
add_joined_faction_discontent = -60
}
}
scope:this_title = { add_to_temporary_list = titles_to_grant }
}
}
#Promised a vassal this title they had a claim on (vassal.2901)
if = {
limit = {
scope:actor = {
exists = var:was_promised_title
var:was_promised_title = scope:recipient
}
}
if = {
limit = {
scope:recipient = {
exists = var:promised_title
}
scope:landed_title = scope:recipient.var:promised_title
}
scope:actor = {
trigger_event = {
id = vassal.2910
days = { 7 14 }
}
}
}
}
}
if = {
limit = {
scope:recipient = {
has_trait = bastard
}
}
custom_tooltip = grant_title_to_bastard_dynasty_warning
}
}
if = {
limit = {
any_in_list = {
list = target_titles
tier = tier_empire
}
}
custom_tooltip = grant_title_modifier_stack_empires
}
if = {
limit = {
any_in_list = {
list = target_titles
tier = tier_kingdom
}
}
custom_tooltip = grant_title_modifier_stack_kingdoms
}
if = {
limit = {
any_in_list = {
list = titles_to_grant
tier = tier_duchy
}
}
custom_tooltip = grant_title_modifier_stack_duchies
}
if = {
limit = {
any_in_list = {
list = titles_to_grant
tier = tier_county
}
}
custom_tooltip = grant_title_modifier_stack_counties
}
if = {
limit = {
any_in_list = {
list = titles_to_grant
tier = tier_barony
}
}
custom_tooltip = grant_title_modifier_stack_baronies
}
if = {
limit = {
scope:recipient = { is_a_faction_member = yes }
}
custom_tooltip = grant_title_modifier_stack_discontent
}
#Stress impact
scope:actor = {
if = {
limit = {
any_in_list = {
list = target_titles
tier <= tier_county # Title counts toward domain limit
title_province.barony = {
has_wrong_holding_type = no
}
count >= 1
}
}
# Gnostics lose stress for giving away titles.
if = {
limit = {
scope:actor = {
faith = {
has_doctrine_parameter = granting_titles_gives_stress
}
}
}
scope:actor = {
add_stress = {
value = 0
# Base stress value scaled on title tier.
every_in_list = {
list = target_titles
add = {
value = 0
if = {
limit = { this.tier = tier_county }
add = minor_stress_loss # 10 base
}
else_if = {
limit = { this.tier = tier_duchy }
add = {
value = medium_stress_loss
multiply = 1.25 # 25 base
}
}
else_if = {
limit = { this.tier = tier_kingdom }
add = {
value = major_stress_loss
multiply = 2 # 80 base
}
}
else_if = {
limit = { this.tier = tier_empire }
add = {
value = monumental_stress_loss
multiply = 2 # 200 base
}
}
# Lose more stress for giving away titles of your primary tier; lose less stress for giving away titles far below your primary in tier.
multiply = {
value = this.tier
add = 1
divide = scope:actor.primary_title.tier
}
# Round to the nearest multiple of 5.
divide = 5
round = yes
multiply = 5
# For a Duke, this will be x1.25 for Duchies (-30) and x1 for Counties(-10)
# For a King, this will be x1.25 for a Kingdom (-100), x1 for a Duchy (-25) and x0.75 for Counties(-10)
# For an Emperor, this will be x1.25 for an Empire(-200), x1 for a Kingdom(-80), x0.75 for a Duchy(-20) and x0.4 for a Counties (-5)
}
}
}
}
}
# Greedy rules gain stress for giving away titles if they would normally be able to keep them.
if = {
limit = {
domain_size = domain_limit
}
stress_impact = {
greedy = minor_stress_impact_gain
ambitious = minor_stress_impact_gain
}
}
else_if = {
limit = {
domain_size < domain_limit
}
stress_impact = {
greedy = medium_stress_impact_gain
ambitious = medium_stress_impact_gain
}
}
}
#Feedback for actor
hidden_effect = {
if = {
limit = {
any_in_list = {
list = target_titles
count = 1
NOT = { tier = scope:actor.highest_held_title_tier }
}
scope:recipient = {
any_held_title = {
tier > tier_barony
NOT = {
is_in_list = target_titles
}
}
}
}
random_in_list = {
list = target_titles
save_temporary_scope_as = loc_title
}
send_interface_toast = {
title = grant_titles_interaction_notification
left_icon = scope:actor
right_icon = scope:recipient
custom_tooltip = grant_titles_interaction_notification_effect_2
}
}
else_if = {
limit = {
any_in_list = {
list = target_titles
count > 1
NOT = { tier = scope:actor.highest_held_title_tier }
}
scope:recipient = {
any_held_title = {
tier > tier_barony
NOT = {
is_in_list = target_titles
}
}
}
}
random_in_list = {
list = target_titles
save_temporary_scope_as = loc_title
}
send_interface_toast = {
title = grant_titles_interaction_notification
left_icon = scope:actor
right_icon = scope:recipient
custom_tooltip = grant_titles_interaction_notification_effect_3
}
}
else_if = {
limit = {
scope:recipient = {
any_in_list = { #Became independent
list = target_titles
tier = scope:actor.highest_held_title_tier
}
}
}
send_interface_toast = {
title = grant_titles_interaction_notification
left_icon = scope:actor
right_icon = scope:recipient
custom_tooltip = grant_titles_interaction_notification_effect_4
}
}
else = {
send_interface_toast = {
title = grant_titles_interaction_notification
left_icon = scope:actor
right_icon = scope:recipient
custom_tooltip = grant_titles_interaction_notification_effect
}
}
}
}
}
}
grant_vassal_interaction = {
category = interaction_category_vassal
common_interaction = yes
interface = transfer_vassal
special_interaction = grant_vassal_interaction
populate_actor_list = {
scope:actor = {
every_vassal = {
add_to_list = characters
}
}
}
desc = grant_vassal_interaction_desc
prompt = GRANT_VASSAL_SELECT_VASSAL_TO_TRANSFER
greeting = positive
notification_text = GRANT_VASSAL_PROPOSAL
pre_answer_yes_key = ACCEPT
pre_answer_no_key = DECLINE
is_shown = {
NOT = { scope:recipient = scope:actor }
OR = {
AND = {
exists = scope:recipient.liege
scope:recipient.liege = scope:actor
}
AND = {
exists = scope:actor.liege
scope:actor.liege = scope:recipient
}
# Mod
AND = {
scope:actor = { is_ai = no }
scope:recipient = {
OR = {
faith.religious_head = this
dynasty = scope:actor.dynasty
}
}
}
}
scope:recipient.highest_held_title_tier > tier_barony
}
is_valid_showing_failures_only = {
scope:recipient = { is_diplomatically_available = yes }
NOT = { scope:actor = { is_at_war_with = scope:recipient } }
trigger_if = {
limit = { exists = scope:secondary_actor }
NOT = { scope:secondary_actor = { is_at_war_with = scope:recipient } }
scope:secondary_actor = { is_diplomatically_available = yes }
scope:recipient.primary_title.tier > scope:secondary_actor.primary_title.tier
}
trigger_if = {
limit = {
scope:actor = { is_ai = yes }
exists = scope:secondary_actor
}
scope:secondary_actor = {
NOT = { has_character_flag = ai_should_not_transfer }
}
}
trigger_if = {
limit = { scope:recipient.highest_held_title_tier <= tier_county }
scope:recipient = { highest_held_title_tier > tier_county }
}
trigger_else = {
scope:actor = {
custom_description = {
text = "basic_valid_vassal_to_tranfer"
object = scope:recipient
any_vassal = {
NOT = { highest_held_title_tier = tier_barony }
scope:recipient.highest_held_title_tier > highest_held_title_tier
}
}
}
}
}
can_be_picked = {
NOT = { scope:recipient = root }
highest_held_title_tier > tier_barony
highest_held_title_tier < scope:recipient.highest_held_title_tier
trigger_if = {
limit = { scope:actor.liege = scope:recipient }
NOT = {
primary_title = {
any_this_title_or_de_jure_above = {
holder = scope:actor
}
}
}
}
# Not at war with the vassal being transferred (blocks explicit transfer of war enemies, which invalidates the war).
custom_description = {
text = "basic_is_at_war_with_vassal"
subject = root
object = scope:actor
NOT = {
root = {
is_at_war_with = scope:actor
}
}
}
# Mod
trigger_if = {
limit = { exists = scope:secondary_actor }
# Not at war with a vassal under the vassal being transferred (blocks implicit transfers of war enemies).
custom_description = {
text = "basic_is_at_war_with_sub_vassal"
subject = root
object = scope:actor
NOT = {
scope:secondary_actor = {
any_vassal_or_below = {
is_at_war_with = root
}
}
}
}
}
}
auto_accept = {
scope:recipient = {
custom_description = {
text = wants_more_vassals
is_ai = yes
}
}
}
on_accept = {
scope:actor = {
send_interface_toast = {
title = grant_vassal_interaction_notification
right_icon = scope:recipient
left_icon = scope:secondary_actor
create_title_and_vassal_change = {
type = granted
save_scope_as = change
add_claim_on_loss = no
}
scope:secondary_actor = {
change_liege = {
liege = scope:recipient
change = scope:change
}
}
resolve_title_and_vassal_change = scope:change
scope:recipient = {
add_opinion = {
target = scope:actor
modifier = granted_vassal
}
}
stress_impact = {
greedy = medium_stress_impact_gain
}
}
}
}
on_decline = {
scope:actor = {
trigger_event = char_interaction.0211
}
}
# AI handled entirely though code
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment