Wiki

effect · add_extra_state_shared_building_slots

Definition

  • Supported scope:STATE
  • Supported target:none

Description

add extra shared building slot to state

实战 · 配合 · 坑

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

实战用法

add_extra_state_shared_building_slots 常用于奖励玩家占领特定州或完成国策/决议时,为目标州额外增加共享建筑槽位,从而允许在该州建造更多基础设施或工厂。例如在一个"开发殖民地"类决议中,每次执行决议就为目标州解锁额外槽位:

# 在决议的 complete_effect 中,目标 scope 为 STATE
complete_effect = {
    526 = {  # 目标州的 state_id
        add_extra_state_shared_building_slots = 1
        add_building_construction = {
            type = industrial_complex
            level = 1
            instant_build = yes
        }
    }
}

配合关系

  • [add_building_construction](/wiki/effect/add_building_construction):增加槽位后立即安排建筑施工,确保新槽位被有效利用,避免玩家拿到空槽但没有后续引导。
  • [free_building_slots](/wiki/trigger/free_building_slots):在执行前用此触发器检查当前剩余槽位数量,可以设计"仅在槽位不足时才额外补充"的条件逻辑,防止过度堆叠。
  • [set_state_category](/wiki/effect/set_state_category):与州等级调整配合使用,当整体升级州类型时同步追加额外槽位,使两种扩槽手段形成叠加效果。
  • [has_state_flag](/wiki/trigger/has_state_flag):配合 state flag 记录该州已经被加成的次数,避免同一个事件链重复触发导致槽位无上限膨胀。

常见坑

  1. Scope 写错层级:此 effect 必须在 STATE scope 下执行,若直接写在国家 scope(如 country_eventoption 顶层)而未先用 526 = { }capital_scope = { } 切入州 scope,脚本会静默失效且不报错,极难排查。
  2. 误以为可以传负值缩减槽位:该 effect 只能"增加"额外槽位,无法传入负数来回收槽位;若需要动态增减,应改用带负值支持的 [add_state_modifier](/wiki/effect/add_state_modifier) 搭配修正器属性来实现间接控制。

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_extra_state_shared_building_slots is commonly used to reward players with additional shared building slots in a target state when they occupy a specific state or complete a focus/decision, thereby allowing more infrastructure or factories to be constructed. For example, in a "develop colony" type decision, each execution grants the target state additional unlocked slots:

# In the decision's complete_effect, the target scope is STATE
complete_effect = {
    526 = {  # target state's state_id
        add_extra_state_shared_building_slots = 1
        add_building_construction = {
            type = industrial_complex
            level = 1
            instant_build = yes
        }
    }
}

Synergy

  • [add_building_construction](/wiki/effect/add_building_construction): Schedule building construction immediately after adding slots to ensure new slots are utilized effectively, preventing players from receiving empty slots without follow-up guidance.
  • [free_building_slots](/wiki/trigger/free_building_slots): Use this trigger before execution to check the current remaining slot count; you can design conditional logic such as "only supplement additional slots when slots are insufficient," preventing excessive accumulation.
  • [set_state_category](/wiki/effect/set_state_category): Use in combination with state tier adjustments; when upgrading the overall state type, synchronously append extra slots so that both slot expansion methods create a stacking effect.
  • [has_state_flag](/wiki/trigger/has_state_flag): Use with state flags to record how many times a state has already received the bonus, preventing the same event chain from triggering repeatedly and causing slots to inflate without limit.

Common Pitfalls

  1. Incorrect scope hierarchy: This effect must execute under STATE scope; if written directly in country scope (such as at the top level of option in a country_event) without first switching to state scope via 526 = { } or capital_scope = { }, the script will silently fail without error reporting, making it extremely difficult to debug.
  2. Mistakenly assuming negative values can reduce slots: This effect can only "add" extra slots and cannot accept negative numbers to reclaim slots; if dynamic increment/decrement is needed, use [add_state_modifier](/wiki/effect/add_state_modifier) instead with modifier properties to achieve indirect control.