Wiki

trigger · ships_in_area

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

checks for amount of ships in specified area

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

ships_in_area is commonly used to detect naval presence of a country in a specific sea region—for instance, in naval combat events or decisions to determine whether the player or AI has deployed a sufficient fleet in the target area, thereby triggering subsequent storylines or unlocking specific options. Typical scenarios include checking whether your own ships are positioned before imposing a blockade on a shipping lane, or validating in a mission chain whether the player has completed a strategic deployment.

# Example: checking whether your country has sufficient ships in the North Sea region as an available condition for a decision
decision_example = {
    available = {
        ships_in_area = {
            area = north_sea
            count > 5
            type = ship
        }
    }
}

Synergy

  • [has_navy_size](/wiki/trigger/has_navy_size) (if present in the whitelist) → can alternatively be replaced with [any_navy_leader](/wiki/trigger/any_navy_leader): detects whether a naval commander exists; combined with ships_in_area, you can simultaneously confirm both fleet deployment and command chain integrity.
  • [controls_state](/wiki/trigger/controls_state): confirm that your side controls coastal states/provinces; then use ships_in_area to verify ship presence in the corresponding sea region. Together, these precisely describe "coastal blockade" conditions.
  • [convoy_threat](/wiki/trigger/convoy_threat): in combination with ships_in_area, both check your own fleet scale and assess the opponent's convoy escort pressure, suitable for determining whether to initiate a submarine warfare decision.
  • [destroy_ships](/wiki/effect/destroy_ships): after ships_in_area confirms that ships exist in the region, you can execute destroy commands in the effect block, forming a complete logical closure of "check and eliminate if present".

Common Pitfalls

  1. Incorrect area field: the area field must contain a strategic sea region ID as defined in the game (such as north_sea, english_channel, etc.). Directly entering a province ID or state ID will cause the trigger to fail silently without error messages, always returning false—a frustration for newcomers trying to debug.
  2. Ignoring scope restrictions: ships_in_area can only be used in COUNTRY scope; placing it in STATE scope (for example, within a trigger block of a particular state) will cause script errors or abnormal behavior. You must first switch back to COUNTRY scope using constructs like owner = { ... } before invoking it.