Wiki

trigger · is_fighting_air_units

Definition

  • Supported scope:COMBATANT
  • Supported target:none

Description

check if side is fighting air units

实战 · 配合 · 坑

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

实战用法

此 trigger 常用于自定义战斗事件或 on_action 脚本中,在敌方有空军参战时为己方部队触发特殊修正或决策。例如制作"防空作战"特性解锁、或在与敌机交战时提升某些指挥官的经验奖励等场景中非常实用。

# 示例:战斗事件中,若正在与空军交战则触发特定效果
on_combat_started = {
    limit = {
        is_defender = yes
        is_fighting_air_units = yes
    }
    # 此处填写后续触发器或 effect 块
}

配合关系

  • is_attacker / is_defender:通常需要先明确当前 combatant 是进攻方还是防守方,再判断是否遭到空中打击,逻辑更严谨。
  • is_fighting_in_terrain:与地形条件组合,可模拟"在某种地形下遭受空袭"的特殊场景,丰富战场事件的触发条件。
  • has_combat_modifier:用于检测是否已存在特定战斗修正,避免在已触发空战减益的情况下重复叠加效果。
  • night:空中打击在夜间效果不同,结合夜间判断可区分昼夜防空场景,制作更精细的战斗事件。

常见坑

  1. scope 混用:此 trigger 只在 COMBATANT scope 下有效,若误写在国家 scope(如顶层 country_event 的 trigger 块)中会静默失败或报错,必须确保处于战斗相关的 on_action 或战斗事件的 combatant scope 内。
  2. 误以为检测的是己方空军:该 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

This trigger is commonly used in custom battle events or on_action scripts to trigger special modifiers or decisions for your forces when the enemy has air units engaged in combat. It's particularly useful in scenarios such as unlocking "anti-air operations" mechanics or granting experience bonuses to certain commanders when engaged with enemy aircraft.

# Example: In a battle event, trigger a specific effect if currently engaged with air units
on_combat_started = {
    limit = {
        is_defender = yes
        is_fighting_air_units = yes
    }
    # Place subsequent triggers or effect blocks here
}

Synergy

  • is_attacker / is_defender: Typically should first clarify whether the current combatant is the attacker or defender, then check whether they are under air assault. This creates more rigorous logic.
  • is_fighting_in_terrain: Combined with terrain conditions, you can simulate "air strikes in specific terrain types," enriching the trigger conditions for battle events.
  • has_combat_modifier: Used to check whether a specific combat modifier already exists, preventing duplicate stacking of effects when air combat penalties are already active.
  • night: Air strikes have different effects at night. Combined with night checks, you can distinguish between daytime and nighttime air defense scenarios, creating more granular battle events.

Common Pitfalls

  1. Scope confusion: This trigger only works within the COMBATANT scope. If mistakenly placed in a country scope (such as the trigger block of a top-level country_event), it will silently fail or throw an error. You must ensure it's within a combat-related on_action or within the combatant scope of a battle event.
  2. Misinterpreting it as checking your own air force: This trigger detects "the enemy has air units participating in combat," not whether your side has deployed air support. Beginners often reverse the logic, causing anti-air events to trigger under completely wrong conditions.