Wiki

trigger · free_building_slots

Definition

  • Supported scope:STATE
  • Supported target:none

Description

checks building for available construction levels 
free_building_slots = { 
	building = building_type 
	size > 5 
	include_locked = yes # Optional - only to be used for buildings using Shared Slots. 
	province = 42 #will check province buildings if specified 
}

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

free_building_slots is commonly used in mods to restrict the trigger conditions for certain decisions or events—for example, only allowing players to activate a "Industrial Expansion Plan" decision when a state has sufficient free building slots. It also works well in available blocks to prevent construction-type effects from being triggered when the build queue is full, thereby avoiding silent construction failures.

# Example: Allow decision trigger only when a state has more than 3 free general building slots
available = {
    free_building_slots = {
        building = industrial_complex
        size > 3
    }
}

Synergy

  • [non_damaged_building_level](/wiki/trigger/non_damaged_building_level): Use it first to confirm the current building level, then use free_building_slots to check remaining available slots. The combination of both allows precise description of the dual threshold "how much has been built, how much can still be built."
  • [add_building_construction](/wiki/effect/add_building_construction): Once trigger conditions are met, use it immediately afterward to add buildings to the construction queue. This is the most direct "condition → construction" pairing.
  • [has_state_category](/wiki/trigger/has_state_category): When combined with free_building_slots, it further restricts conditions to specific state categories (such as urban states or rural states), preventing high-consumption construction decisions from being triggered in small states with minimal base slots.
  • [add_extra_state_shared_building_slots](/wiki/effect/add_extra_state_shared_building_slots): When free_building_slots detects insufficient shared slots, this effect can expand the slots before construction. The include_locked = yes parameter is specifically designed for such shared slot scenarios.

Common Pitfalls

  1. Ignoring the applicable scope of include_locked: include_locked = yes only has meaning for building types that use Shared Slots. If this parameter is added to standard independent slot buildings (such as arms_factory), it will not cause an error but will produce no additional effect either, easily leading to logic errors.
  2. Omitting the building field causing script errors or abnormal behavior: building is a required field. Many newcomers write only size > X while omitting the building type, which prevents the game from determining which type of building slot to check. At minimum, the trigger always returns false; at worst, the game throws a script error on startup.