在 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
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.
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.