What you will build#

The small hello_x4 extension writes a message to the log. XML and Mission Director are enough. This is a new learning example, not a completed in-game acceptance scenario. Full files are available in wiki/examples/hello_x4.

Create the folders#

Place the extension under the game's extensions directory. X4 must find content.xml directly under hello_x4, without an extra nested folder. Use one installation and test profile, and avoid duplicate installed extension IDs.

TEXT
hello_x4/
├── content.xml
└── md/
    └── HelloX4.xml

Describe the extension#

Set your own author and unique ID in the manifest. The version dependency shown below targets X4 9.00. Add third-party dependencies only when your extension actually needs their APIs or resources.

XML
<?xml version="1.0" encoding="utf-8"?>
<content id="hello_x4" name="Hello X4" version="100"
         author="Your name" enabled="1" save="1"
         description="A minimal Mission Director example.">
  <dependency version="900" />
</content>

Add game logic#

Create md/HelloX4.xml. mdscript and cue are XML element names; HelloX4 and Hello are your identifiers. The inner quotes in text are needed because the attribute contains an MD expression with a string literal.

XML
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="HelloX4">
  <cues>
    <cue name="Hello">
      <actions>
        <debug_text text="'Hello, X4!'" />
      </actions>
    </cue>
  </cues>
</mdscript>

Verify startup#

Enable the extension and restart X4 when needed. Use a test save or a new game, enable logging, find Hello, X4! and check for import errors. A completed cue retains its state in a save; loading an existing save does not necessarily repeat the message. See persistence.

Next step#

Read cue lifecycle, then Lua ↔ MD events. Use XML diff patches to change existing game data.