Wiki

trigger · has_railway_level

Definition

  • Supported scope:any
  • Supported target:any

Description

Checks if a state contains a railway at or above the specified level. Example:
has_railway_level = {
  level = 3
  state = 1234
}

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_railway_level is commonly used in infrastructure-related decisions or event checks, such as restricting certain supply improvement decisions to only be available after a target state's railway reaches a certain level, or checking whether supply routes meet the conditions to trigger specific rewards after technology/focus completion.

# Decision available block: only available when capital state (1234) has railway level at least 3
available = {
    has_railway_level = {
        level = 3
        state = 1234
    }
}

Synergy

  • [can_build_railway](/wiki/trigger/can_build_railway): First use can_build_railway to check if the state allows railway construction, then use has_railway_level to confirm the current level, forming a dual-filter logic of "can build and meets standard".
  • [build_railway](/wiki/effect/build_railway): Commonly serves as the corresponding command on the effect side—when trigger detects insufficient level, use build_railway in the else branch to retroactively upgrade, implementing the "auto-upgrade if below standard" pattern.
  • [has_railway_connection](/wiki/trigger/has_railway_connection): Both can be used together to verify "inter-state connectivity" and "whether level meets standard", suitable for composite condition detection in supply lines or industrial synergy.
  • [any_state_in](/wiki/trigger/any_state_in): When iterating over a group of states, nest has_railway_level within to batch-check whether the railway levels of multiple states all meet requirements.

Common Pitfalls

  1. Filling the state field with province ID instead of state ID: The state parameter requires the numeric ID of the state, not the province ID. These are often confused in-game, and using the wrong one will cause the condition to never trigger without any error message.
  2. Omitting the state field in non-any scope contexts: This trigger must explicitly specify state and will not automatically inherit the current scope's state. Omitting the state field will result in parsing errors or failed condition evaluation.