Wiki

effect · diplomatic_relation

Definition

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

Description

Set up a diplomatic relation between two nations. Example: 
diplomatic_relation = { 
	country = POR #target country
	relation = military_access #type of relation
	active = yes #yes to add relation, no to cancel existing one
}

实战 · 配合 · 坑

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

实战用法

diplomatic_relation 常用于事件或决策触发时,动态建立或撤销两国之间的外交协议,例如在剧本 mod 中让某国在特定条件下获得或失去对另一国的军事通行权、保证关系等。它也常见于"历史修正"类 mod,在游戏开局的 history 块之外通过脚本动态调整外交格局。

# 示例:某事件选项中,ROOT 国向 POR 申请军事通行权
option = {
    name = my_event.1.a
    diplomatic_relation = {
        country = POR
        relation = military_access
        active = yes
    }
}

配合关系

  • [gives_military_access_to](/wiki/trigger/gives_military_access_to) — 在触发条件中先检查通行权是否已存在,避免重复添加或逻辑矛盾。
  • [give_guarantee](/wiki/effect/give_guarantee) — 两者常搭配使用,在同一事件选项中同时建立保证与通行权,模拟全面外交协议。
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — 建立外交关系后,同步添加好感度修正,使关系变动在 UI 上更有说服力。
  • [declare_war_on](/wiki/effect/declare_war_on) — 宣战前若存在军事通行权,需先用 active = no 撤销,否则可能产生逻辑冲突;两者常在对立的事件分支中配对出现。

常见坑

  1. country 填的是固定 TAG 而非 scope 关键字country 字段只接受国家标签(如 PORGER)或可解析为国家的变量,不能直接写 THISROOT 等 scope 关键字,新手常因此导致效果静默失效。
  2. 忘记 active = no 来撤销关系:省略 active 字段或始终写 yes 会导致无法通过脚本移除已有的外交关系,需要显式写 active = no 才能取消,而不是重新执行一次 active = 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

diplomatic_relation is commonly used in events or decisions to dynamically establish or revoke diplomatic agreements between two nations. For example, in scenario mods, it grants or revokes military access or guarantees to specific countries under certain conditions. It also frequently appears in "historical revision" mods, where scripts dynamically adjust the diplomatic landscape outside the game's initial history block.

# Example: In an event option, ROOT applies to POR for military access
option = {
    name = my_event.1.a
    diplomatic_relation = {
        country = POR
        relation = military_access
        active = yes
    }
}

Synergy

  • [gives_military_access_to](/wiki/trigger/gives_military_access_to) — Check in trigger conditions whether access already exists to avoid duplicate additions or logical contradictions.
  • [give_guarantee](/wiki/effect/give_guarantee) — Frequently paired together; establish both a guarantee and access rights in the same event option to simulate comprehensive diplomatic agreements.
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — After establishing a diplomatic relationship, simultaneously add opinion modifiers to make relationship changes more convincing in the UI.
  • [declare_war_on](/wiki/effect/declare_war_on) — If military access exists before declaring war, revoke it first using active = no to avoid logical conflicts; the two typically appear in opposing event branches.

Common Pitfalls

  1. country field contains a fixed TAG instead of a scope keyword: The country field only accepts country tags (such as POR, GER) or variables that resolve to a country—it cannot directly use scope keywords like THIS or ROOT. Beginners often inadvertently cause the effect to silently fail due to this mistake.
  2. Forgetting active = no to revoke the relationship: Omitting the active field or always writing yes prevents you from removing existing diplomatic relationships through script. You must explicitly write active = no to cancel a relationship—simply executing active = yes again will not work.