Wiki

trigger · contract_contains_equipment

Definition

  • Supported scope:PURCHASE_CONTRACT
  • Supported target:none

Description

Check if contract contains equipment category, equipment archetype or equipment.
Example:
    contract_contains_equipment = infantry_equipment

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

在贸易或军购 mod 中,常用于在采购合同触发某些事件或决议时,先验证合同内容是否符合条件,例如仅当合同涉及特定装备类别时才允许外交干预或触发事件。也可用于区分不同合同类型,给予不同的处理逻辑(如对步兵装备合同施加额外限制)。

# 仅当采购合同包含步兵装备时,才允许取消该合同
cancel_purchase_contract = {
    limit = {
        contract_contains_equipment = infantry_equipment
    }
}

配合关系

  • [buyer](/wiki/trigger/buyer):先用 buyer 确认合同买方是否为目标国家,再用本 trigger 检查装备类型,双重筛选精确定位合同。
  • [seller](/wiki/trigger/seller):与 seller 联用,可同时约束交易双方身份,避免误判其他国家之间的同类合同。
  • [cancel_purchase_contract](/wiki/effect/cancel_purchase_contract):条件满足后的典型后续动作,在 limit 块中用本 trigger 过滤,再执行取消合同操作。
  • [deal_completion](/wiki/trigger/deal_completion):与 deal_completion 搭配,可判断"包含特定装备且即将完成交割"的合同,用于触发交付事件。

常见坑

  1. scope 用错:本 trigger 必须在 PURCHASE_CONTRACT scope 内调用,若直接写在国家 scope 的 trigger 块中会静默失败或报错,需确保已通过合同迭代/事件正确进入合同 scope。
  2. 参数类型混淆:参数可以是装备类别、装备原型或具体装备,但填写时必须使用游戏内实际定义的 key(如 infantry_equipment 而非自创名称),拼写错误不会有明显报错,只会导致条件永远为假。

Hands-On Notes

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.

Hands-On Usage

Commonly used in trade and arms procurement mods to validate contract contents when procurement contracts trigger certain events or decisions. For example, you can restrict diplomatic intervention or event triggers only when the contract involves specific equipment categories. It can also distinguish between different contract types and apply different processing logic (such as imposing additional restrictions on infantry equipment contracts).

# Only allow cancellation of a purchase contract if it contains infantry equipment
cancel_purchase_contract = {
    limit = {
        contract_contains_equipment = infantry_equipment
    }
}

Synergy

  • [buyer](/wiki/trigger/buyer): Use buyer first to confirm whether the contract buyer is the target country, then use this trigger to check equipment type for dual-layer filtering and precise contract targeting.
  • [seller](/wiki/trigger/seller): When used together with seller, you can constrain both parties' identities simultaneously, avoiding false matches with similar contracts between other nations.
  • [cancel_purchase_contract](/wiki/effect/cancel_purchase_contract): The typical follow-up action after conditions are met. Use this trigger in the limit block to filter, then execute the contract cancellation.
  • [deal_completion](/wiki/trigger/deal_completion): Paired with deal_completion, this allows you to identify contracts that "contain specific equipment and are about to complete delivery," useful for triggering delivery events.

Common Pitfalls

  1. Incorrect scope: This trigger must be called within the PURCHASE_CONTRACT scope. If placed directly in a country scope's trigger block, it will fail silently or throw an error. Ensure you have properly entered the contract scope through contract iteration or events.
  2. Parameter type confusion: The parameter can be an equipment category, equipment prototype, or specific equipment, but you must use the actual in-game defined key when filling it in (such as infantry_equipment rather than custom names). Spelling errors won't produce obvious warnings but will cause the condition to always evaluate as false.