Hands-On Usage
has_dynamic_modifier is commonly used to check whether a specific country, state, or character currently has a particular dynamic modifier attached, which determines the availability or trigger conditions of subsequent focuses, decisions, or events. For example, in an economic crisis system, players can only trigger a relief decision if the country has been assigned the "economic_collapse_modifier" dynamic modifier:
available = {
has_dynamic_modifier = economic_collapse_modifier
}
If the modifier has a target scope (i.e., a target country was specified during creation), use the syntax with the scope field to match precisely:
trigger = {
has_dynamic_modifier = {
modifier = foreign_pressure_modifier
scope = USA
}
}
Synergy
[add_dynamic_modifier](/wiki/effect/add_dynamic_modifier): The effect command for adding dynamic modifiers; typically use this to apply a modifier first, then use has_dynamic_modifier to check if it already exists, avoiding redundant stacking.
[remove_dynamic_modifier](/wiki/effect/remove_dynamic_modifier): When conditions are met, remove the modifier. has_dynamic_modifier serves as a precondition check to ensure the removal operation doesn't cause errors or unexpected behavior if the modifier doesn't exist.
[force_update_dynamic_modifier](/wiki/effect/force_update_dynamic_modifier): When dynamic modifier variable values change, a forced refresh is required. Combined with has_dynamic_modifier, you can confirm the modifier exists before calling the refresh, making the logic more robust.
[has_active_mission](/wiki/trigger/has_active_mission): In complex mission systems, dynamic modifier and active mission states are often checked simultaneously to determine whether a particular game phase is truly in effect.
Common Pitfalls
- Forgetting to specify the
scope field causes matching to fail: If add_dynamic_modifier was created with scope = TAG, then has_dynamic_modifier must also use the syntax with scope, otherwise it will return false even if the modifier exists. Beginners often mistakenly assume the modifier wasn't properly added and repeatedly troubleshoot the addition logic.
- Using in the wrong scope: This trigger only works under STATE, COUNTRY, and CHARACTER scopes. If called directly in other scopes (such as certain sub-blocks in unit leaders), the script won't produce a syntax error but will always return false, resulting in hard-to-detect logic bugs.