Scripted effect · Silk and Silver files
create_merchant_title_effect
create_merchant_title_effect = { FLAVOR_CHAR = … REASON = … }game/common/scripted_effects/gdp_merchant_scripted_effects.txt, line 1527 (382 lines). Parameters: $FLAVOR_CHAR$, $REASON$.
create_merchant_title_effect is a scripted effect in Crusader Kings III, in the Silk and Silver files, written at line 1527 of its file. A call passes 2 parameters: FLAVOR_CHAR and REASON. The game's script calls it in 12 places, among them Proscribe Entire Family (interaction), A Path Paved with Gold (event gdp_merchant.0001) and Enemy of the State (event overthrow_government_outcome.1004). Its body carries 9 texts of the game's own for the player. Patch 1.21.0, from game/common/scripted_effects/gdp_merchant_scripted_effects.txt.
What it does
• the game's own tooltip text · ◦ our reading of the script line · code the script where neither exists
“They” is whatever it runs on (the scope it is called in). The scripted triggers and effects it calls link to their own pages; $PARAMETERS$ stay as written: each call fills them in.
The script as written (120 lines of game script)
create_merchant_title_effect = {
save_scope_as = new_merchant
house ?= { save_scope_as = new_merchant_house }
location ?= { save_scope_as = new_merchant_location }
# Note our courtiers so that they don't escape.
if = {
limit = {
OR = {
government_has_flag = government_is_landless_adventurer
is_landless_administrative = yes
}
}
every_courtier = { add_to_list = courtiers_list }
}
# We save the reason for creating a Merchant House, for flavor purposes (memories and whatnot)
save_scope_value_as = {
name = merchant_creation_reason
value = $REASON$
}
# We save the person who is taking over for us
$FLAVOR_CHAR$ = { save_scope_as = merchant_flavor_char }
custom_tooltip = become_merchant_tt
if = {
limit = {
gdp_merchant_can_reclaim_house_company_title_trigger = no
gdp_merchant_needs_cadet_for_new_company_trigger = yes
}
custom_tooltip = become_merchant_form_cadet_branch_desc
}
# ORDER OF OPERATION HERE IS IMPORTANT
hidden_effect = {
if = {
limit = { exists = scope:merchant_flavor_char }
set_variable = {
name = pending_merchant_creation_reason
value = scope:merchant_creation_reason
}
set_variable = {
name = pending_merchant_flavor_char
value = scope:merchant_flavor_char
}
}
# Only create a new title if this character doesn't have one already (from this effect or from being a Patrician)
if = {
limit = {
any_held_title = { gdp_merchant_company_title_trigger = yes }
}
random_held_title = {
limit = { gdp_merchant_company_title_trigger = yes }
save_scope_as = the_new_title
}
}
# Also account for a company title they dropped before, say by becoming a landless adventurer
# This effect saves the title to be reclaimed as the_new_title
else_if = {
limit = { gdp_merchant_can_reclaim_house_company_title_trigger = yes }
gdp_merchant_reclaim_house_company_title_effect = yes
}
# Do we need to create a cadet branch?
else_if = {
limit = { gdp_merchant_needs_cadet_for_new_company_trigger = yes }
save_scope_as = new_house_head
save_best_location_for_house_name_effect = yes
create_cadet_branch = {
name = cadet_name_style_county_dynasty
save_scope_as = new_house
}
scope:new_house ?= { generate_coa = yes }
# House titles require every potential successor to share the holder's house.
every_close_family_member = {
limit = {
is_alive = yes
NOT = { exists = house }
}
set_house = scope:new_house
}
# Create a new title
create_dynamic_title = {
name = merchant_name_001
tier = county
type = title_type_merchant_family
holder = scope:new_merchant
article = DEFAULT_TITLE_NAME_ARTICLE
save_scope_as = the_new_title
}
}
# Now, if all the above checks failed, and the_new_title doesn't exist...
else = {
# House titles require every potential successor to share the holder's house
# Ruler-designer merchants often have generated lowborn parents or children with no house
if = {
limit = { exists = house }
house = { save_scope_as = merchant_title_house }
every_close_family_member = {
limit = {
is_alive = yes
NOT = { exists = house }
}
set_house = scope:merchant_title_house
}
}
# Create a new title
create_dynamic_title = {
name = merchant_name_001
tier = county
type = title_type_merchant_family
holder = scope:new_merchant
article = DEFAULT_TITLE_NAME_ARTICLE
save_scope_as = the_new_title
}
}
remove_variable = pending_merchant_creation_reason
remove_variable = pending_merchant_flavor_char
# Destroy laamp title
if = {
limit = {
any_held_title = { has_variable = adventurer_creation_reason }
}
destroy_laamp_effect = { ADVENTURER = scope:new_merchant }
}As written in game/common/scripted_effects/gdp_merchant_scripted_effects.txt.
The first 120 of its 382 lines; the rest is in game/common/scripted_effects/gdp_merchant_scripted_effects.txt from line 1527.
Where it is used
Every place in common/, events/ and history/ that calls create_merchant_title_effect.
Character interactions (1)
Events (6)
- A Path Paved with Gold
gdp_merchant.0001 - Enemy of the State
overthrow_government_outcome.1004 - gdp_decision.3001
- gdp_merchant.4001
- Overthrown
overthrow_government_outcome.1003 - The Withering of Righteousness
bookmark.0500
On actions (the game's own hooks) (1)
- on_ruler_designer_finished
Source: game/common/scripted_effects/gdp_merchant_scripted_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.21.0.