Hands-On Usage
This effect is commonly used in occupation system mods. For example, after establishing a puppet state or triggering specific events, you can dynamically adjust the resistance or compliance modifier of an occupied state, thereby simulating narrative effects such as "successful suppression operations" or "winning hearts and minds" in-game. Note that the modifier being referenced must be pre-defined in resistance_modifiers.txt or compliance_modifiers.txt and marked with is_dynamic = yes, otherwise the effect will not take effect.
# In an event option, apply a dynamic compliance modifier to a specified state
option = {
name = pacification_event.1.a
add_state_resistance_compliance_modifier = {
modifier = pacification_boost_modifier
state = 42
}
}
Synergy
[remove_state_resistance_compliance_modifier](/wiki/effect/remove_state_resistance_compliance_modifier): Used in tandem with this command to remove the modifier when it is no longer needed, preventing dynamic modifiers from stacking permanently and causing numerical anomalies.
[if](/wiki/effect/if): Wraps this command to conditionally apply the modifier based on the current situation (such as resistance strength or population loyalty variables), improving logical precision.
[set_variable](/wiki/effect/set_variable) / [check_variable](/wiki/trigger/check_variable): Track whether a modifier has already been added via variables, combined with conditional checks to prevent duplicate stacking of the same dynamic modifier.
[custom_effect_tooltip](/wiki/effect/custom_effect_tooltip): Display a human-readable explanation in the UI to players when this modifier is added, since the dynamic modifier name itself is not intuitive to players.
Common Pitfalls
- Modifier not marked with
is_dynamic = yes: Newcomers often directly reference standard resistance/compliance modifiers, but this command only supports modifiers explicitly marked as is_dynamic = yes in the corresponding txt files. Without the marking, the effect fails silently without error messages, making it extremely difficult to debug.
- Incorrect or missing
state field: The state field must specify a valid state ID. Even if the current scope is already a state scope, you still cannot omit this field—the command will not automatically inherit the current scope as the target state.