effect · declare_war_on
Definition
- Supported scope:
COUNTRY - Supported target:
none
Description
declares war on specified country
declare_war_onCOUNTRYnonedeclares war on specified country
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
declare_war_on 常用于事件链或焦点树中触发脚本控制的战争,例如在某个国家完成特定国策后强制对目标宣战,绕过正常的战争理由流程。它也适合在 AI 行为脚本或隐藏事件中控制 AI 国家之间的战争爆发时机,实现剧情驱动的战争节点。
# 在一个国策完成后,让当前国家对目标国宣战
complete_national_focus = SOV_push_west
country_event = {
id = sov.42
}
# 事件选项中触发宣战
country_event = {
id = sov.42
option = {
name = sov.42.a
declare_war_on = {
target = POL
type = annex_everything # 战争目标类型,需配合 create_wargoal 或直接指定
}
}
}
[can_declare_war_on](/wiki/trigger/can_declare_war_on):在执行宣战前检查是否满足宣战条件(如是否已处于战争状态、是否为盟友),避免脚本报错或逻辑矛盾。[create_wargoal](/wiki/effect/create_wargoal):通常在宣战前先用此命令为战争创建合法的战争目标,使宣战有具体诉求而非无条件开战。[add_to_war](/wiki/effect/add_to_war):宣战后可将其他国家拉入已有战争,与 declare_war_on 配合构建多方阵营战争。[country_event](/wiki/effect/country_event):宣战后触发一系列后续事件(如盟友反应、民意变化),实现完整的战争触发叙事链。declare_war_on 会导致脚本错误或行为异常,应先用 [can_declare_war_on](/wiki/trigger/can_declare_war_on) 做前置判断。every_owned_state 块内),游戏不会报明显错误但命令会被静默忽略,难以排查。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.
declare_war_on is commonly used in event chains or focus trees to trigger script-controlled warfare. For example, you can force a country to declare war on a target after completing a specific national focus, bypassing the normal war justification process. It's also ideal for controlling AI-driven warfare timing between nations in AI behavior scripts or hidden events, enabling narrative-driven war scenarios.
# After completing a national focus, have the current country declare war on the target
complete_national_focus = SOV_push_west
country_event = {
id = sov.42
}
# Trigger war declaration from an event option
country_event = {
id = sov.42
option = {
name = sov.42.a
declare_war_on = {
target = POL
type = annex_everything # War goal type; typically used with create_wargoal or specified directly
}
}
}
[can_declare_war_on](/wiki/trigger/can_declare_war_on): Check if war declaration conditions are met before executing (e.g., whether already at war, whether allies) to prevent script errors or logical conflicts.[create_wargoal](/wiki/effect/create_wargoal): Typically create a legitimate war goal for the conflict before declaring war, giving the declaration a concrete justification rather than unconditional aggression.[add_to_war](/wiki/effect/add_to_war): After declaring war, bring other nations into an existing conflict, combining with declare_war_on to construct multi-faction warfare.[country_event](/wiki/effect/country_event): Trigger follow-up events after war declaration (such as ally reactions, opinion shifts) to build a complete narrative chain for the war trigger.declare_war_on again on a nation already in the same conflict causes script errors or unexpected behavior. Always use [can_declare_war_on](/wiki/trigger/can_declare_war_on) for validation first.every_owned_state block), the game won't throw an obvious error but silently ignores the command, making it difficult to debug.