trigger · has_offensive_war_with
Definition
- Supported scope:
COUNTRY - Supported target:
THIS,ROOT,PREV,FROM,OWNER,CONTROLLER,OCCUPIED,CAPITAL
Description
One country has offensive war against other country.
has_offensive_war_withCOUNTRYTHIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITALOne country has offensive war against other country.
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
has_offensive_war_with 常用于判断两国之间是否存在"进攻方-防守方"的单向战争关系,例如在外交事件或决议中限制某些选项仅在己方主动发起的战争中可用,或用于 AI 策略的条件判断。典型场景:当本国是主动进攻方时,才允许激活某个战时决议或触发特定事件。
# 仅当本国对目标国发动了进攻战争时,该决议才可用
available = {
has_offensive_war_with = FROM
}
[has_defensive_war_with](/wiki/trigger/has_defensive_war_with):与本 trigger 成对使用,区分"己方是进攻方"还是"己方是防守方",常用于需要精确判断战争性质的条件块中。[any_enemy_country](/wiki/trigger/any_enemy_country):枚举所有当前敌国,配合 has_offensive_war_with 可以筛选出在所有敌国中哪些是本国主动打的,适合做批量策略判断。[create_wargoal](/wiki/effect/create_wargoal):在 effect 块中主动生成战争目标,常在 trigger 侧用 has_offensive_war_with 确认战争状态后,再决定是否追加新战争目标。[has_war_score](/wiki/trigger/has_war_score):进攻战中往往还需要判断当前战争分数,二者配合可构建"正在进攻且已取得优势"的复合条件。has_offensive_war_with = X 的语义是"当前 scope 国家对 X 发动了进攻战争",而非"X 对当前 scope 发动战争",新手容易将两者写反,导致条件完全不触发。country_event 的 option 条件中,FROM 和 ROOT 的指向会随触发上下文变化,直接照搬示例而不确认当前 scope 的 FROM 究竟指向哪个国家,会使判断对象错位,建议先用 [exists](/wiki/trigger/exists) 配合调试确认 scope 指向再填入 target。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.
has_offensive_war_with is commonly used to determine whether an "aggressor-defender" unidirectional war relationship exists between two nations. For example, in diplomatic events or decisions, it restricts certain options to be available only when your nation is the active aggressor, or it can be used in AI strategy condition checks. Typical scenario: allow activation of a wartime decision or trigger a specific event only when your nation is the active attacker.
# This decision is only available when your nation has launched an offensive war against the target
available = {
has_offensive_war_with = FROM
}
[has_defensive_war_with](/wiki/trigger/has_defensive_war_with): Used as a counterpart to this trigger to distinguish between "your nation as aggressor" versus "your nation as defender". Commonly used in condition blocks where precise war nature classification is needed.[any_enemy_country](/wiki/trigger/any_enemy_country): Enumerates all current enemy nations. Combined with has_offensive_war_with, it can filter which enemies your nation actively initiated war against, suitable for batch strategy judgments.[create_wargoal](/wiki/effect/create_wargoal): Actively generates war goals in effect blocks. Often after confirming war status on the trigger side using has_offensive_war_with, it determines whether to append new war goals.[has_war_score](/wiki/trigger/has_war_score): Offensive wars often require checking current war score as well. Used together, these can construct a compound condition of "currently attacking and already gaining advantage".has_offensive_war_with = X is "the current scope nation has launched an offensive war against X", not "X has launched war against the current scope". Beginners often reverse the two, causing the condition to fail entirely. Double-check the direction of the relationship before implementation.country_event option conditions, the referents of FROM and ROOT change with the triggering context. Blindly copying examples without confirming which nation the current scope's FROM actually points to will cause the judgment object to be misaligned. It is recommended to first use [exists](/wiki/trigger/exists) paired with debugging to confirm scope direction before filling in the target.