Wiki

trigger · has_border_war_with

Definition

  • Supported scope:STATE, COUNTRY
  • Supported target:any

Description

Checks if a there is a border against a state/country

实战 · 配合 · 坑

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

实战用法

has_border_war_with 常用于边境战争相关事件或决策的触发条件,例如判断某国是否正与特定邻国发生边境冲突,从而激活外交调停、增援或结束边境战争的决策链。在以下示例中,当一个国家与德国存在边境战争时,才允许触发某项决策:

available = {
    has_border_war_with = GER
}

也可以在 STATE scope 下检查某州是否正处于边境战争状态,用于限制建设或征兵类效果的触发。

配合关系

  • [has_border_war](/wiki/trigger/has_border_war):用于先检查当前是否存在任何边境战争(无需指定对象),再用 has_border_war_with 精确锁定具体交战方,两者常搭配形成层层筛选。
  • [divisions_in_border_state](/wiki/trigger/divisions_in_border_state):边境战争通常伴随兵力部署,配合使用可检查边境州的兵力数量,判断战事激烈程度。
  • [any_neighbor_country](/wiki/trigger/any_neighbor_country):当需要遍历所有邻国并逐一检查是否存在边境战争时,常将 has_border_war_with 嵌套在此 scope 内使用。
  • [declare_war_on](/wiki/effect/declare_war_on):边境战争结束后常接全面宣战逻辑,用 has_border_war_with 作为 limit 条件确保只在边境战争存在时才执行升级为正式战争的效果。

常见坑

  1. Scope 混用:新手容易在 COUNTRY scope 下写了针对 STATE 的判断逻辑(或反之),导致条件永远不满足。使用前务必确认当前脚本块所处的 scope 是 STATE 还是 COUNTRY,再决定 target 填写州 tag 还是国家 tag。
  2. 误以为可检测普通战争has_border_war_with 仅针对边境战争(Border War)机制,对通过 declare_war_on 发起的正式战争无效,若需检测正式战争应改用其他 trigger。

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

has_border_war_with is commonly used as a trigger condition in events or decisions related to border wars, such as determining whether a country is engaged in a border conflict with a specific neighbor, thereby activating decision chains for diplomatic mediation, reinforcement, or ending the border war. In the following example, a decision is only allowed to trigger when a country has an active border war with Germany:

available = {
    has_border_war_with = GER
}

It can also be used within STATE scope to check whether a state is currently in a border war, useful for restricting the triggering of construction or recruitment effects.

Synergy

  • [has_border_war](/wiki/trigger/has_border_war): Used to first check whether any border war currently exists (without specifying a target), then use has_border_war_with to precisely identify the specific belligerent. These two are often paired together to form layered filtering.
  • [divisions_in_border_state](/wiki/trigger/divisions_in_border_state): Border wars typically involve military deployments. Using them together allows you to check the number of divisions in border states and assess the intensity of the conflict.
  • [any_neighbor_country](/wiki/trigger/any_neighbor_country): When you need to iterate through all neighboring countries and check each one for active border wars, has_border_war_with is commonly nested within this scope.
  • [declare_war_on](/wiki/effect/declare_war_on): After a border war ends, a full declaration of war logic often follows. Use has_border_war_with as a limit condition to ensure the effect upgrades to formal war only when a border war exists.

Common Pitfalls

  1. Scope Confusion: Beginners often write logic for STATE scope checks within COUNTRY scope (or vice versa), causing conditions to never be satisfied. Always verify the current scope of your script block—whether it is STATE or COUNTRY—before deciding whether to fill the target with a state tag or a country tag.
  2. Mistaking It for Detecting Formal Wars: has_border_war_with only applies to the Border War mechanism and does not work for formal wars initiated through declare_war_on. If you need to detect formal wars, use other triggers instead.