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.
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 "
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:
ThinkInterval
- This dictates the processing intervals for the object, or how often it thinks. Don't mess with it.
IdleTask
- Pretty self-explanatory. This gives the idle task that the unit will perform when not carrying out an order. "UnitIdle
" should be used for any standard combat unit. Other IdleTasks include "UnitConstructor
" for buildings that produce units, "WallIdle
" for buildings that connect with fences, "UnitCollect
" for Collectors, and so on. The best thing to do is to find a unit that performs a similar role and copy its IdleTask over.
Properties
- This is where you specify filters, abilities, and other aspects of the unit. A few examples are provided for each.Filters
- Filters are used for several things. Healing units use it to determine whether or not they can restore (ex: Medics can't heal objects without any of "Filter::Biological
", "Filter::Mechanical
", or "Filter::MechanicalFlyer
", such as Blintz's Acid Guns). The Narrorator uses it to determine what message to speak (ex: "Filter::Building
" says "Base under attack").
Abilities
- Abilities give units buttons on the context menu, such as "Recycle" and "Self Destruct". To give a unit the ability to self-destruct, just add "Ability::SelfDestruct
". "Ability::Construction::Reverse
" is used by the Mine Layer, allowing it to construct mines while facing the opposite direction.
Client
- This is used only in the context of "Client::FacilityBar
". Put it on a building if you want it to appear on the facility bar on the bottom left corner of the screen when it is constructed.
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