Wiki

effect · every_core_state

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Executes children effects on every core State of the country in scope (or \"random_select_amount\" of random state if specified) that fulfills the \"limit\" trigger.
tooltip=key can be added to override tooltip title.
By default the effects are only displayed once, you may display them for each matching state with display_individual_scopes.
ex:
SOV = {
	every_core_state = {
		tooltip = my_loc_key # Optional
		random_select_amount = 3 # Optional
		display_individual_scopes = yes # Optional - default = no
		... state scope effects ...
	}
}

实战 · 配合 · 坑

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

实战用法

every_core_state 常用于战后和平会议或事件中,批量对一个国家的所有核心州执行建设、转让或修改操作,例如为苏联所有核心州补充人力或设置旗帜。也可用于独立事件触发时,将某国所有核心州一次性移交给目标方。

SOV = {
    every_core_state = {
        limit = {
            is_owned_by = GER
        }
        transfer_state_to = SOV
        add_manpower = 1000
    }
}

配合关系

  • is_owned_by — 在 limit 块内配合使用,筛选出当前被特定国家占领的核心州,避免对已经归还的州重复操作。
  • transfer_state_to — 最常见的搭配,将符合条件的每个核心州批量转让给指定国家,常用于和平解决脚本。
  • add_manpower — 对每个核心州逐一添加人力,配合 limit 可只补充被敌占的或满足特定条件的州。
  • set_state_flag — 对每个核心州设置标记,后续可在其他 trigger 中用 has_state_flag 检测该州是否已被本次效果处理过,防止重复触发。

常见坑

  1. 忘记 scope 切换every_core_state 内部已进入 STATE scope,此时直接写国家级 effect(如 add_political_power)会报错或无效,必须用 set_state_owner_toadd_manpower 等州级命令,若确需执行国家级操作须先用 owner = { ... } 跳回国家 scope。
  2. random_select_amountlimit 的顺序逻辑误解random_select_amount 是从已通过 limit 筛选的州中随机抽取指定数量执行,而非先随机再过滤,若 limit 条件过严导致可选州数量小于 random_select_amount,游戏只会对实际存在的州执行,不会报错但结果可能与预期数量不符。

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

every_core_state is commonly used in post-war peace conferences or events to perform bulk construction, transfers, or modifications across all core states of a given country — for example, replenishing manpower or setting flags on every Soviet core state. It can also be used when an independence event fires to transfer all of a nation's core states to the target country in a single pass.

SOV = {
    every_core_state = {
        limit = {
            is_owned_by = GER
        }
        transfer_state_to = SOV
        add_manpower = 1000
    }
}

Synergy

  • is_owned_by — Used inside a limit block to filter for core states currently owned by a specific country, preventing duplicate operations on states that have already been returned.
  • transfer_state_to — The most common pairing; bulk-transfers every qualifying core state to the specified country. Frequently used in peaceful resolution scripts.
  • add_manpower — Adds manpower to each core state individually. Combined with limit, this can be restricted to enemy-occupied states or those meeting specific conditions.
  • set_state_flag — Sets a flag on each core state, which can later be checked with has_state_flag in other triggers to determine whether a state has already been processed by this effect, preventing repeated triggers.

Common Pitfalls

  1. Forgetting scope switching: Inside every_core_state you are already in STATE scope, so writing country-level effects directly (such as add_political_power) will cause errors or have no effect. You must use state-level commands like set_state_owner_to or add_manpower. If a country-level operation is genuinely needed, you must first jump back to country scope using owner = { ... }.
  2. Misunderstanding the interaction between random_select_amount and limit: random_select_amount randomly draws the specified number of states from those that have already passed the limit filter — it does not randomly select first and then filter. If the limit conditions are too strict and fewer states are available than the value of random_select_amount, the game will simply execute on however many states actually exist. No error is thrown, but the result may not match the expected count.