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
- 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.
- 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.