Wiki

trigger · is_coastal

Definition

  • Supported scope:STATE
  • Supported target:none

Description

check if state is coastal

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

is_coastal 常用于判断某个州是否临海,从而决定是否允许建造海军基地、触发特定的沿海事件,或者限制某些决议的可用范围。例如在一个"沿海工业开发"决议中,可以用它来确保玩家只在滨海州才能激活该决议:

available = {
    is_coastal = yes
    is_controlled_by = ROOT
    free_building_slots > 1
}

配合关系

  • [is_capital](/wiki/trigger/is_capital):同时检查是否是首都,可筛选出"沿海首都"这一特殊场景,常用于港口首都相关的事件逻辑。
  • [has_state_category](/wiki/trigger/has_state_category):沿海判断通常还需结合州的规模分类,确保只在足够大的临海州执行建设或奖励。
  • [add_building_construction](/wiki/effect/add_building_construction):确认州为沿海后,随即触发海军基地或船坞的建设,是最直接的后续 effect 搭配。
  • [any_neighbor_state](/wiki/trigger/any_neighbor_state):用于判断相邻州是否也是沿海,配合 is_coastal 构建区域连通性检查逻辑。

常见坑

  1. 在非 STATE scope 下使用:新手有时在 COUNTRY scope 的条件块里直接写 is_coastal = yes,这会导致脚本报错或永远不触发,必须先通过 any_owned_stateevery_state 等切换到 STATE scope 后再使用。
  2. 误以为"临海州"等于"有海军基地"is_coastal 只检查地理上的海岸线属性,并不代表该州已有港口或可以立即出动海军,不要将其与建筑存在性判断混用而省略 building_count_trigger 等额外检查。

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

is_coastal is commonly used to determine whether a state has access to the coast, and thus whether to permit naval base construction, trigger specific coastal events, or restrict the availability of certain decisions. For example, in a "Coastal Industrial Development" decision, it can be used to ensure players can only activate the decision in coastal states:

available = {
    is_coastal = yes
    is_controlled_by = ROOT
    free_building_slots > 1
}

Synergy

  • [is_capital](/wiki/trigger/is_capital): Check simultaneously whether a state is a capital to filter for the special case of "coastal capitals," commonly used in port capital-related event logic.
  • [has_state_category](/wiki/trigger/has_state_category): Coastal checks typically need to be combined with state category classification to ensure construction or rewards only execute in sufficiently large coastal states.
  • [add_building_construction](/wiki/effect/add_building_construction): After confirming a state is coastal, immediately trigger naval base or shipyard construction—the most direct companion effect pairing.
  • [any_neighbor_state](/wiki/trigger/any_neighbor_state): Used to check whether adjacent states are also coastal; combined with is_coastal, it builds region connectivity verification logic.

Common Pitfalls

  1. Using outside STATE scope: Beginners sometimes write is_coastal = yes directly in condition blocks under COUNTRY scope, which causes script errors or prevents the trigger from ever firing. You must first switch to STATE scope via any_owned_state, every_state, etc. before using it.
  2. Confusing "coastal state" with "has naval base": is_coastal only checks the geographic coastline attribute and does not guarantee the state already has a port or can immediately deploy a navy. Do not conflate this with building existence checks or omit additional checks like building_count_trigger.