Wiki

trigger · has_non_aggression_pact_with

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

Check if country has non aggression pact with the specified country

实战 · 配合 · 坑

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

实战用法

常用于外交事件或国家焦点的前提条件中,判断两国之间是否存在互不侵犯条约,从而决定是否触发特定的外交选项或解锁后续决议。例如在冷战 mod 里,可以用它来阻止玩家对签署了互不侵犯条约的国家宣战,或触发"撕毁条约"的剧情事件。

# 在国家焦点 available 中,要求与目标国存在互不侵犯条约才能执行
available = {
    has_non_aggression_pact_with = FROM
}

# 在事件 trigger 中,检测本国是否与苏联签有互不侵犯条约
trigger = {
    tag = GER
    has_non_aggression_pact_with = SOV
}

配合关系

  • [has_defensive_war_with](/wiki/trigger/has_defensive_war_with):互不侵犯条约的存在与否往往需要配合防御战检测,二者共同用于判断当前敌对关系是否与协议相悖。
  • [can_declare_war_on](/wiki/trigger/can_declare_war_on):在限制宣战的条件块中与本 trigger 配合,确保只有在互不侵犯条约不存在时才允许发动战争。
  • [has_country_flag](/wiki/trigger/has_country_flag):常搭配国旗标记使用,记录条约是否曾被单方面违背,为后续事件提供状态追踪依据。
  • [any_allied_country](/wiki/trigger/any_allied_country):用于遍历盟友时,与本 trigger 联合筛选出既是盟友、又与第三方签有互不侵犯条约的国家,辅助复杂外交逻辑判断。

常见坑

  1. scope 方向写反:本 trigger 的 scope 是发起检测的国家,target 是条约对方。新手容易把双方对调,导致在错误的国家 scope 下执行判断,结果始终返回假而不自知。
  2. 误以为可接受普通国家标签以外的写法:target 仅支持白名单中的代词(THISFROM 等)或具体国家标签,不能直接写州/省 scope 或其他非国家对象,否则脚本会静默失败而不报错。

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 the prerequisite conditions of diplomatic events or national focuses to determine whether a non-aggression pact exists between two nations, thereby deciding whether to trigger specific diplomatic options or unlock subsequent decisions. For example, in Cold War mods, it can be used to prevent players from declaring war on nations that have signed non-aggression pacts, or to trigger narrative events for "treaty violation."

# In a national focus available block, require a non-aggression pact with the target nation to execute
available = {
    has_non_aggression_pact_with = FROM
}

# In an event trigger, check if the current nation has a non-aggression pact with the Soviet Union
trigger = {
    tag = GER
    has_non_aggression_pact_with = SOV
}

Synergy

  • [has_defensive_war_with](/wiki/trigger/has_defensive_war_with): The presence or absence of a non-aggression pact often needs to be combined with defensive war detection; both are used together to determine whether the current hostile relationship conflicts with the agreement.
  • [can_declare_war_on](/wiki/trigger/can_declare_war_on): Works in conjunction with this trigger in war declaration restriction conditions to ensure that war can only be declared when no non-aggression pact exists.
  • [has_country_flag](/wiki/trigger/has_country_flag): Frequently paired with country flags to record whether a treaty has been unilaterally violated, providing status tracking for subsequent events.
  • [any_allied_country](/wiki/trigger/any_allied_country): When iterating through allies, combined with this trigger to filter out nations that are both allies and have non-aggression pacts with a third party, assisting in complex diplomatic logic judgment.

Common Pitfalls

  1. Reversing the scope direction: The scope of this trigger is the nation initiating the check, and the target is the treaty counterparty. Beginners often swap the two sides, causing the judgment to execute under the wrong nation scope, always returning false without realizing it.
  2. Assuming it accepts notation beyond standard country tags: The target only supports pronouns from the whitelist (THIS, FROM, etc.) or concrete country tags; it cannot directly reference state/province scopes or other non-nation objects, otherwise the script will silently fail without error reporting.