Wiki

trigger · has_war_together_with

Definition

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

Description

Are the countries fighting on the same side of a war

实战 · 配合 · 坑

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

实战用法

has_war_together_with 常用于盟友合作相关的国家事件或决策中,例如只有当两国并肩作战时才允许触发联合军事援助决策,或在外交 AI 策略里判断当前是否与目标国处于同一战线。典型场景:某派系成员想对共同敌人发动追加战役,先确认双方确实同在一场战争的同侧再执行后续 effect。

# 仅当本国与 GER 在同一场战争中并肩作战时,才允许触发联合进攻决策
available = {
    has_war_together_with = GER
}

配合关系

  • [has_defensive_war](/wiki/trigger/has_defensive_war) — 先判断本国是否处于防御战,再结合 has_war_together_with 确认某盟友也在同侧,用于区分"共同防御"与"共同进攻"两种援助逻辑。
  • [any_allied_country](/wiki/trigger/any_allied_country) — 遍历所有盟友并嵌套 has_war_together_with,可精确筛选出既是盟友、又在同一战争同侧的国家,避免把尚未参战的盟友误算在内。
  • [add_to_war](/wiki/effect/add_to_war) — 当确认目标国已与本国并肩作战后,再用此 effect 拉入其他国家参战,逻辑上形成"验证现有战争关系 → 扩大参战方"的完整链条。
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — 在并肩作战条件成立时给予双边好感度奖励,模拟战时同盟情谊加深的叙事效果。

常见坑

  1. 把"同盟"与"同侧参战"混淆:两国同属一个派系或互相有保证并不意味着 has_war_together_with 返回真,只有双方在同一场战争且站在同一阵营才会触发;若目标国尚未 add_to_war,此 trigger 会静默返回假而不报错,极易导致条件永远不满足。
  2. scope 指向错误:该 trigger 必须在 COUNTRY scope 下使用,若误写在 STATE 或 CHARACTER scope 里游戏不会提示,但逻辑会直接失效;检查时要确认外层 scope 确实是一个国家标签或对应的 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

has_war_together_with is commonly used in country events or decisions related to ally cooperation, such as enabling joint military aid decisions only when two nations are fighting side by side, or determining in diplomatic AI strategies whether the current target nation is on the same front. Typical scenario: a faction member wants to launch an additional campaign against a common enemy, first confirming both sides are truly on the same side of a war before executing subsequent effects.

# Only allow joint offensive decision to trigger when this country is fighting alongside GER in the same war
available = {
    has_war_together_with = GER
}

Synergy

  • [has_defensive_war](/wiki/trigger/has_defensive_war) — First check if this country is in a defensive war, then combine with has_war_together_with to confirm an ally is also on the same side, useful for distinguishing between "joint defense" and "joint offense" aid logic.
  • [any_allied_country](/wiki/trigger/any_allied_country) — Iterate through all allies and nest has_war_together_with to precisely filter countries that are both allies and on the same side of a war, avoiding mistakenly counting allies that haven't entered combat.
  • [add_to_war](/wiki/effect/add_to_war) — After confirming the target country is already fighting alongside this nation, use this effect to bring other countries into the war, forming a complete logic chain of "verify existing war relationship → expand participants."
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — Grant bilateral opinion bonuses when fighting side by side conditions are met, simulating the narrative effect of deepened alliance bonds during wartime.

Common Pitfalls

  1. Confusing "alliance" with "fighting on the same side": Two nations belonging to the same faction or having guarantees for each other does not mean has_war_together_with returns true; it only triggers when both are in the same war and on the same side. If the target nation hasn't been added via add_to_war, this trigger silently returns false without error, easily causing conditions to never be satisfied.
  2. Incorrect scope targeting: This trigger must be used under COUNTRY scope; if mistakenly written in STATE or CHARACTER scope, the game won't warn you but the logic will simply fail. When checking, ensure the outer scope is indeed a country tag or corresponding scope block.