Wiki

trigger · non_damaged_building_level

Definition

  • Supported scope:STATE
  • Supported target:none

Description

check if a state has enough non damaged buildings


Example:
non_damaged_building_level = {
	building = arms_factory
	level = 5
}

实战 · 配合 · 坑

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

实战用法

non_damaged_building_level 常用于工业战争损伤检测场景,例如判断某州是否保有足够完好的军工厂才能触发某项决策或事件。典型应用包括:战略轰炸后限制敌方特定选项、或在剧本 mod 中要求某州工业未受破坏才能开启生产奖励事件。

# 仅当该州拥有至少 3 座未受损的基础设施时,决策才可用
available = {
    non_damaged_building_level = {
        building = infrastructure
        level = 3
    }
}

配合关系

  • [building_count_trigger](/wiki/trigger/building_count_trigger):检查建筑总等级(含受损),与 non_damaged_building_level 搭配可同时判断"建了多少"与"完好多少",区分建造量和实际可用量。
  • [days_since_last_strategic_bombing](/wiki/trigger/days_since_last_strategic_bombing):检测上次战略轰炸距今天数,结合完好建筑判断,可精确描述"轰炸后恢复前"的状态窗口。
  • [damage_building](/wiki/effect/damage_building):主动损毁建筑的 effect,常在测试或剧本 mod 中与本 trigger 配合,先手动制造损伤再用 trigger 验证结果是否符合阈值。
  • [free_building_slots](/wiki/trigger/free_building_slots):检查州内剩余建筑槽,与完好建筑数量一同构成对州工业状况的全面判断,常用于限制"能否继续建造"的条件块。

常见坑

  1. 混淆"总等级"与"完好等级":新手常误用 building_count_trigger 替代本 trigger,但前者计入受损建筑的全部等级,后者只计完好部分——在战略轰炸频繁的情境下两者结果可能差异显著,选错会导致条件在建筑受损后仍意外成立。
  2. scope 必须是 STATE:该 trigger 只能在州 scope 下使用,若写在国家 scope(如 country_event 的 trigger 块内未先转入州 scope),脚本会静默报错或永远返回假,需用 any_owned_statecapital_scope 等先切换至州 scope 再调用。

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

non_damaged_building_level is commonly used in industrial warfare damage assessment scenarios, such as determining whether a state retains sufficient intact military factories to trigger a specific decision or event. Typical applications include: restricting enemy options after strategic bombing, or in scripted mods requiring a state's industry to be undamaged before unlocking production bonus events.

# Decision is only available if the state has at least 3 undamaged infrastructure levels
available = {
    non_damaged_building_level = {
        building = infrastructure
        level = 3
    }
}

Synergy

  • [building_count_trigger](/wiki/trigger/building_count_trigger): Checks total building level (including damaged). Combined with non_damaged_building_level, allows simultaneous assessment of "how much was built" versus "how much is actually operational," distinguishing construction volume from functional capacity.
  • [days_since_last_strategic_bombing](/wiki/trigger/days_since_last_strategic_bombing): Detects days elapsed since last strategic bombing. Combined with intact building checks, precisely describes the state window of "post-bombing before recovery."
  • [damage_building](/wiki/effect/damage_building): Effect that actively damages buildings, commonly paired with this trigger in testing or scripted mods—manually inflict damage first, then use the trigger to verify results against thresholds.
  • [free_building_slots](/wiki/trigger/free_building_slots): Checks remaining building slots in a state. Combined with intact building counts, provides comprehensive assessment of state industrial status, commonly used in conditions limiting "whether further construction is possible."

Common Pitfalls

  1. Confusing "total level" with "intact level": Beginners often mistakenly substitute building_count_trigger for this trigger, but the former counts all levels of damaged buildings while the latter counts only intact portions. In scenarios with frequent strategic bombing, the two can yield significantly different results—selecting the wrong one causes conditions to unexpectedly remain true even after building damage.
  2. Scope must be STATE: This trigger only works within state scope. If written in country scope (such as within a country_event's trigger block without first switching to state scope), the script silently errors or perpetually returns false. Use any_owned_state, capital_scope, or similar to switch to state scope first before invoking.