Skip to content

Missions

A mission in X4 is anything the player accepts that produces an objective marker, tracks progress, and pays out at completion. Vanilla has six distinct categories of mission, each with its own code path. They share a common event API (event_mission_aborted, create_mission action, .hasmission accessor) but the rest of their lifecycle differs.

CategoryCode lives inExamplesPage
Storystory_*.xmlParanid story, Buccaneers (Pirate), Welfare researchStory missions
Generic (BBS-style)gm_*.xml + gmc_*.xml + rml_*.xmlFind object, board ship, deliver wares, escortGeneric missions
Faction subscriptionx4ep1_*_subscriptions.xmlWar subs, Trade subs, Pirate subs, Mentor subsSubscription missions
Plotplot.xmlClaim plot of space (sector ownership)Plot missions
Tutorialtutorial_*.xmlFlight basics, mining, stationsTutorial missions
Reusable phasesrml_*.xmlBuilding blocks reused by gm_/story_/subscriptionSee Generic missions

For the layered architecture of how gm_*/gmc_*/rml_* compose, see Architectural overview: Mission framework.

Whatever the category, a mission follows the same 5-step flow:

Offer creation β†’ create_mission (action) β€” sets up the offer
↓
Player discovers β†’ event_player_discovered_mission_offer
↓
Player accepts β†’ event_briefing_started + accept (LIB c_mission_accept)
↓
Progress tracking β†’ custom per-mission cues, sub-objectives
↓
Resolution β†’ completion (reward) / event_mission_aborted (cleanup)

Each category implements the middle three steps differently, but create_mission and event_mission_aborted are universal β€” see Mission events for the full event catalog.

You want to add…Use category
Hand-authored narrative for a factionStory
Repeatable BBS-style player-pick missionsGeneric
Faction-loyalty repeating offersSubscription
Sector-ownership / claim-territoryPlot
Player onboarding for a featureTutorial
Sub-objective reused across mission typesReusable phases (rml_)
  • ⚠ create_mission requires an offer source (.offerlocations host) β€” not all objects can offer
  • ⚠ event_mission_aborted fires for BOTH player-cancelled AND system-cancelled β€” distinguish via event.param
  • ⚠ Mission rewards must route through LIB_Reward_Balancing for economy-consistent payouts
  • ⚠ Map markers / NewTarget Guidance need explicit cleanup on abort β€” they don’t auto-remove

Pick the right category before you start writing. Adding a faction subscription mission as a gm_* template won’t give you the loyalty-tier UI the player expects from subscriptions.