Wiki

effect · remove_all_power_balance_modifiers

Definition

  • Supported scope:any
  • Supported target:none

Description

removes all static modifiers from power balance

Example:
remove_all_power_balance_modifiers = {
	id = power_balance_id
}

实战 · 配合 · 坑

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

实战用法

当 mod 中的权力平衡事件链结束(如某一方势力彻底胜利或意识形态斗争告终)时,需要一次性清除该权力平衡上所有残留的静态修饰符,避免旧修饰符污染后续新事件链的数值逻辑。例如在一个"内战结束"事件的 immediate 块中:

immediate = {
    remove_all_power_balance_modifiers = {
        id = civil_war_power_balance
    }
}

配合关系

  • [add_power_balance_modifier](/wiki/effect/add_power_balance_modifier):清除旧修饰符后,紧接着添加新的修饰符,实现权力平衡状态的"重置再初始化"流程。
  • [remove_power_balance_modifier](/wiki/effect/remove_power_balance_modifier):若只需精准移除某一个修饰符而非全部,可与本命令配合分阶段清理,先批量清除再单独补回需要保留的那条。
  • [has_power_balance_modifier](/wiki/trigger/has_power_balance_modifier):在执行批量清除前,通过该触发器确认目标修饰符确实存在,避免在日志中产生无效操作警告。
  • [add_power_balance_value](/wiki/effect/add_power_balance_value):清除所有修饰符后同步重置权力平衡的当前数值,确保平衡值与修饰符状态保持一致。

常见坑

  1. id 填写错误或遗漏:该命令必须通过 id 指定目标权力平衡,填写的 id 必须与 power_balance 定义文件中的键名完全一致,拼写错误会导致命令静默失败,修饰符并不会被移除。
  2. 误以为会同时重置数值:本命令只移除静态修饰符,不会改变权力平衡的当前数值本身;若需要同步归零数值,必须额外调用 add_power_balance_value 手动调整,否则数值会保留在被清除前修饰符所影响的状态。

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

When a power balance event chain in your mod concludes (such as one faction achieving complete victory or an ideological struggle ending), you need to clear all residual static modifiers on that power balance in one operation to prevent old modifiers from contaminating the numerical logic of subsequent new event chains. For example, in the immediate block of a "civil war ended" event:

immediate = {
    remove_all_power_balance_modifiers = {
        id = civil_war_power_balance
    }
}

Synergy

  • [add_power_balance_modifier](/wiki/effect/add_power_balance_modifier): After clearing old modifiers, immediately add new ones to implement a "reset and reinitialize" workflow for power balance states.
  • [remove_power_balance_modifier](/wiki/effect/remove_power_balance_modifier): If you need to remove only a specific modifier rather than all of them, you can coordinate with this command to clean up in stages—do a batch removal first, then selectively restore the modifiers you want to keep.
  • [has_power_balance_modifier](/wiki/trigger/has_power_balance_modifier): Before executing batch removal, use this trigger to confirm that the target modifier actually exists, avoiding spurious operation warnings in the logs.
  • [add_power_balance_value](/wiki/effect/add_power_balance_value): After clearing all modifiers, synchronously reset the power balance's current value to ensure the balance value remains consistent with the modifier state.

Common Pitfalls

  1. Incorrect or missing id specification: This command must specify the target power balance via id, and the id you provide must exactly match the key name in the power_balance definition file. Spelling errors will cause the command to fail silently, and modifiers will not be removed.
  2. Mistakenly assuming it resets the value as well: This command only removes static modifiers and does not change the power balance's current value itself. If you need to synchronously reset the value to zero, you must additionally call add_power_balance_value to manually adjust it, otherwise the value will remain in whatever state the cleared modifiers had influenced.