Scripting
SCRIPTING AND CONSOLE COMMANDS IN BATTLEFIELD: 1942

Updated: November 28th 2003

.CON files are what brings everything together in Battlefield 1942. Con files link together the objects, models, sounds, maps, AI, and settings in the game. These are text files, sometimes called script files, with each line defining a property or performing a directive. They normally have the suffix ".con", with a few script files having the suffix ".inc", as these files are included and shared by a number of .con files using the "include" keyword directive.

Typically, most of the .con files you'll want to modify or create will be in the Objects.rfa archive file. Once this is extracted you'll find this directory structure:

Vehicles/ - All the cars, jeeps, tanks, planes, and boats.
Common/ - a few very common items.
Buildings/ - static building objects, with the decoration layout information.
Effects/ - explosion, dust, water ripples, and other cosmetic effects.
Handweapons/ - weapons that the player carries with them and keeps in their inventory
Items/ - flag and kit (weapons per class) information.
MOVE_FILES/ - static scenery pieces, chairs, tables, pipes, logs, signs, etc...
Soldiers/ - soldier properties, sounds, parts (hands, heads, body's)
Stationary_weapons/ - mounted machine guns.
Vegitation/ - trees and bushes. 

These directories are organized into further subdirectories until the actual .con files are reached. Typically, each .con file in Objects.rfa holds a single object or group of related objects (a tank body, its turret, wheels, etc.). Each line in a .con file either defines a class property, performs a keyword directive (such as including another file), or is a comment (and so is ignored). The directory structure and keyword commands are described in depth in the Game Structure Tutorial. The CON File List presents the more important .con file types.

The Class File List summarizes what the various classes do. There are about 40 classes, such as KitTemplate, SoldierSound, and Sky, but the most important (and most complex) class for object creation is ObjectTemplate. Many classes define object types. The All Types list shows these. For each class and type there are different properties that are set. The All Properties list summarizes these.

The new game Battlefield Vietnam uses the original Battlefield 1942 engine and expands upon it. The Vietnam Additions page gives an overview of these changes.

The numerical values set by properties are normally in MKS (meters/kilograms/seconds) units. Occasionally, time will be in units of 1/30th of a second, as this is how often the game engine updates the scene data.

ObjectTemplate Reference

Objects are defined by first setting the create property:

    ObjectTemplate.Create type name

All properties that are defined after this line are then a part of the named object type, until the end of the file is reached or another ObjectTemplate.create command is encountered. Three reference pages concerned with the ObjectTemplate follow.

Commands - used to create objects and link them together.

Types - lists and describes the different pre-defined object types in Battlefield 1942, and the properties that can be used on them.

Properties - lists and describes the ObjectTemplate properties.

Objects.rfa Reference

The ObjectTemplate class defines many properties for an object. However, typically each object is defined by a few different .con files, for weapon characteristics, physics, etc. Some other classes (such as GeometryTemplate) are also used in these files to hook in other resources to the object. These different file types are covered below.

Objects.con - Most misc objects, like SimpleObjects, Bundles, PlayerControlObjects, and RotationalBundles.

Physics.con - Objects with Physical reactions, like Wings, Engines, Springs, and FloatingBundles.

Weapons.con - Weapons related objects, like HandFireArms, FireArms, and Projectiles.

Network.con - Contains all the NetworkableInfo for multi-player compatibility.

Effects.con - Effect related objects, like Particles, Emitters, EffectBundles.

Geometries.con - Contains all the GeometryTemplates that link to .sm model files.

The CON File List gives a more general description of the other .con files used in the game.

AI Reference

Each soldier, weapon, and map can have additional information in order that the 'bots can function well. DICE has provided documents pertaining to AI to the mod community.


Go to the All Properties list, All Types list, Class list, CON file list, Vietnam Additions page, or Game Structure Tutorial.