Wiki

trigger · building_count_trigger

Definition

  • Supported scope:STATE, COUNTRY
  • Supported target:none

Description

Checks if the current scope has the specified amount of the specified building. 
Usage: <Building> < <int>
Supported buildings: infrastructure, arms_factory, industrial_complex, air_base, supply_node, rail_way, naval_facility, naval_base, bunker, coastal_bunker, stronghold_network, dockyard, anti_air_building, synthetic_refinery, fuel_silo, radar_station, mega_gun_emplacement, rocket_site, naval_supply_hub, naval_headquarters, nuclear_reactor, nuclear_reactor_heavy_water, commercial_nuclear_reactor, nuclear_facility, air_facility, land_facility, dam, dam_mountain, cataract_dam_mountain, canal_kiel, canal_panama, energy_infrastructure, industrial_infrastructure, landmark_big_ben, landmark_colosseum, landmark_cristo_redentor, landmark_eiffel_tower, landmark_statue_of_liberty, landmark_kremlin, landmark_hofburg_palace, landmark_berlin_reichstag, landmark_berlin_volkshalle, landmark_taj_mahal, landmark_sadabad_complex, landmark_hagia_sophia, landmark_forbidden_city, landmark_nanjing_presidential_palace, landmark_nanjing_presidential_palace_prc, landmark_nanjing_presidential_palace_gen, landmark_great_wall_section, landmark_tokyo_imperial_palace, landmark_national_diet, landmark_hakko_ichiu, landmark_prague_castle, landmark_bojnice_castle.

实战 · 配合 · 坑

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

实战用法

building_count_trigger 常用于判断某个州或国家是否已建设足够的工业基础,从而解锁后续国策、决议或事件选项。例如在工业发展 mod 中,可以要求玩家在目标州建造一定数量的军工厂才能触发扩张事件,或检查某州基础设施等级以决定是否允许驻军补给。

# 在某决议的 available 块中,要求当前国家拥有至少 5 座军工厂
available = {
    building_count_trigger = {
        arms_factory > 4
    }
}

# 在 STATE scope 中,检查该州基础设施是否达到 5 级
limit = {
    building_count_trigger = {
        infrastructure > 4
    }
}

配合关系

  • [free_building_slots](/wiki/trigger/free_building_slots):两者常搭配使用,先用 building_count_trigger 确认已有建筑数量达标,再用 free_building_slots 确认该州是否还有剩余槽位,双重检查后再触发建设效果。
  • [add_building_construction](/wiki/effect/add_building_construction):当 building_count_trigger 判断建筑数量不足时,在 effect 块中用此命令补足建设,形成"检查-补建"的完整逻辑闭环。
  • [any_owned_state](/wiki/trigger/any_owned_state):在 COUNTRY scope 下,常用 any_owned_state 遍历所有领土,再在其内部嵌套 building_count_trigger,检查是否存在某个州达到特定建筑水平。
  • [controls_state](/wiki/trigger/controls_state):与 building_count_trigger 配合,先确认该国实际控制目标州,再检查其建筑等级,避免对无控制权的州触发错误判断。

常见坑

  1. 比较运算符方向混淆:官方语法要求写成 <Building> < <int>(即"建筑数量 小于 某值"),新手容易将"至少有 X 座"误写为 arms_factory < 5,实际上这表示"少于 5 座"为真;若想表达"至少 5 座",应写 arms_factory > 4,逻辑方向务必确认。
  2. 在 COUNTRY scope 下统计结果与预期不符:在国家 scope 下,building_count_trigger 统计的是该国所有拥有州的建筑总量,而非某个特定州的数值;若想针对单一州判断,必须先用 any_owned_state / all_owned_state 等 scope 切换到具体 STATE 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

building_count_trigger is commonly used to determine whether a state or country has established sufficient industrial infrastructure, thereby unlocking subsequent national focuses, decisions, or event options. For example, in industrial development mods, you can require players to construct a certain number of military factories in a target state to trigger expansion events, or check a state's infrastructure level to decide whether to allow garrison supply.

# In the available block of a decision, require the current country to own at least 5 military factories
available = {
    building_count_trigger = {
        arms_factory > 4
    }
}

# In STATE scope, check if the state's infrastructure reaches level 5
limit = {
    building_count_trigger = {
        infrastructure > 4
    }
}

Synergy

  • [free_building_slots](/wiki/trigger/free_building_slots): These two are commonly paired together. First use building_count_trigger to confirm that existing building counts meet the threshold, then use free_building_slots to verify whether the state still has remaining slots available. After this dual verification, trigger the construction effect.
  • [add_building_construction](/wiki/effect/add_building_construction): When building_count_trigger determines that building counts are insufficient, use this command in the effect block to supplement construction, forming a complete logical closure of "check-and-supplement."
  • [any_owned_state](/wiki/trigger/any_owned_state): Under COUNTRY scope, commonly use any_owned_state to iterate through all territories, then nest building_count_trigger within it to check whether any state reaches a specific building level.
  • [controls_state](/wiki/trigger/controls_state): Combined with building_count_trigger, first confirm that the country actually controls the target state, then check its building level, avoiding erroneous judgments on states without control.

Common Pitfalls

  1. Confusion over comparison operator direction: The official syntax requires writing <Building> < <int> (i.e., "building count is less than some value"). Beginners often mistakenly write "at least X factories" as arms_factory < 5, but this actually means "fewer than 5" evaluates to true. To express "at least 5," you should write arms_factory > 4. Always verify the logical direction.
  2. Statistics results under COUNTRY scope differ from expectations: In country scope, building_count_trigger counts the total buildings across all states owned by that country, not the value of a specific state. If you need to judge a single state, you must first switch to a specific STATE scope using any_owned_state / all_owned_state or similar scope commands before calling it; otherwise, the results will be completely different from what you expected.