Wiki

effect · set_truce

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Sets a truce between scope country and target for days duration. 
Example set_truce = { target = GER days = 90 }

实战 · 配合 · 坑

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

实战用法

set_truce 常用于外交事件结算后强制双方进入停火状态,例如和平谈判 event 结束时阻止玩家或 AI 立即再次宣战,或在内战结束脚本中为分裂双方设置冷静期。以下示例在德国接受停战协议后,对法国设置 90 天休战:

country_event = {
    id = my_mod.1
    option = {
        name = my_mod.1.a
        set_truce = {
            target = FRA
            days = 90
        }
    }
}

配合关系

  • [declare_war_on](/wiki/effect/declare_war_on):常在逻辑上配对使用——用 set_truce 结束一段冲突周期后,若后续剧本需要触发新战争,需等待休战到期,配合此命令规划剧本战争节点。
  • [create_wargoal](/wiki/effect/create_wargoal):休战期间积累战争借口,休战结束后配合此命令让 AI 或玩家拥有合法的宣战理由,形成完整的外交-冲突循环。
  • [has_country_flag](/wiki/trigger/has_country_flag):通过国旗记录休战是否已被设置,避免事件重复触发导致 set_truce 被多次调用,维护脚本状态的幂等性。
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier):在 set_truce 同一 option 块中调用,给双方添加外交态度加成,模拟停战带来的关系缓和。

常见坑

  1. Scope 混淆set_truce 必须在 COUNTRY scope 下执行,target 填写的是对方国家 tag;新手容易在 STATE scope 的事件块中直接调用,导致脚本报错或静默失效,需确认执行上下文确实是国家 scope。
  2. 双向生效误解:该 effect 会在双方之间同时建立休战,但脚本只需在一方国家 scope 中调用一次,若在双方各自的 option 里分别调用则会重复设置(天数以最后一次为准或产生异常),注意不要重复执行。

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

set_truce is commonly used to force both parties into a ceasefire state after diplomatic event resolution, such as preventing the player or AI from immediately declaring war again when a peace negotiation event concludes, or establishing a cooldown period between opposing factions at the end of a civil war script. The following example sets a 90-day truce with France after Germany accepts a ceasefire agreement:

country_event = {
    id = my_mod.1
    option = {
        name = my_mod.1.a
        set_truce = {
            target = FRA
            days = 90
        }
    }
}

Synergy

  • [declare_war_on](/wiki/effect/declare_war_on): Commonly paired in logical sequences—after using set_truce to end a conflict cycle, if subsequent scripting requires triggering a new war, you must wait for the truce to expire before combining with this command to plan scripted warfare nodes.
  • [create_wargoal](/wiki/effect/create_wargoal): Accumulate war justifications during the truce period, then combine with this command after the truce expires to give the AI or player legitimate reasons to declare war, forming a complete diplomatic-conflict loop.
  • [has_country_flag](/wiki/trigger/has_country_flag): Track whether a truce has been set via country flags to avoid repeated event triggers that would call set_truce multiple times, maintaining script state idempotency.
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier): Call within the same option block as set_truce to grant both parties diplomatic attitude bonuses, simulating the relationship improvement brought by the ceasefire.

Common Pitfalls

  1. Scope Confusion: set_truce must be executed within a COUNTRY scope, with target specifying the opposing nation's tag. Beginners often call it directly within STATE scope event blocks, resulting in script errors or silent failures. You must verify the execution context is indeed a country scope.
  2. Bilateral Effect Misconception: This effect establishes a truce simultaneously between both parties, but the script only needs to be called once within one nation's scope. If called separately in both parties' options, it will result in duplicate settings (with the day count determined by the last call or producing anomalies). Avoid redundant execution.