Wiki

effect · set_state_controller_to

Definition

  • Supported scope:STATE
  • Supported target:THIS

Description

Set controller of a state to a given country
Example:\n"
USA {
	random_core_state = {
		set_state_controller_to = JAM
	}
}

实战 · 配合 · 坑

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

实战用法

set_state_controller_to 常用于解放战争、傀儡国建立或事件触发后将某省份的实际控制权交给特定国家,而不改变其主权归属。例如在和平协议脚本或内战事件中,将某地区的控制权划拨给新生政权:

# 内战结束事件:将核心州的控制权移交给叛军方
country_event = {
    id = civil_war.10
    immediate = {
        random_core_state = {
            limit = { is_controlled_by = ROOT }
            set_state_controller_to = REB
        }
    }
}

配合关系

  • [set_state_owner_to](/wiki/effect/set_state_owner_to):控制权与所有权往往需要同步设置,单独改控制者而不改所有者会导致"占领状态",配合使用可完整转让一块土地。
  • [transfer_state_to](/wiki/effect/transfer_state_to):若需要同时转让所有权与控制权并触发相关外交逻辑,可用此命令替代或在之后补充,避免只改控制者留下孤立的所有权归属。
  • [is_controlled_by](/wiki/trigger/is_controlled_by):在 limit 块中先用此触发器确认当前控制者,防止对错误国家执行控制权变更,特别在 every_neighbor_state 批量操作时尤为重要。
  • [set_occupation_law](/wiki/effect/set_occupation_law):更换控制国后,新控制者的占领法规不会自动更新,需手动设置以避免继承旧控制国的占领政策。

常见坑

  1. 混淆"控制者"与"所有者":本命令只改变 controller(控制方),不改变 owner(所有国)。新手常误以为执行后该州就"属于"目标国,但实际上主权仍归原属国,目标国只是占领者身份,抵抗度、合规度机制依然以原所有国为基准运作。
  2. 在非 STATE scope 下调用:此命令必须在州级 scope 内执行。若在国家 scope 下直接写 set_state_controller_to = XXX 而没有通过 random_core_stateevery_state 等先进入州 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

set_state_controller_to is commonly used in liberation wars, puppet state establishment, or event-triggered scenarios to transfer actual control of a state to a specific country without changing its sovereignty. For example, in peace conference scripts or civil war events, you can reassign regional control to a newly formed regime:

# Civil war resolution event: transfer core state control to rebel faction
country_event = {
    id = civil_war.10
    immediate = {
        random_core_state = {
            limit = { is_controlled_by = ROOT }
            set_state_controller_to = REB
        }
    }
}

Synergy

  • [set_state_owner_to](/wiki/effect/set_state_owner_to): Control and ownership typically need to be set in sync. Changing only the controller without updating the owner leaves the state in an "occupied" status. Using both commands together ensures a complete land transfer.
  • [transfer_state_to](/wiki/effect/transfer_state_to): If you need to transfer both ownership and control while triggering related diplomatic logic, use this command instead or as a follow-up to avoid leaving orphaned ownership while only changing the controller.
  • [is_controlled_by](/wiki/trigger/is_controlled_by): Use this trigger in limit blocks to confirm the current controller before executing control changes, preventing unintended modifications to the wrong country. This is especially critical when performing batch operations with every_neighbor_state.
  • [set_occupation_law](/wiki/effect/set_occupation_law): After changing the controlling nation, the new controller's occupation law does not update automatically. You must set it manually to avoid inheriting the previous controller's occupation policies.

Common Pitfalls

  1. Confusing "controller" with "owner": This command only changes the controller, not the owner. Beginners often mistakenly believe the state "belongs" to the target country after execution, but sovereignty actually remains with the original owner. The target country only has occupier status, and resistance/compliance mechanics still function based on the original owner as the baseline.
  2. Calling outside STATE scope: This command must execute within a state-level scope. If you write set_state_controller_to = XXX directly under a country scope without first entering a state scope via random_core_state, every_state, etc., the script will silently fail or produce errors. Game logs often provide unclear feedback, making debugging difficult.