Skip to content

Defence station

A Defence station is a Station subtype dedicated to combat. It hosts defence modules (turrets, missile batteries, defence drones), patrol fighters, and acts as the strategic stronghold of a sector. Defence stations don’t produce wares — they exist to deny enemy movement.

This page documents Defence-station-specific behavior. For all general station behavior (creation, ownership, hull, dockingbays, events), see the parent Station page.

FlagMeaning
.isdefencestationCurrently a defence station
.isplanneddefencestationPlanned/in-construction to be a defence station

For early detection during construction, use .isplanneddefencestation (vanilla factionlogic_stations.xml:241).

All accessors live on the parent station datatype (scriptproperties.xml:848). There is no separate defencestation datatype.

PropertyTypeDescription
.isdefencestationboolCurrently a defence station
.isplanneddefencestationboolPlanned to be a defence station
.dps.all / .dps.turrets.allhp/sCombined DPS — typically very high on defence stations
.maxcombatrange.turretslengthMax turret reach
.hasarmeddefencedronesboolHas armed defence drones available
.iscapturableboolDefence stations are typically not boardable (large hull, high resistance)
.alertlevelalertlevelRed / yellow / green — drives turret activation
<find_station_by_true_owner name="$Candidates"
space="player.galaxy"
multiple="true"
sortbydistanceto="player.ship"/>
<set_value name="$found" exact="null"/>
<do_for_each name="$station" in="$Candidates">
<do_if value="$station.isdefencestation">
<set_value name="$found" exact="$station"/>
<break/>
</do_if>
</do_for_each>

"Bias fight-mission offers at defence stations”

Section titled “"Bias fight-mission offers at defence stations””
<set_value name="$Chance_Fight"
exact="$Chance_High"
chance="100 * $OfferObject.isdefencestation"/>

Pattern from vanilla genericmissions.xml:313 — defence stations bias mission offers toward combat tasks (parallel to pirate bases).

”Filter pure defence stations (not wharf/shipyard hybrids)”

Section titled “”Filter pure defence stations (not wharf/shipyard hybrids)””
<do_if value="$station.isdefencestation
and not ($station.iswharf or $station.isshipyard)">
<!-- pure defence — no shipbuilding -->
</do_if>

Pattern from vanilla gmc_retrieve_dead_drop.xml:2292.

”Watch for player capturing a defence station”

Section titled “”Watch for player capturing a defence station””
<cue name="WatchDefenceCapture" instantiate="true">
<conditions>
<event_object_changed_owner/>
<check_value
value="event.object.isdefencestation
and event.param == faction.player"/>
</conditions>
<actions>
<write_to_logbook
text="'Player captured defence station: '
+ event.object.knownname"/>
</actions>
</cue>

Defence stations have special NPC instantiation rules (vanilla npc_instantiation.xml:1634, 2057). Most defence stations have minimal civilian NPCs — only a defence NPC, a representative-of-sorts, and maintenance crew. Player-owned defence stations get the full NPC complement; NPC-owned ones stay sparse to save resources.

If your mod adds custom NPCs to defence stations, be aware: the engine may cull them during sparsification if not isplayerowned.

Defence stations are constructed using:

  • Group: defence_<faction_3-letter-code> (e.g. defence_arg, defence_tel) in libraries/stationgroups.xml.
  • Plan: e.g. arg_defence in libraries/constructionplans.xml.

A typical defence station has many defence modules, several storage modules (for ammo and repair supplies), connection modules, and habitation for crew. Production modules are absent.

  • .isdefencestation is FALSE during construction. Use .isplanneddefencestation for early detection.
  • Defence stations can be hybrid (shipyard / wharf / equipment dock combined). Don’t assume mutual exclusion. The pure-defence filter is .isdefencestation and not (.iswharf or .isshipyard).
  • Defence stations are typically NOT capturable. .iscapturable=false for most macros; high boarding resistance, no signal leak. Don’t write mods that assume the player can board them.
  • NPC-owned defence stations have reduced NPC population. Engine sparsifies — your custom NPC additions may get culled. Check .isplayerowned before injecting characters.
  • Turret activation depends on alert level. A defence station at alertlevel.green has turrets deactivated. Set alert state via set_alertlevel if your mod needs guaranteed combat readiness.
  • A faction can lose its defence station mid-game. Sector ownership flip → defence station likely destroyed. Listen for event_object_destroyed on watched stations.
  • How factions decide where to build defence stations: Architectural overview Faction goalsfactiongoal_hold_space evaluates sector value; defence stations placed at chokepoints (entry gates).
  • Static defence positioning: Architectural overview Static defence positioningfactionlogic_staticdefense.xml scores each gate by destination ownership, places defence assets accordingly.
  • NPC sparsification: Architectural overview NPC instantiation — engine-side rule that defence stations get fewer NPCs to manage performance.
  • Station — parent abstraction (all general properties/actions live there).
  • Faction — owner; faction goals drive placement.
  • Shipyard — sibling; some defence stations are also shipyards (rare).
  • Wharf — sibling; defence + wharf combo possible.
  • Defence module — the contained part providing combat capability.
  • Sector — what the defence station defends.