Wiki

trigger · has_naval_invasion_against_state

Definition

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

Description

Check if the scoped country has a naval invasion against the specified state.
Example 1:
has_naval_invasion_against_state = <STATE_ID>
Example 2:
 has_naval_invasion_against_state = {
   state = <STATE_ID>
   preparation > 0.0  # (optional: preparation percentage, with a default value of 0.0)
   activated = no   # (optional: if set, also check if invasion is activated or not)
}

实战 · 配合 · 坑

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

实战用法

常用于判断某国是否正在对特定州发动两栖登陆,例如在防御方事件或决策中检测敌方登陆威胁,从而触发紧急援军或特殊加成。也可以在 AI 策略决策的 available 块中,确认己方的海上入侵计划已到达一定准备度后再允许外交或军事行动。

# 检测敌方是否对本国某州发动了海上入侵,且入侵已激活
add_ideas = emergency_coastal_defense
trigger = {
    any_enemy_country = {
        has_naval_invasion_against_state = {
            state = 42
            preparation > 0.5
            activated = yes
        }
    }
}

配合关系

  • [any_enemy_country](/wiki/trigger/any_enemy_country):遍历所有交战敌国,通常嵌套在外层用于逐一检查是否有任何敌国正在执行登陆,是该 trigger 最常见的包裹层。
  • [controls_state](/wiki/trigger/controls_state):配合使用以额外确认目标州的当前控制权,区分"有登陆计划但尚未得手"与"已失守"两种状态,避免逻辑误判。
  • [divisions_in_state](/wiki/trigger/divisions_in_state):在检测到登陆威胁后,联合判断该州内的兵力是否充足,为事件或决策提供更精细的条件分支。
  • [has_defensive_war_with](/wiki/trigger/has_defensive_war_with):与之搭配确认当前处于防御战争状态,防止在非战争情形下因脚本 bug 导致 trigger 意外触发。

常见坑

  1. 忽略 activated 字段的语义:不填 activated 时默认只检查入侵计划是否存在(无论激活与否),新手常以为"有计划 = 已发起攻击",导致在入侵尚处于准备阶段时就误触发应急事件;若要区分"准备中"和"已激活",务必显式写明 activated = yesactivated = no
  2. scope 方向混淆:该 trigger 的 scope 是发动入侵的国家,而不是被入侵的国家。新手容易在被攻击方的 scope 下直接使用,导致永远返回假;正确做法是先切换到敌方 scope(如用 any_enemy_country),再在其内部调用此 trigger。

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

Commonly used to detect whether a specific country is conducting an amphibious invasion against a particular state—for example, in defensive events or decisions to detect enemy landing threats and trigger emergency reinforcements or special bonuses. Can also be used in the available block of AI strategy decisions to confirm that your own naval invasion plan has reached a certain preparation level before allowing diplomatic or military actions.

# Detect whether an enemy has launched a naval invasion against a state of this country and the invasion is activated
add_ideas = emergency_coastal_defense
trigger = {
    any_enemy_country = {
        has_naval_invasion_against_state = {
            state = 42
            preparation > 0.5
            activated = yes
        }
    }
}

Synergy

  • [any_enemy_country](/wiki/trigger/any_enemy_country): Iterates through all belligerent enemy nations; typically nested at the outer level to check whether any enemy is executing a landing. This is the most common wrapper for this trigger.
  • [controls_state](/wiki/trigger/controls_state): Used in combination to further confirm current control of the target state, distinguishing between "has an invasion plan but hasn't succeeded yet" and "already lost," preventing logical errors.
  • [divisions_in_state](/wiki/trigger/divisions_in_state): After detecting a landing threat, jointly determine whether the force in that state is sufficient, providing finer conditional branching for events or decisions.
  • [has_defensive_war_with](/wiki/trigger/has_defensive_war_with): Pair with this to confirm you are currently in a defensive war, preventing unintended trigger activation due to script bugs in non-war situations.

Common Pitfalls

  1. Overlooking the semantics of the activated field: When activated is not specified, it only checks whether an invasion plan exists by default (regardless of activation status). Beginners often assume "has a plan = attack already initiated," causing emergency events to trigger prematurely while the invasion is still in preparation; to distinguish between "in preparation" and "activated," always explicitly write activated = yes or activated = no.
  2. Confusion about scope direction: The scope of this trigger is the country conducting the invasion, not the country being invaded. Beginners often use it directly under the scope of the attacked party, causing it to always return false; the correct approach is to first switch to the enemy scope (e.g., using any_enemy_country), then call this trigger within it.