Hands-On Usage
construct_building_in_random_province is ideal for use in events or decisions to quickly place facilities (such as airports, radar stations, and other province-level buildings) in a random province within a state without needing to manually specify a particular province ID. It's commonly used in mod scenarios involving randomized rewards or dynamic infrastructure development. The example below shows how to add one level of land facility to a random province in state 65 for Germany in an event:
GER = {
65 = {
construct_building_in_random_province = {
land_facility = 1
}
}
}
Synergy
[any_province_building_level](/wiki/trigger/any_province_building_level) — Check in trigger conditions whether the state already has province-level buildings at the required level to avoid duplicate construction exceeding the cap.
[add_building_construction](/wiki/effect/add_building_construction) — The two effects complement each other: the former targets random placement of province-level facilities, while the latter applies to state-level building construction queues. They're often combined to achieve the complete effect of "upgrading infrastructure simultaneously."
[free_building_slots](/wiki/trigger/free_building_slots) — Verify before execution that the state still has available building slots to prevent silent failure due to insufficient slots.
[add_extra_state_shared_building_slots](/wiki/effect/add_extra_state_shared_building_slots) — When slots are insufficient, first expand shared slots using this command, then invoke this effect to ensure successful construction.
Common Pitfalls
- Confusing province-level and state-level buildings: This effect can only place province-level facilities (such as
land_facility, air_base, and other province-level fields). If you mistakenly enter state-level building fields (such as industrial_complex), the effect will not work and typically won't produce an error, making it easy for new users to spend considerable time debugging.
- Overlooking the two-layer scope nesting: You must satisfy the structure of "country scope on the outside, state scope on the inside" simultaneously. If you call the effect directly under state scope while omitting the outer country scope, the game cannot correctly parse the target, causing the effect to fail silently.