Wiki

effect · remove_dynamic_modifier

Definition

  • Supported scope:STATE, COUNTRY, CHARACTER, SPECIAL_PROJECT
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

removes a dynamic modifier from the containing scope (country / state / unit-leader / special-project).
example :
remove_dynamic_modifier = {
  modifier = dynamic_modifier_name
  scope = GER # optional, must match the scope input used in add_dynamic_modifier (if any)
}

实战 · 配合 · 坑

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

实战用法

remove_dynamic_modifier 常用于事件或决议到期时清除之前挂载的动态加成,例如移除因某国签订条约而获得的临时军事加成,或在角色死亡/离职时清理挂在该角色身上的特定动态修正。下面示例演示当一项决议完成后,移除挂在德国上的某个动态修正:

# 在 option 或 complete_effect 块中
GER = {
    remove_dynamic_modifier = {
        modifier = ger_rearmament_bonus
        scope = GER  # 若当初 add_dynamic_modifier 时传入了 scope,此处必须对应
    }
}

配合关系

  • [add_dynamic_modifier](/wiki/effect/add_dynamic_modifier) — 与之成对使用,先用 add_dynamic_modifier 挂载,再在适当时机用本命令移除,是动态修正生命周期管理的标准流程。
  • [force_update_dynamic_modifier](/wiki/effect/force_update_dynamic_modifier) — 当动态修正引用的变量已发生变化但尚未刷新时,先移除再重新添加后可配合此命令强制立即刷新数值。
  • [has_dynamic_modifier](/wiki/trigger/has_dynamic_modifier) — 在移除前用此触发器检查目标 scope 上是否确实存在该动态修正,避免对不存在的修正执行移除而产生警告日志。
  • [add_days_remove](/wiki/effect/add_days_remove) — 若希望动态修正在有限时间后自动消失,可在添加时配合 add_days_remove,而非手动用本命令移除,两种方案各有适用场景。

常见坑

  1. scope 参数必须与 add_dynamic_modifier 时一致:若添加时填写了 scope = GER,移除时若遗漏该参数,游戏将无法匹配到对应修正,导致移除静默失败,修正依然生效,极难排查。
  2. 在错误的 scope 下执行remove_dynamic_modifier 需要在与修正实际挂载的同类 scope(国家/州/角色/特殊项目)中调用;若修正挂在 STATE 上却在 COUNTRY scope 下执行移除,命令不会跨 scope 生效,需先切换至正确的 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

remove_dynamic_modifier is commonly used to clear previously applied dynamic modifiers when events or decisions expire—for example, removing temporary military bonuses granted by a treaty with another nation, or cleaning up modifier effects tied to a character upon their death or dismissal. The example below demonstrates removing a dynamic modifier from Germany after a decision completes:

# Within an option or complete_effect block
GER = {
    remove_dynamic_modifier = {
        modifier = ger_rearmament_bonus
        scope = GER  # If a scope was passed to add_dynamic_modifier originally, it must match here
    }
}

Synergy

  • [add_dynamic_modifier](/wiki/effect/add_dynamic_modifier) — Used as a paired command; apply the modifier with add_dynamic_modifier first, then remove it at the appropriate time with this command. This represents the standard workflow for dynamic modifier lifecycle management.
  • [force_update_dynamic_modifier](/wiki/effect/force_update_dynamic_modifier) — When variables referenced by a dynamic modifier have changed but the values haven't refreshed yet, removing and re-adding the modifier in conjunction with this command forces an immediate numerical update.
  • [has_dynamic_modifier](/wiki/trigger/has_dynamic_modifier) — Use this trigger to verify that the dynamic modifier actually exists on the target scope before removal, preventing warning logs from attempting to remove non-existent modifiers.
  • [add_days_remove](/wiki/effect/add_days_remove) — If you want a dynamic modifier to automatically expire after a set duration, pair add_days_remove when adding the modifier rather than manually removing it with this command. Both approaches have their appropriate use cases.

Common Pitfalls

  1. The scope parameter must match what was used in add_dynamic_modifier: If the modifier was added with scope = GER but the scope parameter is omitted during removal, the game cannot match the correct modifier, causing the removal to fail silently—the modifier remains active and becomes extremely difficult to debug.
  2. Executing in the wrong scope: remove_dynamic_modifier must be called within the same type of scope where the modifier is actually attached (country/state/character/special project). If a modifier is attached to a STATE but you attempt removal within a COUNTRY scope, the command will not take effect across scopes. You must first switch to the correct scope block before executing the command.