Wiki

trigger · has_state_category

Definition

  • Supported scope:STATE
  • Supported target:none

Description

Check if state has a specific state category

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

has_state_category is commonly used to check the development level or type of a state. For example, it can be placed in a decision's available condition to restrict triggering specific events or construction projects only to states that have reached a certain urbanization threshold. In occupation and compliance mods, it is also frequently used to distinguish between rural and urban states, applying different resistance or compliance modifiers accordingly.

# Example: Allow a decision to execute only when the state category is urban
available = {
    has_state_category = urban
}

Synergy

  • [is_owned_by](/wiki/trigger/is_owned_by): Usually appears alongside ownership checks. First confirm the state belongs to a specific country, then check its category to avoid incorrectly triggering logic on states not controlled by you.
  • [set_state_category](/wiki/effect/set_state_category): Often paired as a "precondition check" and "result execution" pair. First use has_state_category to verify the current category does not match the target, then apply this effect to upgrade or change the category.
  • [state_population](/wiki/trigger/state_population): Population numbers are typically highly correlated with state category. Using both together allows for more precise filtering of "truly major urban states."
  • [compliance](/wiki/trigger/compliance): In occupation scripts, it is common to require both a minimum compliance level and the state category to meet the threshold before allowing policy reforms to proceed.

Common Pitfalls

  1. Using this trigger in non-STATE scope: has_state_category only works in STATE scope. If accidentally written in a trigger block at COUNTRY scope (such as the top-level trigger of a national event), it will cause script parsing errors or silent failures. Ensure proper scope switching via any_neighbor_state, every_neighbor_state, etc. before use.
  2. Misspelling category names: State category identifiers in-game (such as urban, large_city, etc.) are defined in map/state_category.txt. If manually typed names do not match those in the file, the condition will never evaluate to true, and usually no obvious error message will appear, making it easy to overlook during debugging.