effect · set_state_owner
Definition
- Supported scope:
COUNTRY - Supported target:
none
Description
set owner for state
set_state_ownerCOUNTRYnoneset owner for state
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
set_state_owner 常用于领土转让、和平谈判结果模拟或剧本事件中强制改变某省份的归属国,例如让一个国家在事件触发后将特定州划归另一个国家。需要注意它作用在 COUNTRY scope 下,通过 = { id = <state_id> } 的形式指定目标州。
# 德国在事件中将阿尔萨斯归还给法国
GER = {
set_state_owner = {
id = 11 # 阿尔萨斯-洛林 state ID
owner = FRA
}
}
[add_state_core](/wiki/effect/add_state_core):转移领土后通常同步处理核心归属,避免原主国持续对该州拥有核心而引发 AI 收复行为。[add_state_claim](/wiki/effect/add_state_claim):若新领土的主张尚未建立,可先为接收国添加主张,使转让在外交逻辑上更合理。[controls_state](/wiki/trigger/controls_state):在 trigger 检测中确认某国实际控制该州后,再执行所有权转移,防止出现所有权与控制权严重脱节的状态。[every_owned_state](/wiki/effect/every_owned_state):批量遍历并转让多个州时,可与条件过滤结合,替代逐条写死 state ID 的繁琐写法。set_state_owner 只改变州的所有者(owner),不改变实际军事控制方(controller)。若该州仍被第三方军队占领,控制权依然属于占领方,需额外处理控制逻辑,否则游戏内会出现"被占领"状态的异常显示。add_state_core / 移除相关 modifier 等手段一并整理,否则剧本效果会被 AI 行为迅速破坏。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.
set_state_owner is commonly used in territory transfers, peace negotiation simulations, or scripted events to forcibly change the ownership of a state. For example, you can use it to have a country transfer a specific state to another nation upon event trigger. Note that it operates in COUNTRY scope and specifies the target state via the = { id = <state_id> } syntax.
# Germany returns Alsace to France in an event
GER = {
set_state_owner = {
id = 11 # Alsace-Lorraine state ID
owner = FRA
}
}
[add_state_core](/wiki/effect/add_state_core): After transferring territory, it is common practice to synchronously update core ownership to prevent the original owner from retaining cores and triggering AI reconquest behavior.[add_state_claim](/wiki/effect/add_state_claim): If claims on the new territory have not yet been established, you can first add claims for the receiving nation to make the transfer more logically sound from a diplomatic perspective.[controls_state](/wiki/trigger/controls_state): In trigger checks, confirm that a country actually controls the state before executing ownership transfers, preventing severe desynchronization between ownership and control.[every_owned_state](/wiki/effect/every_owned_state): When bulk transferring multiple states, combine this with conditional filters to avoid the tedious approach of hardcoding individual state IDs.set_state_owner only changes the state's owner, not the actual military controller. If the state is still occupied by a third party's forces, control remains with the occupier. You must handle control logic separately; otherwise, the game will display an abnormal "occupied" status.add_state_core / removal of related modifiers and other adjustments; otherwise, the scripted effect will be rapidly undermined by AI behavior.