Configuration Files

Creating a Weapon (6.5)

The weapon is usually referenced at the bottom of the UnitObj, under "Weapon". The weapon config is generally much simpler than the object that creates it. Here is the Grunt's weapon config.

CreateWeaponType("army.weapon.grunt")
{
  Style("Instant");

  MaxRange(56);

  Delay(1);

  Damage()
  {
    Amount(8);

    Effective("infantry", 100%);
    Effective("vehicle", 100%);
    Effective("structure", 100%);
    Effective("flyer", 100%);
    Effective("mine", 0%);
  }

  FirePoints()

  {
    Add("HP-FIRE");
  }
}

Style - There are two distinct styles of weapon that are used in the game:

NodeStyle - If the art asset you are creating is going to move in any way, namely as a turret, it needs to have a node style specified in the config to dictate how it moves. Here are all the node styles, pilfered directly from the technical manual.

Nodes - This is where you list the nodes that are used by the asset. All nodes should be prefixed by "CP-". For example, the two nodes for the Tank would be listed as follows.

  Nodes("CP-Turret__h", "CP-Barrel__h");

MaxRange - Self-explanatory. This specifies the maximum distance that the weapon can fire.

MinRange - This defines a minimum distance for firing: enemies that are closer than this distance cannot be targeted. Since self damage no longer exists, this is pretty useless. Snipers still use this however.

HorizAngle - "The centre of the allowed firing frustrum measured in degrees from right increasing anti-clockwise." What that means in layman's terms is: the direction the unit fires. Keep it at 90.

HorizSeparation - "The seperation from the HorizAngle of the allowed firing frustrum in degrees." Another way of saying that would be: the width of the cone around the HorizAngle.

VertAngle - "The centre of the allowed firing frustrum measured in degrees from directly up." Keep it at 90 to shoot straight ahead. Lower it to point the weapon higher.

VertSeparation - "The seperation from the VertAngle of the allowed firing frustrum in degress." Same as Horiz.

Damage - The all-important damage list.

Amount - How much damage is done with each shot.

Effective - Percentage of the total damage amount that the weapon can do against a specific armor type. The default is 0%, so every armor type that you want to damage must be listed. Keep in mind that hit point numbers vary widely between different unit categories, so giving equal effectiveness against infantry and vehicles will still allow vehicles to last longer under fire. Also, flyers generally have very low hit points, so doing a relatively small amount of damage will still be effective. The game has five armor types, listed as follows.

Delay - Rate of fire. Multiply the amount of damage a unit does by its effectiveness % against a targeted unit, then multiply that number by the delay to get its damage per second against a specific armor type.

FirePoints - This connects the weapon that we are creating to the hardpoint on the art asset. In order for it to work, the art asset needs to have an existing hardpoint with the name that is referenced inside the FirePoint's scope.

VERY IMPORTANT NOTE: Many units have multiple hardpoints, such as the Pillbox and the AA Gun. If the weapon it is firing is a Projectile, you must divide the amount of damage it does per shot by the number of hardpoints to get the total damage done per shot.

Example: Say you want the AA Gun to do 80 points of damage every time it fires. Looking at the art asset, you will notice that it fires from 2 different hardpoints. So you must divide the amount of damage done by 2, thus doing 40 points of damage from each hardpoint each time it fires.

VERY IMPORTANT SUB-NOTE: Dividing the damage amounts between hardpoints does not apply if it is an Instant weapon. Instant weapons do not create projectiles, so no matter how many hardpoints it has, you still list the total amount of damage per shot. See the Chopper config for an example of this.

TurnRate - Number of degrees per second that the turret rotates. The unit must have a turret in the art asset and have the nodes properly configured for this to work.

Ammunition - Number of shots that a unit can fire. This is unused in the game, but it is still fully functional. The unit will automatically display its ammo as a yellow bar at the top of its HUD if this entry is used.

Fixed - A unit with the Fixed flag set will always fire in the direction its hardpoint is pointed.

KillUser - If this flag is set, the unit will automatically self-destruct when it fires. It is used by the DumDum.

HighTrajectory - Fires arc projectiles at a steeper angle. Arc projectiles are defined in the ProjectileObj. This flag is only used by the Mortar Man.

OneShot - Fires once and then stops firing.

LeadAngle - Weapon will fire at the predicted position of the target. Can make hitting of moving targets better. Used on most projectile weapons.

PotShot - Allows unit to fire while moving. Used to great affect on the Tank and the Half-Track, as well as the Chopper.

Speed - The initial speed of projectiles in kilometers per hour.

Projectile - The name of the projectile that is fired by the weapon. Should point to an existing projectile object.