Creating a Single Player Mission

Messages/Objectives (5.6)

Display Objectives

This section will describe how to make the objectives that are displayed in the pause window that tell you what your mission objectives are, as well as tools you have to guide a player to what they are supposed to do.

The script command to manipulate objectives is called "DisplayObjective". All of the following lines would be placed inside an Action scope. To add a new display objective, use the "Add" argument:

  Action()
  {
    DisplayObjective("Add", "[name of display objective]")
    {
      Text("[text that will be displayed]");
    }
  }

"[name of display objective]" is the name you are giving the objective as far as the script is concerned (it won't be displayed in game). "Text" is what is actually shown in the pause window.

To remove a display objective, use the "Remove" argument instead:

  Action()
  {
    DisplayObjective("Remove", "[name of display objective]");
  }

This will remove the objective text from the pause window.

Below is an example of the DisplayObjective command in a complete objective.

CreateObjectType("objective_destroy_base", "Objective")
{
  Condition("TRUE");
  Action()
  {
    DisplayObjective("Add", "destroy_enemy_base")
    {
      Text("Destroy the enemy base before they can fortify");
    }
  }
}

Objective Icons

As a map maker you are also able to place a red 'X' on the mini-map. This is useful for directing players to a specific spot on the map if they don't or can't read your objectives.

  Action()
  {
    CreateObjectiveIcon("[icon name]", "[region name]");
  }

"[icon name]" refers to the unique script name for the icon. If you want to remove it at a later point, this is how you would reference it. "[region name]" is the name of a region that you will create on the map. This will mark the rough location on the mini-map, so your region doesn't need to be particularly precise.

To remove an icon, you simply need to use the following command:

  Action()
  {
    DeleteObjectiveIcon("[icon name]");
  }

Game Messages

Game messages are used to play sound events and to print messages to chat. The use of game messages requires an additional .cfg file, and an inclusion of that file in types_mission.cfg. Create a text file called "types_game_messages.cfg" and put it in your mission folder. Then, open your types_mission.cfg and add this line:

#include "types_game_messages.cfg"

This text file will contain all your custom messages to be used. Each one should contain three statements: "Interval", "Sound", and "Message".

ConfigureGameMessage("[message name]")
{
  Interval()
  {
    Type("Interval::None");
  }
  Sound();
  Message();
}

The Interval determines how often the sound is able to be played in sequence. For the most part, you'll always want to keep it set as "Interval::None". The Sound is, as it suggests, the sound that is played when the message occurs. Let's take a look:

  Sound()
  {
    Type("Sound::Stream");
    Add("[sound file name]");
  }

Again, just like with the Interval, you should always leave the sound type set as "Sound::Stream". Basically it means the sound will be played immediately regardless of any other messages currently playing, such as your units talking to you. "[sound file name]" is the filename of the sound you want to play. It can be .WAV or .MP3 format. If it's a custom sound file, don't forget to put it in your mission folder.

Now let's take a look at Message:

  Message()
  {
    Type("Message::Console");
    Add("[Message text that will be displayed]");
  }

Once more, leave the type set to "Message::Console". This prints the text in green to the chat. "[Message text that will be displayed]" will be printed to chat. Keep in mind that normally chat only exists in multiplayer.

Messages can also use both sound and text at the same time.

ConfigureGameMessage("[message name]")
{
  Interval()
  {
    Type("Interval::None");
  }
  Sound()
  {
    Type("Sound::Stream");
    Add("[sound file name]");
  }
  Message()
  {
    Type("Message::Console");
    Add("[Message text that will be displayed]");
  }
}

The command to make the Game Messages play will be executed in your mission script (such as objectives_player.cfg or cineractives) in an action scope.

CreateObjectType("[objective_name]", "Objective")
{
  Condition("[type]")
  {
    [condition];
  }

  Action()
  {
    GameMessage()
    {
      Message("[message name]");
    }
  }
}

Location Messages

Location messages are similar to game messages, except they are also able to mark areas on the map. This appears as the flashing rings on the mini-map that usually occur when things happen such as enemies being spotted or heroes getting wounded. Region messages are also configured in the file types_game_messages.cfg (if you haven't made this file, do so now and include it in types_mission.cfg).

Location messages use the same "Interval", "Sound", and "Message" statements as regular game messages, with three additional statements to use, being "EnableBlip", "PersistentBlip", and "BlipColor". Here's the configuration for a location message:

ConfigureLocationMessage("[message name]")
{
  Interval()
  {
    Type("Interval::None");
  }
  Sound();
  Message();

  EnableBlip(1);
  PersistentBlip(4);
  BlipColor(0, 255, 0);
}

A location message's three statements all relate to the ring, or "blip", that is drawn on the mini-map. "EnableBlip" simply enables or disables the blip from being drawn. It is defaulted to 0, so make sure to set it to 1. "PersistentBlip" defines how long the blip will linger on the map, in seconds, before it begins to fade away. "BlipColor" is also pretty self-explanatory. It defines the RGB values that the blip will be drawn with.

Location messages are also very similar to game messages in how they are executed as well.

CreateObjectType("[objective_name]", "Objective")
{
  Condition("[type]")
  {
    [condition];
  }

  Action()
  {
    RegionMessage()
    {
      Region("[region name]");
      Message("[message name]");
    }
  }
}

Like with Objective Icons, "[region name]" refers to the name of a region on the map. The blip will appear in that location on the mini-map.

While location messages are largely obseleted by objective icons, they still have some use. One common way they used to be used was to create a contantly blinking marker on the mini-map. This can be done using an objective that loops while triggering the message each iteration.

CreateObjectType("location_message1", "Objective")
{
  Condition("Timer")
  {
    Time(1.5);
  }

  Action()
  {
    RegionMessage()
    {
      Region("[region name]");
      Message("[message name]");
    }
    NewObjective("location_message1");
  }
}

In this example, the objective "location_message1" will run every 1.5 seconds. When it does, it will trigger a location message, then point back to itself using NewObjective. Remember though that this loop will be infinite. To cancel it, you'd have to use a second objective armed with the "ObjectiveAbandoned" command:

CreateObjectType("location_message2", "Objective")
{
  Condition([type])
  {
    [condition];
  }

  Action()
  {
    ObjectiveAbandoned("location_message1");
  }
}

These are the basics in telling a player their objective. For multiplayer, where each player can have a unique objective, things get a little more versatile, but also more complicated. See Section 7.1: Mods and Rulesets - Getting Started for more information.