trigger · buyer
Definition
- Supported scope:
PURCHASE_CONTRACT - Supported target:
THIS,ROOT,PREV,FROM,OWNER,CONTROLLER,OCCUPIED,CAPITAL
Description
Check the buyer country. Example: buyer = GER
buyerPURCHASE_CONTRACTTHIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITALCheck the buyer country. Example: buyer = GER
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
buyer 常用于购买合同相关的事件或决策中,检查发起采购的一方是否为特定国家,从而实现"只允许特定买家触发后续效果"或"针对不同买家给出不同响应"的逻辑。例如,在军火贸易 mod 中可以限制仅当买家是盟国时合同才能生效:
# 在 PURCHASE_CONTRACT scope 下的 trigger 块中
trigger = {
buyer = GER
contract_contains_equipment = { equipment = fighter_equipment_1 }
}
[seller](/wiki/trigger/seller):配合 buyer 同时检查买卖双方,用于筛选特定国家之间的合同关系,常见于"只允许轴心国内部武器交易"类场景。[contract_contains_equipment](/wiki/trigger/contract_contains_equipment):在确认买方身份的同时检查合同内装备类型,二者组合才能精确定位一笔合同。[deal_completion](/wiki/trigger/deal_completion):在确认买方后再判断交易是否已完成,避免对进行中的合同执行本应只在成交后触发的逻辑。[cancel_purchase_contract](/wiki/effect/cancel_purchase_contract):当 buyer 检查未通过(即买方不符合条件)时,配合该 effect 取消不合规的合同。buyer 只能在 PURCHASE_CONTRACT scope 下调用,新手容易把它写在国家 scope(如直接写在 GER = { trigger = { buyer = ... } } 中),导致脚本报错或静默失效,务必确认当前 scope 已进入购买合同对象。buyer 右侧填写的是国家标签(如 GER),而非 THIS/ROOT 这类相对引用,新手有时误写成 buyer = THIS 试图指代当前 scope,实际上 THIS 此时指向的是合同本身而非国家,逻辑不会如预期生效。Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.
buyer is commonly used in events or decisions related to purchase contracts, checking whether the initiating party of a procurement is a specific nation, thereby implementing logic such as "only allow specific buyers to trigger subsequent effects" or "provide different responses for different buyers". For example, in an arms trading mod you can restrict a contract to only take effect when the buyer is an ally:
# In the trigger block under PURCHASE_CONTRACT scope
trigger = {
buyer = GER
contract_contains_equipment = { equipment = fighter_equipment_1 }
}
[seller](/wiki/trigger/seller): Used together with buyer to check both parties in a transaction, useful for filtering contract relationships between specific nations, commonly seen in scenarios like "only allow weapon trades within the Axis powers".[contract_contains_equipment](/wiki/trigger/contract_contains_equipment): While confirming the buyer's identity, also check the equipment types in the contract; combining these two allows precise identification of a specific deal.[deal_completion](/wiki/trigger/deal_completion): After confirming the buyer, then judge whether the transaction has been completed, avoiding executing logic on ongoing contracts that should only trigger after the deal is finalized.[cancel_purchase_contract](/wiki/effect/cancel_purchase_contract): When the buyer check fails (i.e., the buyer doesn't meet conditions), use this effect in combination to cancel non-compliant contracts.buyer can only be called under the PURCHASE_CONTRACT scope. Beginners often mistakenly write it in a country scope (such as directly in GER = { trigger = { buyer = ... } }), causing script errors or silent failures. Always verify that the current scope has entered a purchase contract object.buyer takes a country tag (such as GER), not relative references like THIS/ROOT. Beginners sometimes mistakenly write buyer = THIS trying to reference the current scope, but THIS in this context actually points to the contract itself rather than a nation, so the logic won't work as intended.