Wiki

effect · set_building_level

Definition

  • Supported scope:STATE
  • Supported target:none

Description

Sets specific level of a building construction for amount of levels in specified state or province

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

set_building_level is commonly used in mod events or decisions to directly set a state's building level to a fixed value. It's ideal for map initialization, rebuilding infrastructure after triggering special events, or using decisions to instantly max out specific buildings. For example, in an "Industrial Aid" decision, you can directly set the target state's civilian factory to a specified level:

# Executed within STATE scope
set_building_level = {
    building = industrial_complex
    level = 5
    instant_build = yes
}

Synergy

  • [non_damaged_building_level](/wiki/trigger/non_damaged_building_level): Check the current undamaged building level before executing set_building_level to avoid redundant assignments or logical conflicts.
  • [damage_building](/wiki/effect/damage_building): You can first use damage_building to destroy a building to a specific state, then use set_building_level to rebuild it, simulating a "destroy then rebuild" narrative sequence.
  • [add_extra_state_shared_building_slots](/wiki/effect/add_extra_state_shared_building_slots): After increasing building levels, you may exceed the available slot limit. Combine this command to preemptively expand shared building slots and ensure valid values.
  • [free_building_slots](/wiki/trigger/free_building_slots): Validate that sufficient free slots remain before setting a building level to prevent silent failures due to insufficient slots.

Common Pitfalls

  1. Ignoring building slot limits: set_building_level directly sets the level, but if the target level exceeds the state's current available building slots, the effect may be truncated or silently fail. Always verify sufficient slots exist or use add_extra_state_shared_building_slots to reserve space in advance.
  2. Confusing with add_building_construction: set_building_level is an immediate hard set that bypasses the construction queue process. Without the instant_build = yes field (required in certain versions/building types), unexpected behavior may occur. Pay attention to the fundamental difference from add_building_construction (which follows the normal construction queue).