Wiki

effect · add_to_war

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

adds country to the specified war:
ENG = {
	add_to_war = {
	  targeted_alliance = SOV # Country to which side we want to join
	  enemy = PER # Which country we want to declare war on
	  hostility_reason = asked_to_join # The reason for joining the war
	  single_target_only = yes # yes if we want to target only the given country and not all enemies of targeted_alliance
  }
}

实战 · 配合 · 坑

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

实战用法

add_to_war 常用于事件驱动的外交场景,例如某国在特定条件下被迫或主动加入盟友正在进行的战争,从而实现"拉入参战"的叙事效果。典型案例包括:历史线中苏联被迫对日宣战、小国在大国施压下加入某一阵营,或玩家 mod 中自定义战争联盟的扩展逻辑。

# 英国事件:苏联请求我方加入对波斯的战争
country_event = {
    id = my_mod.42
    option = {
        name = my_mod.42.a
        # 英国加入苏联一侧,对波斯宣战
        ENG = {
            add_to_war = {
                targeted_alliance = SOV
                enemy = PER
                hostility_reason = asked_to_join
                single_target_only = yes
            }
        }
    }
}

配合关系

  • [has_defensive_war](/wiki/trigger/has_defensive_war) — 在加入战争前校验目标方是否处于防御战状态,避免逻辑矛盾(例如不能"加入进攻方"却让对方显示为进攻者)。
  • [declare_war_on](/wiki/effect/declare_war_on) — 当没有现成战争可加入、需要先由某一方发起战争时,先用此命令开战,再用 add_to_war 拉其他国家入局,二者共同构成完整的战争发动流程。
  • [has_war](/wiki/trigger/has_war)(注:若白名单中无此项,以下选用最接近的)[has_defensive_war_with](/wiki/trigger/has_defensive_war_with) — 确认指定战争确实存在且对方国家已在交战,是调用 add_to_war 前的必要前置校验。
  • [create_wargoal](/wiki/effect/create_wargoal) — 在加入战争后为己方补充战争目标,与 add_to_war 搭配使编入战争的国家拥有明确的战后诉求,而不仅仅是"无目标参战"。

常见坑

  1. targeted_alliance 指向的国家必须已经在战争中,否则游戏会静默报错或直接忽略该指令。新手常犯的错误是在同一事件里先用 add_to_war 再用 declare_war_on 开战,导致执行顺序颠倒、targeted_alliance 尚未入战时指令无效。应先确保盟方已参战(用 [has_defensive_war_with](/wiki/trigger/has_defensive_war_with) 或类似触发器把关),再执行 add_to_war

  2. single_target_only 遗漏会导致意外的连锁宣战:若不填或设为 no,加入方将自动对 targeted_alliance 的所有现有敌人宣战,而非只针对 enemy 字段所指定的单一国家,容易在多战线 mod 中造成不可控的外交连锁反应。

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_to_war is commonly used in event-driven diplomatic scenarios, such as when a nation is forced or willingly joins an ongoing war alongside its allies under specific conditions, thereby achieving the narrative effect of "bringing a nation into the conflict." Typical cases include the Soviet Union being forced to declare war on Japan in the historical timeline, smaller nations joining a faction under pressure from major powers, or custom war coalition expansion logic in player mods.

# British event: Soviet Union requests that we join the war against Persia
country_event = {
    id = my_mod.42
    option = {
        name = my_mod.42.a
        # Britain joins the Soviet side and declares war on Persia
        ENG = {
            add_to_war = {
                targeted_alliance = SOV
                enemy = PER
                hostility_reason = asked_to_join
                single_target_only = yes
            }
        }
    }
}

Synergy

  • [has_defensive_war](/wiki/trigger/has_defensive_war) — Validates whether the target party is in a defensive war state before joining, preventing logical contradictions (for example, avoiding situations where you "join the offensive side" while the opponent is shown as the aggressor).
  • [declare_war_on](/wiki/effect/declare_war_on) — When there is no existing war to join and one side must initiate hostilities first, use this command to start the war, then use add_to_war to bring other nations into the conflict. Together they form a complete war declaration workflow.
  • [has_defensive_war_with](/wiki/trigger/has_defensive_war_with) — Confirms that the specified war actually exists and the target nation is already engaged in combat. This is a necessary prerequisite check before invoking add_to_war.
  • [create_wargoal](/wiki/effect/create_wargoal) — After joining a war, supplement your faction with war goals. When paired with add_to_war, this ensures that nations entering the war have clear post-war objectives, rather than simply "fighting without purpose."

Common Pitfalls

  1. The nation targeted by targeted_alliance must already be in the war, otherwise the game will silently error or ignore the command entirely. A common beginner mistake is using add_to_war followed by declare_war_on in the same event, causing execution order to become inverted and the targeted_alliance to remain unengaged when the command fires. Always ensure the allied nation is already at war (using [has_defensive_war_with](/wiki/trigger/has_defensive_war_with) or similar triggers as a gating condition) before executing add_to_war.

  2. Omitting single_target_only will cause unintended chain declarations of war: If left unset or set to no, the joining nation will automatically declare war on all existing enemies of the targeted_alliance, rather than only the single nation specified in the enemy field. This can easily trigger uncontrollable diplomatic chain reactions in multi-front mods.