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
- 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.
- 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.