Wiki

trigger · state_population_k

Definition

  • Supported scope:STATE
  • Supported target:none

Description

check the population in the state in thousands (use to avoid variable overflows)

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

state_population_k is commonly used for population threshold detection scenarios, such as determining whether a region has sufficient population to allow construction of specific facilities, trigger immigration events, or unlock certain decisions. Compared to state_population, it accepts values in thousands, effectively preventing integer overflow issues that can occur with large numbers in script variable calculations.

# Only allow this decision to execute if the state population exceeds 500,000 (i.e., 500k)
available = {
    state_population_k > 500
}

Synergy

  • [state_population](/wiki/trigger/state_population): Similar functionality; use this trigger when you need precise single-unit comparisons for small population values. Combining both triggers enables a two-level coarse-to-fine filtering approach.
  • [has_state_category](/wiki/trigger/has_state_category): Population is often strongly correlated with state category. Pairing it with state category checks constructs more robust conditions (e.g., "major city AND population exceeds threshold").
  • [set_state_category](/wiki/effect/set_state_category): In effect blocks, automatically upgrade or downgrade state category based on population conditions—this is the classic integration pattern: first use state_population_k to check the threshold, then apply this effect to change the tier.
  • [compliance](/wiki/trigger/compliance): Population scale and compliance often jointly determine occupation policy yields. Using both together filters for high-value states that are "populous AND compliant".

Common Pitfalls

  1. Unit Confusion: Beginners often mistakenly input raw population values (e.g., 1000000) directly, but this trigger uses thousands as its unit. The correct syntax is state_population_k > 1000. Using raw values causes the condition to never evaluate as true or produces logic errors.
  2. Scope Misuse: state_population_k only works within STATE scope. Calling it directly in COUNTRY or CHARACTER scope will cause an error. You must first switch to the correct scope using constructs like any_owned_state or every_state before using it.