Wiki

effect · force_update_dynamic_modifier

Definition

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

Description

updates the modifiers in current scope (use if you don't want to wait for daily update to update them):
force_update_dynamic_modifier = yes

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 you modify the dynamic modifiers of a scope via add_dynamic_modifier or remove_dynamic_modifier, the game by default waits until the daily update tick to recalculate the actual effects. If your mod logic requires the modifier to take effect immediately within the same event/decision chain (for example, subsequent triggers need to read its values), you should call this effect immediately after the operation completes. A typical scenario is in an event option where you first remove an old dynamic modifier from a country, add a new dynamic modifier, then force refresh to ensure both the UI and subsequent scripts see the latest state.

option = {
    name = my_event.1.a
    remove_dynamic_modifier = { modifier = old_war_economy }
    add_dynamic_modifier = { modifier = new_war_economy }
    force_update_dynamic_modifier = yes   # Takes effect immediately, no waiting for daily tick
}

Synergy

  • [add_dynamic_modifier](/wiki/effect/add_dynamic_modifier): After adding a dynamic modifier, this command is typically called immediately after to ensure the newly added modifier is factored into calculations immediately, rather than taking effect on the next tick.
  • [remove_dynamic_modifier](/wiki/effect/remove_dynamic_modifier): After removing a dynamic modifier, a force refresh is equally necessary; otherwise, the old modifier's values remain considered valid within the current frame.
  • [has_dynamic_modifier](/wiki/trigger/has_dynamic_modifier): If subsequent triggers need to check whether a dynamic modifier exists or its variables have been updated, you must first refresh via this effect to ensure the check result is accurate.

Common Pitfalls

  1. Forgetting to call leads to value lag: After modifying dynamic modifiers within the same execution block, if subsequent logic (such as trigger checks within the same hidden_effect or UI feedback) depends on the modifier result but fails to include force_update_dynamic_modifier = yes, you'll experience an illusion of "changed but not applied," which is extremely difficult to debug.
  2. Overuse in places with no modifier changes: This command forces a recalculation of all dynamic modifiers for the current scope. Calling it unconditionally and frequently across many scopes or in daily pulses produces unnecessary performance overhead; it should only be called when there are actual modifier changes and immediate effect is required.