Configuration Files

Creating Objects (6.1)

All of the units and buildings in Army Men RTS are configured using a fairly simple scripting language. The unit files are referred to as "configs". This chapter will teach you how to create new config scripts. We will first take a look at a very basic config, the Grunt unit, and break it down.

Creating Objects

The first step to creating a unit is giving it an object name that will be recognized by the game. In this case:

CreateObjectType("army.unit.grunt", "Unit")

The first pair of "" quotation marks will be the name of the unit. The base units use localization keys to display their localized name. However, you won't be able to create your own, so your best bet is to simply write your unit's name as it will appear ingame. After the name, you need to specify any particular traits this unit is going to have with the second pair of "" quotation marks. The Grunt is the standard type, "Unit". Other possibilities include "Restore", "Trap", or "Wall". We'll get into what that means later.

Before moving on, you should make sure that this new unit is included in the "types_mission" file.

GameObj

Once the object is created, you need to make a new scope (using a "{") and add the GameObj.

CreateObjectType("army.unit.grunt", "Unit")
{
  GameObj()
  {
    ThinkInterval(1);
    IdleTask("Tasks::UnitIdle");
    Properties()
    {
      Add("Filter::Army");
      Add("Filter::Biological");
      Add("Filter::Weapon");
      Add("Filter::Unit");
      Add("Filter::Transportable");
    }
  }

This is the top level object from which all the other objects are built. You will see a GameObj in everything from units to rocks and trees on the map. Inside the GameObj, you can specify the following things:

All the other Obj's that you will add to this config are built off the GameObj. It is all object-oriented in this respect. The hierarchy looks like this:

GameObj
    MapObj
        PropObj
        SourceObj
ProjectileObj
ExplosionObj
        UnitObj
        RestoreObj
        TransportObj
        WallObj
        TrapObj