Wiki

effect · clear_rule

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Cleares rule added by set_rule. In the example it will clear can_not_declare_war = yes set by set_rule : 
clear_rule = { 
 can_not_declare_war = yes 
}

实战 · 配合 · 坑

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

实战用法

clear_rule 常用于国家焦点、事件选项或决议的后续逻辑中,用来撤销之前通过 set_rule 施加的行为限制,例如在外交危机缓和后解除宣战禁令,或在特定任务结束后恢复国家的正常行动能力。注意该 effect 的参数写法与 set_rule 完全镜像,填写你想要清除的那条规则即可。

# 某事件选项:外交危机解除,恢复宣战能力
option = {
    name = my_event.1.a
    clear_rule = {
        can_not_declare_war = yes
    }
}

配合关系

  • [has_active_rule](/wiki/trigger/has_active_rule):在清除规则前先用此触发器检测该规则是否仍处于激活状态,避免无效调用或逻辑混乱。
  • [add_political_power](/wiki/effect/add_political_power):常在同一事件选项中配合使用,表示国家付出政治资本换取行动自由(如解除宣战限制)。
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier):规则清除后往往伴随外交关系变化,用此命令同步调整与相关国家的关系修正。
  • [country_event](/wiki/effect/country_event):清除规则后触发后续事件,用于构建多阶段剧情链,保证叙事连贯性。

常见坑

  1. 规则名或值写错导致无法清除clear_rule 的子块内容必须与当初 set_rule 时完全一致(包括规则名和值),若拼写不符,游戏不会报错但规则依然保留,新手极易忽略这一点。
  2. scope 使用错误clear_rule 只能在 COUNTRY scope 下执行,若在 STATE 或 CHARACTER scope 中调用(例如写在某个单位领袖的 effect 块里而未切换回国家 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

clear_rule is commonly used in country focuses, event options, or decision follow-up logic to revoke behavior restrictions previously imposed via set_rule. For example, it can lift a war declaration ban after a diplomatic crisis is resolved, or restore a nation's normal action capabilities after a specific objective is completed. Note that the parameter syntax of this effect mirrors set_rule exactly—simply specify the rule you want to clear.

# Event option: Diplomatic crisis resolved, restore war declaration capability
option = {
    name = my_event.1.a
    clear_rule = {
        can_not_declare_war = yes
    }
}

Synergy

  • [has_active_rule](/wiki/trigger/has_active_rule): Use this trigger to check if a rule is still active before clearing it, preventing invalid calls or logic conflicts.
  • [add_political_power](/wiki/effect/add_political_power): Often used in tandem within the same event option, representing a nation spending political capital in exchange for freedom of action (such as lifting war restrictions).
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier): After a rule is cleared, diplomatic relationship shifts typically follow. Use this command to synchronize adjustments to opinion modifiers with relevant nations.
  • [country_event](/wiki/effect/country_event): Trigger subsequent events after clearing a rule to construct multi-stage narrative chains and maintain narrative coherence.

Common Pitfalls

  1. Misspelling the rule name or value prevents clearing: The contents of the clear_rule sub-block must match exactly what was specified in the original set_rule call (including both the rule name and value). If the spelling does not match, the game will not report an error but the rule will remain in effect—a mistake newcomers frequently overlook.
  2. Incorrect scope usage: clear_rule can only be executed within a COUNTRY scope. If invoked in a STATE or CHARACTER scope (for example, written in a unit leader's effect block without switching back to country scope), the script will silently fail.