CK3 DatabaseCrusader Kings III · 1.21.0 “Florin” · unofficial
Silk & Silverout Tue, Nov 17What's free, what needs the DLC, price →Merch→

Scripted effect · Silk and Silver files

gdp_evict_merchant_from_realm_effect

gdp_evict_merchant_from_realm_effect = { EXPELLER = … MERCHANT = … }

game/common/scripted_effects/gdp_merchant_scripted_effects.txt, line 7596 (187 lines). Parameters: $EXPELLER$, $MERCHANT$.

gdp_evict_merchant_from_realm_effect is a scripted effect in Crusader Kings III, in the Silk and Silver files, written at line 7596 of its file. A call passes 2 parameters: EXPELLER and MERCHANT. The game's script calls it in 1 place, among them Evict Merchant (interaction). Its body carries 1 text of the game's own for the player. Patch 1.21.0, from game/common/scripted_effects/gdp_merchant_scripted_effects.txt.

The comment above it in the file

Force a Merchant Company out of the Expeller's realm and under a new Patron

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)
gdp_evict_merchant_from_realm_effect = {
	$MERCHANT$ = { save_temporary_scope_as = merchant }
	$EXPELLER$ = { save_scope_as = expeller }
	scope:merchant.suzerain ?= { save_temporary_scope_as = old_patron }
	if = {
		limit = { NOT = { exists = scope:old_patron } }
		scope:expeller = { save_temporary_scope_as = old_patron }
	}
	scope:expeller.top_liege = { save_temporary_scope_as = expelled_realm }
	scope:merchant.domicile.domicile_location = { save_temporary_scope_as = origin_province }

	# Prefer a neighboring realm county with a trade market
	scope:expeller = {
		random_neighboring_and_across_water_top_liege_realm_owner = {
			limit = {
				NOT = { this = scope:expelled_realm }
				is_landed = yes
				any_realm_county = {
					exists = title_province.barony.trade_market
					NOT = { holder.top_liege = scope:expelled_realm }
				}
			}
			save_temporary_scope_as = destination_realm_owner
			random_realm_county = {
				limit = {
					exists = title_province.barony.trade_market
					NOT = { holder.top_liege = scope:expelled_realm }
				}
				weight = {
					base = 1
					modifier = { add = prosperity_level }
				}
				holder = { save_temporary_scope_as = new_patron }
				title_province = { save_temporary_scope_as = eviction_destination }
			}
		}
	}

	# Fallback: neighboring county title with a trade market outside the realm
	if = {
		limit = {
			NOR = {
				exists = scope:eviction_destination
				exists = scope:new_patron
			}
		}
		scope:expeller = {
			random_character_to_title_neighboring_and_across_water_county = {
				limit = {
					exists = title_province.barony.trade_market
					exists = holder
					NOT = { holder.top_liege = scope:expelled_realm }
				}
				holder = { save_temporary_scope_as = new_patron }
				title_province = { save_temporary_scope_as = eviction_destination }
			}
		}
	}

	# Last resort: nearest empire de jure county with a trade market outside the realm
	if = {
		limit = {
			NOR = {
				exists = scope:eviction_destination
				exists = scope:new_patron
			}
			exists = scope:origin_province
		}
		ordered_empire = {
			limit = {
				any_de_jure_county = {
					exists = title_province.barony.trade_market
					exists = holder
					NOT = { holder.top_liege = scope:expelled_realm }
				}
			}
			order_by = {
				title_capital_county = { add = "squared_distance(scope:origin_province)" }
				multiply = -1
			}
			random_de_jure_county = {
				limit = {
					exists = title_province.barony.trade_market
					exists = holder
					NOT = { holder.top_liege = scope:expelled_realm }
				}
				holder = { save_temporary_scope_as = new_patron }
				title_province = { save_temporary_scope_as = eviction_destination }
			}
		}
	}

	if = {
		limit = {
			exists = scope:merchant
			exists = scope:expeller
			exists = scope:new_patron
			exists = scope:eviction_destination
			exists = scope:eviction_destination.barony.trade_market
		}
		# Destroy any charter granted by the expeller
		if = {
			limit = {
				scope:old_patron ?= scope:expeller
				scope:merchant = {
					merchant_has_charter_from_patron_trigger = {
						EQUIPPED = no
						INCLUDE_FORGERIES = yes
					}
				}
			}
			merchant_charter_destroy_held_charters_effect = {
				MERCHANT = scope:merchant
				PATRON = scope:expeller
			}
		}
		scope:merchant = {
			add_opinion = {
				target = scope:expeller
				modifier = demanded_eviction_opinion

As written in game/common/scripted_effects/gdp_merchant_scripted_effects.txt.

The first 120 of its 187 lines; the rest is in game/common/scripted_effects/gdp_merchant_scripted_effects.txt from line 7596.

Where it is used

Every place in common/, events/ and history/ that calls gdp_evict_merchant_from_realm_effect.

Character interactions (1)

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.

Spotted a mistake on this page, or have an idea for the site?