Wiki

trigger · has_offensive_war_without_friend

Definition

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

Description

is country at offensive war without specific ally present

实战 · 配合 · 坑

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

实战用法

当你需要判断某国正在发动进攻战但其特定盟友并未参与其中时,这个 trigger 非常有用。典型场景是设计"孤立主义"或"背刺"类事件——例如某国单独开战却未拉上核心盟友时触发外交惩罚或特殊决议。

# 示例:当玩家国家发动进攻战却没有特定盟友时,触发一个外交事件
country_event = {
    id = my_mod.1
    trigger = {
        has_offensive_war_without_friend = {
            target = GER  # 判断是否没有德国作为盟友参战
        }
    }
    # ...
}

配合关系

  • [has_defensive_war](/wiki/trigger/has_defensive_war) — 常与本 trigger 对比使用,区分当前国家究竟处于进攻战还是防御战状态,使条件逻辑更完整。
  • [any_allied_country](/wiki/trigger/any_allied_country) — 用于进一步枚举盟友状态,验证到底哪些盟友参战,与本 trigger 形成双重校验。
  • [has_war_with](/wiki/trigger/has_war_with)(即结合 [any_enemy_country](/wiki/trigger/any_enemy_country))— 确认交战对象,使"孤立进攻"的判断更加精准。
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — 当本 trigger 为真时,对相关国家施加外交舆论惩罚,是最常见的后续 effect 搭配。

常见坑

  1. 误以为 target 是敌方target 填写的是期望存在的盟友,而非交战对手。新手容易把目标国填成交战敌国,导致逻辑完全相反,trigger 永远返回错误结果。
  2. 忽略 scope 必须是 COUNTRY:将此 trigger 放在 STATE 或 CHARACTER 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

This trigger is extremely useful when you need to check whether a certain nation is engaged in an offensive war but a specific ally is not participating in it. A typical scenario involves designing "isolationism" or "backstab" events—for example, triggering diplomatic penalties or special decisions when a nation declares war alone without pulling in key allies.

# Example: Trigger a diplomatic event when the player's nation launches an offensive war without a specific ally
country_event = {
    id = my_mod.1
    trigger = {
        has_offensive_war_without_friend = {
            target = GER  # Check whether Germany is not participating as an ally
        }
    }
    # ...
}

Synergy

  • [has_defensive_war](/wiki/trigger/has_defensive_war) — Often used in contrast with this trigger to distinguish whether the current nation is in an offensive or defensive war state, making the conditional logic more complete.
  • [any_allied_country](/wiki/trigger/any_allied_country) — Used to further enumerate allied status and verify which allies are actually participating in the war, forming a dual verification with this trigger.
  • [has_war_with](/wiki/trigger/has_war_with) (combined with [any_enemy_country](/wiki/trigger/any_enemy_country)) — Confirms the opposing combatant, making the determination of "isolated offense" more precise.
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — When this trigger evaluates to true, apply diplomatic opinion penalties to relevant nations, the most common follow-up effect pairing.

Common Pitfalls

  1. Mistaking target as the enemy: The target parameter specifies the expected ally that should exist, not the opposing combatant. Beginners often fill in the enemy nation as the target, inverting the logic entirely and causing the trigger to always return false.
  2. Overlooking that scope must be COUNTRY: Using this trigger under STATE or CHARACTER scope will cause script errors or silent failures. Always ensure the outer scope is nation-level before writing this condition.