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

merchant_trade_opportunity_save_lost_reason_effect

merchant_trade_opportunity_save_lost_reason_effect = yes

game/common/scripted_effects/gdp_merchant_scripted_effects.txt, line 1949 (220 lines). No parameters.

merchant_trade_opportunity_save_lost_reason_effect is a scripted effect in Crusader Kings III, in the Silk and Silver files, written at line 1949 of its file. It takes no parameters: merchant_trade_opportunity_save_lost_reason_effect = yes. The game's script calls it in 1 place, among them merchant_trade_opportunity_contract_invalidated_message_effect (scripted effect). Patch 1.21.0, from game/common/scripted_effects/gdp_merchant_scripted_effects.txt.

What it does

Every line of it is script with no tooltip text: the script is below.

The script as written (120 lines of game script)
merchant_trade_opportunity_save_lost_reason_effect = {
	if = {
		limit = {
			NOT = { exists = var:trade_opportunity_lost_reason }
		}
		if = {
			limit = {
				NOT = { exists = var:task_contract_route }
			}
			set_variable = {
				name = trade_opportunity_lost_reason
				value = flag:route_destroyed
			}
		}
		else_if = {
			limit = {
				OR = {
					# Employer death invalidates in code while the route can still name that same character.
					task_contract_employer = { is_alive = no }
					NOT = { var:task_contract_route.trader ?= task_contract_employer }
				}
			}
			set_variable = {
				name = trade_opportunity_lost_reason
				value = flag:trader_changed
			}
		}
		else_if = {
			limit = {
				exists = var:task_contract_market
				var:task_contract_route = {
					NOT = {
						any_trade_market_on_route = {
							this = root.var:task_contract_market
						}
					}
				}
			}
			set_variable = {
				name = trade_opportunity_lost_reason
				value = flag:market_left_route
			}
		}
		else_if = {
			limit = {
				OR = {
					has_task_contract_type = exploit_upheaval
					has_task_contract_type = alleviate_upheaval
				}
				var:task_contract_route = {
					NOT = {
						any_trade_market_on_route = {
							exploit_upheaval_market_modifier_trigger = yes
						}
					}
				}
			}
			set_variable = {
				name = trade_opportunity_lost_reason
				value = flag:upheaval_ended
			}
		}
		else_if = {
			limit = {
				has_task_contract_type = support_guilds
				task_contract_taker = {
					NOT = { has_realm_law = company_purpose_artisan }
				}
			}
			set_variable = {
				name = trade_opportunity_lost_reason
				value = flag:purpose_artisan
			}
		}
		else_if = {
			limit = {
				has_task_contract_type = seek_debtors
				task_contract_taker = {
					NOT = { has_realm_law = company_purpose_creditor }
				}
			}
			set_variable = {
				name = trade_opportunity_lost_reason
				value = flag:purpose_creditor
			}
		}
		else_if = {
			limit = {
				OR = {
					has_task_contract_type = challenge_competitor
					has_task_contract_type = sabotage_competition
					has_task_contract_type = disrupt_charter
				}
				NOT = {
					task_contract_target.house.house_head ?= {
						gdp_is_merchant_or_unlanded_patrician_trigger = yes
						house != root.task_contract_taker.house
					}
				}
			}
			set_variable = {
				name = trade_opportunity_lost_reason
				value = flag:competitor_gone
			}
		}
		else_if = {
			limit = {
				has_task_contract_type = disrupt_charter
				NOT = {
					task_contract_target.house.house_head ?= {
						merchant_has_charter_from_patron_trigger = {
							EQUIPPED = no
							INCLUDE_FORGERIES = yes
						}
					}
				}
			}
			set_variable = {
				name = trade_opportunity_lost_reason
				value = flag:charter_gone

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

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

Where it is used

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

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?