Wiki

effect · random_core_state

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Executes children effects on random core state that fulfills the "limit" trigger. 
prioritize = { <stateID> <stateID> } to pick those states first if they fulfull the limit

实战 · 配合 · 坑

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

实战用法

random_core_state 常用于国家决议或事件中,对某个国家的随机一块核心领土施加效果,例如在内战、抵抗运动或战后恢复场景中随机选取一个核心州进行处理。配合 prioritize 可优先选取特定重要州,再退而求其次选取其他符合条件的州。

# 示例:某国执行决议后,在其随机一块未被自身控制的核心州触发抵抗事件
country_event = {
    id = example.1
    option = {
        name = example.1.a
        random_core_state = {
            prioritize = { 42 43 }
            limit = {
                NOT = { is_controlled_by = ROOT }
                is_core_of = ROOT
            }
            add_resistance = 15
            set_state_flag = resistance_flare_up
        }
    }
}

配合关系

  • is_controlled_by — 在 limit 内筛选"未被本国控制"或"被敌方控制"的核心州,确保效果只落在有意义的目标上。
  • is_core_of — 配合 limit 二次确认目标州确实是指定国家的核心,避免作用域错位。
  • add_resistance — 常见的子效果之一,用于在选中的核心州上添加抵抗值,模拟占领区不稳定情况。
  • set_state_flag — 给选中的州打标记,防止同一事件链重复触发同一个州。

常见坑

  1. 忘记 limit 导致选中首都或已控制州:不加任何 limit 时,效果会作用于所有核心州中随机一块,包括本国首都所在州,可能产生非预期结果;务必用 limit 明确过滤范围。
  2. 混淆 scope 对象random_core_state 进入的子块 scope 已切换为 STATE,在其中直接使用 COUNTRY 专属 effect(如 add_manpower 在 STATE scope 下语义不同)时需注意参数含义的变化,不要把 ROOT 国家级指令直接写在子块顶层。

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

random_core_state is commonly used in national decisions or events to apply effects to a randomly selected core state of a country — for example, in civil war, resistance movement, or post-war recovery scenarios where one core state is picked at random for processing. Pairing it with prioritize lets you prefer specific important states first, then fall back to other qualifying states.

# Example: After a country executes a decision, trigger a resistance event
# in a random core state not currently controlled by that country
country_event = {
    id = example.1
    option = {
        name = example.1.a
        random_core_state = {
            prioritize = { 42 43 }
            limit = {
                NOT = { is_controlled_by = ROOT }
                is_core_of = ROOT
            }
            add_resistance = 15
            set_state_flag = resistance_flare_up
        }
    }
}

Synergy

  • is_controlled_by — Used inside limit to filter for states "not controlled by this country" or "controlled by an enemy," ensuring the effect only lands on meaningful targets.
  • is_core_of — Combined with limit to double-check that the target state is indeed a core of the specified country, preventing scope mismatches.
  • add_resistance — One of the most common child effects; adds resistance to the selected core state to simulate instability in occupied territory.
  • set_state_flag — Flags the selected state to prevent the same event chain from triggering on the same state more than once.

Common Pitfalls

  1. Forgetting limit, causing the capital or already-controlled states to be selected: Without any limit, the effect can land on any core state at random, including the state containing the country's capital, which may produce unintended results. Always use limit to explicitly narrow the target pool.
  2. Confusing the scope object: The child block inside random_core_state switches scope to STATE. Be careful when using COUNTRY-exclusive effects here — for instance, add_manpower has a different semantic meaning under STATE scope — and avoid writing ROOT country-level directives directly at the top level of the child block.