Wiki

effect · remove_relation_rule_override

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS

Description

Removes an override rule to the country's relation to other countries.The desc key can be used to supply a custom description for the effect when a named trigger is used as key
Alternative 1:
remove_relation_rule_override = { 
 target = GER # [Required] Target country can_not_declare_war = yes 
}
Alternative 2:
remove_relation_rule_override = { 
 trigger = is_democratic_country # [Required] Named trigger can_not_declare_war = yes 
}

实战 · 配合 · 坑

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

实战用法

remove_relation_rule_override 常用于撤销之前通过 add_relation_rule_override 设置的外交关系限制,例如当某个事件结束或国策完成后,解除对特定国家或一类国家(如所有民主国家)宣战的禁令。典型场景:和平协议事件触发后,移除曾经强制约束 AI 不对某目标宣战的规则,让外交逻辑恢复正常。

# 当和平条约到期事件触发时,解除对德国的宣战限制
country_event = {
    id = my_mod.42
    option = {
        name = my_mod.42.a
        remove_relation_rule_override = {
            target = GER
            can_not_declare_war = yes
        }
    }
}

配合关系

  • [add_relation_rule_override](/wiki/effect/add_relation_rule_override):这是配套的添加命令,通常先用 add 设定规则、后用 remove 撤销,形成完整的外交限制生命周期管理。
  • [has_active_rule](/wiki/trigger/has_active_rule):在执行移除前先用此触发器判断该规则是否确实存在,避免在规则未被添加时执行无效移除造成逻辑混乱。
  • [diplomatic_relation](/wiki/effect/diplomatic_relation):同样用于修改两国之间的外交状态,常与规则覆盖的添加/移除搭配,一起构建复杂的外交事件链。
  • [has_completed_focus](/wiki/trigger/has_completed_focus):常作为移除规则的前置条件,当特定国策完成后触发撤销,使外交限制与国策树进度绑定。

常见坑

  1. 移除时字段必须与添加时完全一致targettrigger 的值以及具体的规则字段(如 can_not_declare_war)必须与 add_relation_rule_override 中写的完全对应,若字段不匹配则移除不会生效,原有限制仍然存在,但游戏不会报错,导致规则"幽灵残留"难以排查。
  2. targettrigger 不可混用:添加时用了 target = GER(针对具体国家),移除时却写成 trigger = is_democratic_country,两者属于不同类型的 override 条目,不能互相抵消,必须用同种方式才能正确移除对应规则。

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

remove_relation_rule_override is commonly used to revoke diplomatic relationship restrictions previously set via add_relation_rule_override. For example, when an event concludes or a focus completes, you can lift prohibitions on declaring war against specific countries or groups of countries (such as all democratic nations). Typical scenario: after a peace agreement event triggers, remove rules that previously forced the AI not to declare war on a target, allowing normal diplomatic logic to resume.

# When a peace treaty expiration event fires, lift the war declaration restriction against Germany
country_event = {
    id = my_mod.42
    option = {
        name = my_mod.42.a
        remove_relation_rule_override = {
            target = GER
            can_not_declare_war = yes
        }
    }
}

Synergy

  • [add_relation_rule_override](/wiki/effect/add_relation_rule_override): This is the complementary add command. Typically you first use add to establish rules, then use remove to revoke them, forming a complete lifecycle for diplomatic restriction management.
  • [has_active_rule](/wiki/trigger/has_active_rule): Check whether the rule actually exists before executing removal using this trigger, avoiding ineffective removal operations when the rule hasn't been added, which could cause logical confusion.
  • [diplomatic_relation](/wiki/effect/diplomatic_relation): Also used to modify diplomatic state between two countries, commonly paired with rule override additions/removals to build complex diplomatic event chains.
  • [has_completed_focus](/wiki/trigger/has_completed_focus): Often serves as a prerequisite condition for rule removal. When a specific focus completes, it triggers revocation, binding diplomatic restrictions to focus tree progress.

Common Pitfalls

  1. Removal fields must exactly match addition fields: The values of target or trigger, and specific rule fields (such as can_not_declare_war) must correspond exactly to what was written in add_relation_rule_override. If fields don't match, the removal won't take effect and the original restriction remains, but the game won't report an error, causing "ghost rules" that are difficult to debug.
  2. target and trigger cannot be mixed: If you used target = GER (for a specific country) during addition, but write trigger = is_democratic_country during removal, these are different types of override entries and cannot cancel each other out. You must use the same method to correctly remove the corresponding rule.