Hands-On Usage
remove_building is commonly used in scripted events or national focuses to demolish infrastructure in a specific country or state, such as dismantling industrial facilities as punitive post-war measures or destroying airports through espionage operations. Within STATE scope, you can omit the state/province field and directly specify state-level buildings, making it ideal for batch processing of occupied territories:
# National focus effect: remove one level of air base from target state (within STATE scope)
every_controlled_state = {
limit = {
is_on_same_continent_as = ROOT
}
remove_building = {
type = air_base
level = 1
}
}
Synergy
[free_building_slots](/wiki/trigger/free_building_slots): Check remaining building slots before removal to ensure removal logic synchronizes with slot management and prevents unexpected negative slot counts.
[add_building_construction](/wiki/effect/add_building_construction): Frequently paired with removal—demolish old buildings then reconstruct new ones to achieve a "replacement" effect, such as upgrading basic factories to military factories in scripted scenarios.
[damage_building](/wiki/effect/damage_building): Both can reduce building levels, but damage_building emphasizes damage from combat or bombing, while remove_building focuses on active script-driven removal. Understanding this distinction helps you choose the command that better matches your narrative intent.
[has_built](/wiki/trigger/has_built): Confirm the building actually exists before executing removal to prevent script errors or unexpected log warnings from attempting to demolish non-existent structures.
Common Pitfalls
- Province-level buildings must specify province: Beginners working in STATE scope write
type = air_base but forget to specify province for province-level buildings (such as airports). The official documentation clearly states that without specifying province, the command will not recursively search for province-level buildings, resulting in a silent failure that is extremely difficult to debug.
- COUNTRY scope must explicitly specify state or province: When called within country scope, omitting the
state = ... or province = ... field leaves the game unable to determine the target location, causing the effect to fail silently. You must explicitly provide numeric values or variables (such as var:target_state).