Wiki

trigger · has_relation_modifier

Definition

  • Supported scope:COUNTRY
  • Supported target:any

Description

Country has specified relation modifier when dealing with _target_ county
Example: has_relation_modifier = {
	target = TAG # has license from this country, optional
	modifier = static_modifier_here
	}
}

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

has_relation_modifier 常用于检测两国之间是否已经建立了特定的外交关系修正,例如判断玩家国家是否已向目标国添加了贸易协议、军事合作或情报共享等自定义 modifier,从而决定后续决策或事件是否可触发。典型场景包括:某外交决策只有在已对目标国施加过特定关系修正后才能再次升级,或用于 available 块防止玩家重复添加同类修正。

# 某外交决策的 available 条件:
# 仅当与目标国尚未建立"军事互信协议"修正时才可执行
available = {
    NOT = {
        has_relation_modifier = {
            target = FROM
            modifier = military_trust_agreement
        }
    }
}

配合关系

  • [add_relation_modifier](/wiki/effect/add_relation_modifier):最直接的搭档,先用 has_relation_modifier 检查修正是否已存在,再用 add_relation_modifier 添加,避免重复叠加产生异常效果。
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier):两者常组合在外交事件中,关系修正存在时才进一步调整好感度,使外交层次更丰富。
  • [has_dynamic_modifier](/wiki/trigger/has_dynamic_modifier):类似地检测本国侧的动态修正,与 has_relation_modifier 配合可同时验证"双向条件"是否满足。
  • [any_allied_country](/wiki/trigger/any_allied_country):在遍历盟友时嵌套使用 has_relation_modifier,检查是否对某个盟友持有特定关系修正,适合多国联动的外交 mod 逻辑。

常见坑

  1. 忽略 target 的方向性has_relation_modifier 检测的是当前 scope 国家对 target 国持有的修正,而非 target 对当前国,初学者常把两者搞反,导致条件永远不成立。若要检测反向,需切换 scope 到对方国家再判断。
  2. modifier 名拼写须与 add_relation_modifier 中的定义完全一致:该 trigger 引用的是静态修正(static modifier)的 key,若名称写错或与实际添加时使用的名称不符,即使修正已存在也会返回假,且游戏不会报错,极难排查。

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

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

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