Wiki

trigger · temperature

Definition

  • Supported scope:COMBATANT
  • Supported target:none

Description

check combat province temperature

实战 · 配合 · 坑

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

实战用法

temperature 常用于气候/天气相关的 mod 场景,例如为极寒或酷热地区的战斗添加特殊修正,或在冬季战役中判断作战部队是否处于严苛温度环境下从而触发特定战斗惩罚事件。它让 mod 作者能够在 COMBATANT 作用域内(即战斗双方某一方)精确过滤温度条件,从而区分不同地形气候下的战斗表现。

# 示例:极寒条件下,攻击方若无冬季战斗特质则承受额外惩罚
COMBATANT = {
    is_attacker = yes
    temperature < -10
    NOT = { has_trait = winter_specialist }
}

配合关系

  • is_fighting_in_weather:天气与温度往往同时影响战场环境,两者联用可构建更精确的"恶劣气候"复合条件。
  • is_fighting_in_terrain:地形决定了温度区间的合理性(如山地、极地),与 temperature 搭配可避免条件过于宽泛。
  • has_trait:用于判断部队是否持有适应极端温度的特质,与 temperature 组合实现"有特质豁免、无特质受罚"的逻辑。
  • is_attacker:区分交战双方身份,使温度惩罚只对攻方或守方生效,避免对双方一视同仁的误判。

常见坑

  1. 作用域混淆temperature 只在 COMBATANT 作用域内有效,新手常误将其写在普通的 divisioncountry 作用域下,导致脚本静默失效或报错,务必确认已进入战斗触发器的 COMBATANT 块。
  2. 数值方向误判:新手容易混淆比较方向,例如想筛选"极寒"却写成 temperature > -10,实际上应使用 temperature < -10;建议在测试时配合 is_fighting_in_terrain 缩小范围来验证条件是否真正被触发。

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

temperature is commonly used in climate and weather-related mod scenarios, such as adding special modifiers to combat in extreme cold or hot regions, or determining whether combat forces are operating in harsh temperature conditions during winter campaigns to trigger specific combat penalty events. It enables mod authors to precisely filter temperature conditions within the COMBATANT scope (i.e., one side of the combatants) to distinguish combat performance across different terrain and climate types.

# Example: Under extreme cold conditions, the attacker suffers additional penalties if lacking winter combat traits
COMBATANT = {
    is_attacker = yes
    temperature < -10
    NOT = { has_trait = winter_specialist }
}

Synergy

  • is_fighting_in_weather: Weather and temperature often influence the battlefield environment simultaneously; using both together constructs more precise "severe weather" compound conditions.
  • is_fighting_in_terrain: Terrain determines the reasonable temperature range (e.g., mountains, polar regions); pairing with temperature prevents conditions from being overly broad.
  • has_trait: Used to check whether troops possess traits that adapt to extreme temperatures; combining with temperature implements the logic of "traits grant exemption, lack of traits incurs penalty."
  • is_attacker: Distinguishes the identity of combatants, ensuring temperature penalties apply only to attackers or defenders, avoiding misapplied penalties to both sides equally.

Common Pitfalls

  1. Scope Confusion: temperature is only valid within the COMBATANT scope; beginners often mistakenly place it in regular division or country scopes, causing the script to silently fail or throw errors. Always confirm you are within the COMBATANT block of a combat trigger.
  2. Inverted Comparison Logic: Beginners frequently confuse comparison direction, such as writing temperature > -10 when trying to filter for "extreme cold" when temperature < -10 should be used instead. It is recommended to pair testing with is_fighting_in_terrain to narrow the range and verify whether the condition is truly being triggered.