Wiki

trigger · night

Definition

  • Supported scope:COMBATANT
  • Supported target:none

Description

check if combat is at night

实战 · 配合 · 坑

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

实战用法

night 常用于为夜间战斗定制特殊 modifier 或触发专属事件,例如制作夜袭战术 trait 系统、或让特定部队在夜间获得额外增益的 on_combat_phase 触发器。它只在战斗 scope(COMBATANT)内有意义,通常嵌套在 limit 块中过滤战斗阶段逻辑。

# 示例:夜间战斗时,若为进攻方且已侦察优势,给予特殊战斗修正
on_combat_phase = {
    limit = {
        night = yes
        is_attacker = yes
        recon_advantage = yes
    }
    add_combat_modifier = {
        modifier = night_assault_bonus
    }
}

配合关系

  • is_attacker / is_defender:区分夜间是进攻还是防御方,分别给予不同的夜战逻辑,是最常见的搭配。
  • is_fighting_in_terrain:夜间 + 特定地形(如森林、山地)组合,可模拟现实中夜间复杂地形作战难度倍增的场景。
  • recon_advantage:夜间作战时侦察优势的价值往往更高,两者联合判断可实现"只有侦察领先才能发挥夜袭效果"的设计。
  • has_trait:用于检查指挥官是否拥有夜战相关 trait,配合 night = yes 可做"夜袭专家"trait 的激活条件。

常见坑

  1. 在非战斗 scope 中使用会静默失败night 仅在 COMBATANT scope 下有效,若误写在国家 scope 或州 scope 的 trigger 块里,游戏不会报错但条件永远不会为真,导致效果完全失效,难以察觉。
  2. 误以为"夜晚时间"等于night = yes:该 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

night is commonly used to customize special modifiers for nighttime combat or trigger exclusive events, such as creating a night raid tactic trait system or granting additional bonuses to specific units during nighttime via on_combat_phase triggers. It only has meaning within combat scope (COMBATANT) and is typically nested in limit blocks to filter combat phase logic.

# Example: During nighttime combat, if acting as attacker and possessing reconnaissance advantage, grant special combat modifier
on_combat_phase = {
    limit = {
        night = yes
        is_attacker = yes
        recon_advantage = yes
    }
    add_combat_modifier = {
        modifier = night_assault_bonus
    }
}

Synergy

  • is_attacker / is_defender: Differentiate between attacking or defending during night engagements to apply distinct nighttime combat logic; this is the most common pairing.
  • is_fighting_in_terrain: Combining night combat with specific terrain types (such as forests or mountains) can simulate realistic scenarios where nighttime operations in complex terrain multiply difficulty.
  • recon_advantage: Reconnaissance advantage gains significantly higher value during night operations; using both conditions together enables designs like "night raid tactics only work when reconnaissance superiority is achieved."
  • has_trait: Check whether a commander possesses night combat-related traits; combined with night = yes, this allows activation conditions for "night assault specialist" traits.

Common Pitfalls

  1. Silent failure when used outside combat scope: night is only valid within COMBATANT scope. If mistakenly written in a trigger block within country or state scope, the game will not report an error but the condition will never evaluate to true, causing complete effect failure that is difficult to detect.
  2. Confusing "nighttime on the clock" with night = yes: This trigger evaluates whether the current combat is in a nighttime phase, not the in-game clock time or calendar date. It has no relation to dates or hours and cannot be used to detect whether it is night on the map.