Wiki

effect · finalize_border_war

Definition

  • Supported scope:any
  • Supported target:none

Description

finalizes border war between two states, wins or cancels it

实战 · 配合 · 坑

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

实战用法

finalize_border_war 常用于 mod 中设计边境战争的结算逻辑,例如在某一方达成特定条件(人员伤亡阈值、外交事件触发)后强制终结边境冲突,而不依赖原版的自动判定流程。典型场景是在事件的 option 块中,玩家选择"接受停火"后立即结算或取消边境战争。

# 某停火事件的选项块
option = {
    name = border_war_event.1.a
    trigger = {
        has_border_war_between = {
            state_a = 42
            state_b = 67
        }
    }
    finalize_border_war = yes
    custom_effect_tooltip = border_war_ceasefire_tt
}

配合关系

  • [has_border_war_between](/wiki/trigger/has_border_war_between):在执行结算前用于判断指定两州之间当前是否存在边境战争,避免在无边境战争时触发导致报错或逻辑异常。
  • [cancel_border_war](/wiki/effect/cancel_border_war):两者都能终止边境战争,但语义不同;cancel_border_war 是无条件撤销,而 finalize_border_war 会触发正式结算判定,二者根据 mod 需要的结算方式选一使用,不应同时对同一边境战争调用。
  • [set_border_war_data](/wiki/effect/set_border_war_data):通常在边境战争开始后动态调整战争数据,与 finalize_border_war 配合构成"设置参数 → 结算"的完整流程。
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip):由于 finalize_border_war 本身不产生可读的提示文本,在 UI 层面需要用它补充玩家可见的效果说明。

常见坑

  1. 未检查边境战争是否存在就直接调用:若目标州之间并不存在活跃的边境战争,直接执行 finalize_border_war 可能导致脚本错误或静默失败,务必先用 has_border_war_between 做条件保护。
  2. scope 理解偏差导致结算对象不明确:该 effect 支持 any scope,但实际结算的是哪场边境战争取决于上下文(如 start_border_war 中设置的州),若 mod 中存在多场并发边境战争,需确保当前执行上下文能唯一定位到目标边境战争,否则结算行为可能与预期不符。

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

finalize_border_war is commonly used in mods to design border war settlement logic, such as forcing termination of a border conflict after one side meets specific conditions (casualty thresholds, triggered diplomatic events), without relying on vanilla's automatic determination process. Typical scenarios occur in the option block of an event, where the player's selection of "accept ceasefire" immediately settles or cancels the border war.

# Option block of a ceasefire event
option = {
    name = border_war_event.1.a
    trigger = {
        has_border_war_between = {
            state_a = 42
            state_b = 67
        }
    }
    finalize_border_war = yes
    custom_effect_tooltip = border_war_ceasefire_tt
}

Synergy

  • [has_border_war_between](/wiki/trigger/has_border_war_between): Use before executing settlement to check whether a border war currently exists between the specified two states, preventing errors or logical anomalies from triggering when no border war is present.
  • [cancel_border_war](/wiki/effect/cancel_border_war): Both can terminate border wars, but with different semantics; cancel_border_war is unconditional revocation, while finalize_border_war triggers formal settlement determination. Choose one based on your mod's settlement requirements; do not call both on the same border war.
  • [set_border_war_data](/wiki/effect/set_border_war_data): Typically used to dynamically adjust war data after a border war begins, forming a complete "set parameters → settle" workflow when combined with finalize_border_war.
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip): Since finalize_border_war itself does not generate readable tooltip text, you must use this to supplement player-visible effect descriptions at the UI level.

Common Pitfalls

  1. Calling without checking whether the border war exists: If no active border war exists between the target states, executing finalize_border_war directly may cause script errors or silent failures. Always protect with a has_border_war_between condition check first.
  2. Scope misunderstanding leading to unclear settlement targets: This effect supports any scope, but which border war is actually settled depends on context (such as the states set in start_border_war). If your mod has multiple concurrent border wars, ensure the current execution context can uniquely identify the target border war; otherwise, settlement behavior may not match expectations.