Wiki

effect · add_building_construction

Definition

  • Supported scope:STATE
  • Supported target:none

Description

Starts building construction for amount of levels in specified state or province

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

add_building_construction 常用于在事件、决策或焦点完成时为某个州立即启动建筑工程,而不是直接跳过施工队列瞬间完成建筑,适合模拟"国家投资启动项目"的过程感。例如在一个工业援助决策中,为目标州排队开始建造工厂:

# 在 STATE scope 内执行(如事件 option 中已 scope 到目标州)
add_building_construction = {
    type = industrial_complex
    level = 2
    instant_build = no
}

配合关系

  • [free_building_slots](/wiki/trigger/free_building_slots) — 执行前先检查该州是否还有空余建筑槽位,避免因槽位不足导致工程无法启动的逻辑错误。
  • [add_extra_state_shared_building_slots](/wiki/effect/add_extra_state_shared_building_slots) — 当槽位不够时先扩展共享槽位,再紧接着调用本 effect 开始施工,两者形成"开槽→建造"的标准组合。
  • [can_construct_building](/wiki/trigger/can_construct_building) — 作为前置 trigger 验证当前州是否满足该建筑的所有建造条件(科技、资源、地形限制等),防止脚本静默失败。
  • [set_building_level](/wiki/effect/set_building_level) — 若需要直接跳过施工队列瞬间完成,可改用此 effect;两者互为替代,根据是否需要"施工过程"来选择。

常见坑

  1. 忘记 instant_build 字段的含义:不填或填 no 时工程会进入正常施工队列,受民用工厂数量影响,许多新手误以为 effect 没有生效,实际只是还在建造中;若测试时想立竿见影,需显式写 instant_build = yes,但正式 mod 中滥用此字段会破坏游戏平衡。
  2. 在非 STATE scope 下直接调用:本 effect 仅在 STATE scope 下有效,若在 COUNTRY scope 的焦点 complete_effect 中忘记用 capital_scope 或具体州变量切换 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

add_building_construction is commonly used in events, decisions, or focus completions to queue a building construction in a state immediately, rather than instantly completing the building and bypassing the construction queue. This is suitable for simulating the procedural feel of "national investment launching projects." For example, in an industrial aid decision, you can queue the construction of a factory in a target state:

# Execute within STATE scope (e.g., already scoped to the target state in an event option)
add_building_construction = {
    type = industrial_complex
    level = 2
    instant_build = no
}

Synergy

  • [free_building_slots](/wiki/trigger/free_building_slots) — Check before execution whether the state still has available building slots, preventing logic errors caused by insufficient slots preventing construction from starting.
  • [add_extra_state_shared_building_slots](/wiki/effect/add_extra_state_shared_building_slots) — When slots are insufficient, expand shared slots first, then immediately call this effect to begin construction, forming a standard "expand slots → build" combination.
  • [can_construct_building](/wiki/trigger/can_construct_building) — Use as a prerequisite trigger to verify that the state meets all construction conditions for the building (technology, resources, terrain restrictions, etc.), preventing silent script failures.
  • [set_building_level](/wiki/effect/set_building_level) — If you need to instantly complete the building and bypass the construction queue, use this effect instead; the two are mutually substitutable, choose based on whether you need the "construction process."

Common Pitfalls

  1. Forgetting the meaning of the instant_build field: When omitted or set to no, the construction enters the normal construction queue and is affected by the number of civilian factories. Many newcomers mistakenly believe the effect didn't work, when in reality construction is still in progress; if you want immediate results during testing, you must explicitly write instant_build = yes, but overusing this field in official mods will break game balance.
  2. Calling directly outside STATE scope: This effect only works within STATE scope. If you forget to switch scope using capital_scope or a specific state variable in a focus's complete_effect under COUNTRY scope and call it directly, the game won't report an error but the construction won't be created, making it extremely difficult to debug.