Creating a Single Player Mission

Common Objective Condition Examples (5.5)

The following section will provide more help on how to do the most common things that a single player mission requires that weren't covered in the previous chapter. It is by no means comprehensive, and is only to provide some extra help and examples.

TRUE - Condition becomes true when objective is loaded, executing the Action immediately.

NOT - This condition becomes true or false in negation to its sub-condition. For example:

CreateObjectType("[objective name]"), "Objective")
{
  Condition("NOT")
  {
    Condition("InRegion")
    {
      Region("Green_base");
      Tag("sarge")
      {
        Amount(0);
        Operator(">");
      }
    }
  }
  Action()
  {
    [action];
  }
}

Within the NOT condition is another condition running an InRegion check. In this case, we are testing to see when a particular object is NOT in that region. The action would be triggered as soon as the tag "sarge" left the region. NOT can be used with any Condition Type.

AND - Requires two or more sub-conditions to become true simultaneously before executing the Action scope.

CreateObjectType("[objective name]", "Objective")
{
  Condition("AND")
  {
    Condition("TagCount")
    {
      Tag("enemy_units")
      {
        Operator("==");
        Amount(0);
      }
    }
    Condition("InRegion")
    {
      Region("goal");
      Tag("players_units")
      {
        Amount(0);
        Operator(">");
      }
    }
  }
  Action()
  {
    [action];
  }
}

In this example, both the TagCount (Are all units tagged "enemy_units" dead?) and InRegion (Is at least one unit tagged "player_units" in the region "goal"?) checks have to become true to make the entire condition true.

OR - Condition will become true if ANY ONE sub-conditions become true.

CreateObjectType("[objective name]", "Objective")
{
  Condition("OR")
  {
    Condition("TagCount")
    {
      Tag("enemy_units")
      {
        Operator("==");
        Amount(0);
      }
    }
    Condition("InRegion")
    {
      Region("goal");
      Tag("players_units")
      {
        Amount(0);
        Operator(">");
      }
    }
  }
  Action()
  {
    [action];
  }
}

In this example, if the TagCount check become true, the entire condition will be true, regardless of if the InRegion is true or false. This goes vice versa for InRegion becoming true as well.

TIMER - Condition becomes true after the specified time has elapsed (in seconds). If you enter two values in the Time() line, i.e. Time(60, 120), it will trigger at a random time between those intervals.

CreateObjectType("[objective_name]", "Objective")
{
  Condition("Timer")
  {
    Time(60);
  }
  Action()
  {
    [action];
  }
}

These are the most common condition types, but there are several more that are handy. See the DR2 Technical Reference Manual for more info.