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
}
has_railway_levelanyanyChecks if a state contains a railway at or above the specified level. Example:
has_railway_level = {
level = 3
state = 1234
}
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
has_railway_level 常用于基础设施相关的决策或事件判断,例如限定某个补给改善决策只有在目标州铁路达到一定等级后才可选,或在科技/焦点完成后检查补给路线是否满足触发特定奖励的条件。
# 决策 available 块:仅当首都州(1234)铁路至少 3 级时可用
available = {
has_railway_level = {
level = 3
state = 1234
}
}
[can_build_railway](/wiki/trigger/can_build_railway):先用 can_build_railway 判断该州是否允许建设铁路,再用 has_railway_level 确认当前等级,形成"能建且已达标"的双重过滤逻辑。[build_railway](/wiki/effect/build_railway):常作为 effect 侧的对应命令——trigger 检测等级不足时,在 else 分支用 build_railway 补建,实现"未达标则自动升级"的模式。[has_railway_connection](/wiki/trigger/has_railway_connection):两者配合可同时验证"州际联通"与"等级是否达标",适用于补给线或工业协同的复合条件检测。[any_state_in](/wiki/trigger/any_state_in):遍历某一组州时嵌套 has_railway_level,批量检查多个州的铁路等级是否均满足要求。state 字段填省份 ID 而非州 ID:state 参数需要填写**州(state)**的数字 ID,而非省份(province)ID,两者在游戏内经常被混淆,填错后条件永远不会触发且不报错。state 字段:该 trigger 必须显式指定 state,不会自动继承当前 scope 的州,遗漏 state 字段会导致解析错误或判断失效。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.
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
}
}
[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.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.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.