Hands-On Usage
has_relation_modifier is commonly used to detect whether a specific diplomatic relation modifier has been established between two countries—for example, checking whether the player nation has already added a trade agreement, military cooperation, or intelligence sharing modifier to a target nation, thereby determining whether subsequent decisions or events should trigger. Typical scenarios include: a diplomatic decision that can only be upgraded again after a specific relation modifier has been applied to the target nation, or using it in an available block to prevent players from repeatedly adding similar modifiers.
# Available condition for a diplomatic decision:
# Only executable if the "military trust agreement" modifier with the target nation has not yet been established
available = {
NOT = {
has_relation_modifier = {
target = FROM
modifier = military_trust_agreement
}
}
}
Synergy
[add_relation_modifier](/wiki/effect/add_relation_modifier): The most direct companion—first use has_relation_modifier to check if the modifier already exists, then use add_relation_modifier to add it, avoiding duplicate stacking that produces unintended effects.
[add_opinion_modifier](/wiki/effect/add_opinion_modifier): The two are often combined in diplomatic events, adjusting opinion when relation modifiers are present to create richer diplomatic layers.
[has_dynamic_modifier](/wiki/trigger/has_dynamic_modifier): Similarly detects dynamic modifiers on the current nation's side; combined with has_relation_modifier, it can simultaneously verify whether "bilateral conditions" are satisfied.
[any_allied_country](/wiki/trigger/any_allied_country): When iterating through allies, nest has_relation_modifier to check whether a specific relation modifier is held toward a particular ally, ideal for multi-nation diplomatic mod logic.
Common Pitfalls
- Overlooking the directionality of
target: has_relation_modifier detects modifiers held by the current scoped nation toward the target nation, not vice versa. Beginners often confuse the two, causing conditions to never be met. To check the reverse direction, you must switch scope to the other nation and then evaluate.
- The
modifier name spelling must exactly match the definition in add_relation_modifier: This trigger references a static modifier's key. If the name is misspelled or doesn't match the name used when actually adding the modifier, it returns false even if the modifier exists, and the game won't throw an error, making it extremely difficult to debug.