Wiki

effect · add_relation_modifier

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS

Description

Adds a static modifier between current scope and target
Example: add_relation_modifier = {
	target = TAG # target of the relation
	modifier = static_modifier_name_here #Name of the modifier added
	}
}

实战 · 配合 · 坑

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

实战用法

add_relation_modifier 常用于外交系统 mod 中,为两个特定国家之间附加持久性静态修正,例如签订秘密协议后赋予双方额外贸易收益或外交压力加成。与普通 add_opinion_modifier 不同,它绑定的是 static modifier,可以携带更丰富的数值效果。

# 当玩家完成某个外交决议后,向目标国添加关系修正
effect_on_complete = {
    GER = {
        add_relation_modifier = {
            target = ITA
            modifier = secret_pact_bonus
        }
    }
}

配合关系

  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — 通常与关系修正同时使用,opinion modifier 负责显示外交好感度变化,relation modifier 负责挂载实际数值效果,二者互补。
  • [add_dynamic_modifier](/wiki/effect/add_dynamic_modifier) — 若需要带有到期时间或动态变量的修正,可与 add_relation_modifier 搭配:relation modifier 处理双边关系,dynamic modifier 处理本国内政效果。
  • [has_dynamic_modifier](/wiki/trigger/has_dynamic_modifier) — 在触发条件中检测某修正是否已存在,防止重复叠加同一 relation modifier 导致数值异常。
  • [diplomatic_relation](/wiki/effect/diplomatic_relation) — 在建立正式外交关系(如不侵犯协议)的同时调用,使外交状态与关系修正保持逻辑一致。

常见坑

  1. modifier 必须在 static_modifiers 中预先定义:新手常直接填写一个未在 common/modifiers/ 中声明的名称,导致修正静默失效且不报错,实际游戏内毫无效果。
  2. target 填写方向易搞反:该 effect 是在当前 scope 国家身上执行,target 指向对方,修正是附加在"当前国 → target 国"这条关系上,而非双向生效;若需双向,必须在双方 scope 下各执行一次。

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

add_relation_modifier is commonly used in diplomatic system mods to apply persistent static modifiers between two specific countries, such as granting additional trade benefits or diplomatic pressure bonuses to both parties after signing a secret agreement. Unlike the generic add_opinion_modifier, it binds to a static modifier and can carry richer numerical effects.

# When the player completes a certain diplomatic decision, add a relation modifier to the target country
effect_on_complete = {
    GER = {
        add_relation_modifier = {
            target = ITA
            modifier = secret_pact_bonus
        }
    }
}

Synergy

  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — Often used alongside relation modifiers; opinion modifiers handle displaying diplomatic affinity changes while relation modifiers apply actual numerical effects, complementing each other.
  • [add_dynamic_modifier](/wiki/effect/add_dynamic_modifier) — If you need modifiers with expiration times or dynamic variables, pair with add_relation_modifier: relation modifiers handle bilateral relations while dynamic modifiers handle domestic effects.
  • [has_dynamic_modifier](/wiki/trigger/has_dynamic_modifier) — Check in trigger conditions whether a modifier already exists to prevent stacking the same relation modifier multiple times and causing numerical anomalies.
  • [diplomatic_relation](/wiki/effect/diplomatic_relation) — Call alongside establishing formal diplomatic relations (such as non-aggression pacts) to keep diplomatic status consistent with relation modifiers.

Common Pitfalls

  1. The modifier must be predefined in static_modifiers: Beginners often directly enter a name not declared in common/modifiers/, causing the modifier to silently fail without error messages and have no effect in-game.
  2. The target direction is easily reversed: This effect executes on the current scope's country, with target pointing to the other party; the modifier applies to the "current country → target country" relationship, not bidirectionally. If bidirectional effects are needed, execute once in each country's scope.