Home Editors Depot Missions Depot FAQ COMREF OFPEC Tags Forum

FAQ: Units Index


The Basics

Opening up the editor you see at the top left of the screen a 'Units' button. Activating this will allow you to double click on the map and place a unit.

The Units DialogThe Units Dialog

Let's briefly look at the various controls.

Side - There are four 'sides' in Flashpoint which units can be assigned to: West, East, Resistance and Civilian. The last two are usually thought of as the same thing, the Resistance being armed Civilians. West will always fight East, and vice versa. The Resistance fights either West or East - see the Mission Dialog.
Class - This is what kind of unit you are placing. It can be confusing, as tanks are units, ammoboxes are units, even tables are units. However, the Class field is split into categories to make things easier for us mission editors. Soldiers are found in the 'Men' Class.
Control - This defines who controls the unit. For now, think of this as either the player or the computer.
Info Age - When an enemy unit is reported to a commander an icon appears on the map. The accuracy of this position depends on the Info Age.
Vehicle Lock - If the unit is a vehicle, this defines whether the player can use it or not.
Rank - This defines how high up the command structure the unit is. Lower ranked units can be grouped to higher ranked units.
Unit - This is the type of unit within the Class field that you want to place, for example if the Class is 'Armour' the Unit would be the type of tank, if the Class is 'Men' then the Unit would be the type of soldier.
An important thing to remember is that while the term 'unit' can mean inanimate objects like tables and flagpoles, within this FAQ it generally refers to active entities like soldiers, armour and aircraft.
Special - Units will be placed 'In Formation' by default. If you wish to place them independantly, choose 'None' from this list. Be aware that if a unit is part of a group, it will try to return to formation when the mission begins. If the unit is an aircraft, selecting "Flying" will put it in the air. If the group which the unit is a part of includes a vehicle with cargo spaces, choosing "In Cargo" will place the unit in one of those cargo spaces. Remember that this control defines the starting position for the units at the very beginning of a mission. They can be manipulated later.
Name - This is a very useful field. Whatever you put in this field can be used as a name to reference the unit later on in scripts. Like all variable names, you should make it something meaningful.
Skill - At highest skill units will see farther, shoot more accurately and be generally more devious. At lowest skill units will be less observant, poor marksmen and generally stupid. Skill will be automatically set on choosing a unit, but you can tweak the settings for your own purposes.
Initialisation - This is where you can put script commands to further define the unit's properties. Anything put in this field will take effect at the very beginning of the mission. More on this later.

The next three sliders, Health/armour, Fuel and Ammunition define how much of each the unit has at the start of the mission. If you put the Health/armour slider to 0, the unit will start the mission dead.
The Azimut setting defines which direction the unit will be facing. You can drag the pointer around the circle, or type in the number of degrees.
Probability of Presence (PoP) defines how likely it is that the unit will be present. This can be used to add a bit of randomness to missions. A maximum PoP will ensure the unit is always there. A Pop of 0% means the unit will never appear.
Condition of presence relies on some other factor to decide whether or not the unit appears in the mission. By default this reads 'true' which means it will appear, but for example if you wanted to have the unit appear only if the user's benchmark was over 5000, you could insert

benchmark > 5000

For an explanation of why benchmark is important, look at the mission FAQ.

Finally, Placement Radius defines an area within which the unit's starting position could be.

List of Units

The BIS site for Flashpoint features a list of all units, vehicles and weapons for West, East and Resistance sides.

The names used for these units are a little different for scripts, and are shown below:

West Units East Units Resistance Units

"SoldierWB"
"SoldierWMG"
"SoldierWG"
"HeavyGW"
"SoldierWLAW"
"SoldierWAT"
"SoldierWAA"
"SoldierWSniper"
"SoldierWSaboteurPipe"
"SoldierWSaboteurDay"
"SoldierWMedic"
"SoldierWCrew"
"SoldierWPilot"
"SoldierWMortar"
"SoldierWMiner"
"OfficerW"
"SoldierWCaptive"
"SoldierWFakeE"


"SoldierEB"
"SoldierEMG"
"SoldierEG"
"HeavyGrenadier"
"SoldierELAW"
"SoldierEAT"
"SoldierEAA"
"SoldierESniper"
"SoldierESaboteurPipe"
"SoldierEMedic"
"SoldierECrew"
"SoldierEPilot"
"SoldierEMiner"
"OfficerE"
"OfficerENight"
"SoldierEFakeW"
"GeneralE"
"Angelina"


"SoldierGB"
"SoldierGMG"
"SoldierGG"
"SoldierGLAW"
"SoldierGAT"
"SoldierGAA"
"SoldierGSniper"
"Hunter"
"SoldierGMedic"
"SoldierGCrew"
"OfficerG"
"OfficerGNight"
"SoldierGFakeE"
"SoldierGFakeC"
"SoldierGFakeC2"

Note that these are the basic units for each side. A comprehensive list of all unit names can be found here.

How to create Units

Units can either be placed using the Editor dialog when designing the mission, or by using script commands to introduce units during the mission itself. The main thing to remember is that a unit added during the mission needs a group to which it can be assigned. More on this in a moment. The full command to create a soldier is

"unit_class" createUnit [position, group_name, init, skill, rank]

"unit_class" is the type of soldier you wish to create - see the list of units.
position is the place at which you wish the unit to be created.
group_name is the name of the group to which you wish to add the unit.
init can include any scripting commands you wish to perform on the unit on creating it.
skill is the unit's skill level, from 0 (minimum skill) to 1 (maximum skill).
rank is the unit's level in the command heirarchy. Possible values are "Private", "Corporal", "Sergeant", "Lieutenant", "Major" and "Colonel".

Note that only the position and group_name are required. The other values are optional, and their default values are "" for init, 0.5 skill and a rank of "Private".

"OfficerW" createUnit [getmarkerpos "mk_barracks", barracks_group, {this setbehaviour "safe"}, 0.75, "Lieutenant"]
"SoldierWMG" createUnit [getmarkerpos "mk_barracks", barracks_group]

These are both valid commands.

How to place Units

The position of a unit on the map is expressed as an array consisting of 3 numbers representing longitude, latitude and height. Thus a position of [0,0,0] would be a point at the extreme bottom left corner of the map, at 0 metres above the ground. The default height is 0 (probably due to gravity) and so a position can also be described with just longitude and latitude - the unit will still be on the ground. However, experiment has shown that even on the first floor of a house, a unit's height variable will still register as 0.


To find out the numerical position of a unit

_unitpos = getpos unit_name

To find out the longitude (West/East) position of a unit

_unitposx = (getpos unit_name select 0)

To find out the latitude (North/South) position of a unit

_unitposy = (getpos unit_name select 1)

To instantly move a unit to another position

unit_name setpos new_position

new_position is the positional array at which you wish the unit to appear, however not many mission editors write the positional array as three numbers in brackets i.e. [10,263,0]. A much more useful method is to place an empty marker on the map and use its positional array instead, like this

unit_name setpos getmarkerpos "mk_barracks"

To instantly move a unit relative to its current position

unit_name setpos [(getpos unit_name select 0) +10, getpos unit_name select 1]

The example above will place the player's unit 10 metres East of its current location.

You can also move units relative to some other object:

unit_name setpos [(getpos sandbags select 0) -1, (getpos sandbags select 1) + 2]

That example will place unit_name 1 metre West and 2 metres North of the object sandbags.

You may wish to move a unit relative to the direction the unit is facing rather than North/South/East/West. This is a little more complex, requiring sin and cos, and the getdir command.

sandbags setpos [(getpos unit_name select 0) + (10*sin(getdir unit_name)), (getpos unit_name select 1) + (10*cos(getdir unit_name))]

That will place the object sandbags 10 metres directly in front of the unit unit_name, regardless of which direction unit_name is facing. For a more detailed explanation of how this works, click here.


To instantly place a unit higher up (for example on the first floor of a building)

unit_name setpos [getpos unit_name select 0, getpos unit_name select 1, (getpos unit_name select 2) + 5]

That will place unit_name 5 metres in the air at his current position. When placing units within buildings, height values need to be experimented with.

Explanation of how to use buildingpos?

How to equip Units

Equipping a unit's inventory is a wee bit like filling a bag - you can put in as much as will fit, and anything more will simply spill over the sides. In other words, you can add forty M16 magazines to a soldier's inventory but he will only ever carry a maximum of 10.


To empty a unit's entire inventory

removeallweapons this

To remove a specific weapon from the unit

this removeweapon "M16"

To remove a magazine of a specific type from the unit

this removemagazine "M16"

To remove all magazines of a specific type from the unit

this removemagazines "M16"

To equip a weapon

this addweapon "M16"

To add ammunition

this addmagazine "M16"

Note that in the examples, "M16" should be replaced with the weapon name and magazine name respectively. They are not always the same - see the weapons/magazines list for details.

Remember to add a magazine before the weapon is added, as this will ensure the weapon is loaded.

As a mission designing tip, consider how you equip the units carefully. Balancing opposing forces is important in making an entertaining and challenging mission. A "Capture the Flag" mission where the flag in question is surrounded by snipers is not going to be much fun to play, and similarly equipping the enemy with only pistols will not provide much of a challenge.

One thing I would say is give the player binoculars. Unless you wish the player to hunt for them, it makes little sense to deprive the player of one of the major aspects of the game, i.e. being able to survey a scene from a distance.

How to style Units

Units are given faces randomly. If you wish to give a unit a particular face, use the setface command. A list of all default faces can be found here. A unit's face can be changed at any point in the mission.

If you wish to give a unit a particular name, define the unit's identity within the Description.ext file and use the setidentity command. A sample identity definition is given below:

class CfgIdentities
{
   class John_Doe
   {
      name="John Bartholemew Doe";
      face="Face20";
      glasses="None";
      speaker="Dan";
      pitch=1.1;
   };
};

Notice that there are no spaces in the identity "John_Doe". Also be aware that identity identifiers are case-sensitive, i.e. John_Doe is not the same as john_doe.


To give a unit sunglasses

Replace the "None" above with "Sunglasses". If you wish the unit to have normal reading glasses, use "Glasses".


To give a unit a different voice

Replace the speaker name with one of the following:

  • "Adam"
  • "Dan"
  • "George"
  • "Greg"
  • "John"
  • "Jonah"
  • "Marc"
  • "Patrick"
  • "Paul"
  • "Peter"
  • "Rich"
  • "Rob"
  • "Ted"
  • "Tom"

If you wish to include your own face images in the game, you need to create a face addon. This is easier than it sounds, and there is a good tutorial on how it's done here.

How to modify abilities & behaviour

There are various qualities attributed to units and most of them are set when you add a unit to the map. There are some which can be changed using script.


To modify a unit's side

You need to join it to an officer of higher rank of the side required.


To change a unit's skill level (how well the unit shoots, how quickly it reacts to enemies)

unit_name setskill value

value should be between 0 (minimum skill) and 1 (maximum skill).


To change a unit's behaviour (how much danger the unit thinks it is in)

unit_name setbehaviour "value"

"value" can be one of these:

  • "Careless" (Unit will stand up, shoulder firearms, will not react to gunfire)
  • "Safe" (Unit will stand up, shoulder firearms, will react to gunfire)
  • "Aware" (Unit will stand up, firearm ready)
  • "Combat" (Unit will stay low, firearm ready)
  • "Stealth" (Unit will stay low and/or go prone, firearm ready, will actively seek cover)


To change a unit's engagement mode (how the unit reacts to enemies)

unit_name setcombatmode "value"

value should be one of these:

  • "Blue" (Never fire)
  • "Green" (Hold fire - defend only)
  • "White" (Hold fire, engage at will)
  • "Yellow" (Fire at will)
  • "Red" (Fire at will, engage at will)


To change a unit's standing mode

unit_name setunitpos "value"

"value" can be one of these:

  • "Up" (Unit will stand up and will remain standing)
  • "Down" (Unit will go prone, and remain prone)
  • "Auto" (Unit will choose position according to circumstances)


To change a unit's speed mode

unit_name setspeedmode "value"

"value" can be one of these:

  • "Limited" (Half Speed)
  • "Normal" (Full speed, maintaining formation)
  • "Full" (Full speed, will not maintain formation)


To change a group's formation

group_name setformation "value"

"value" should be one of these:

  • "Column"
  • "Stag column"
  • "Wedge"
  • "Ech left"
  • "Ech right"
  • "Vee"
  • "Line"


To change the direction a unit faces

unit_name setdir value

value should be between 0 and 360.


To change the direction a group faces

group_name setformdir value

value should be between 0 and 360.


To make the unit watch a specific position

unit_name dowatch position

position is the positional array you want the unit to watch. Some more examples of this:

unit_name dowatch (getpos flag_pole)
unit_name dowatch (getmarkerpos "mk_attention")
unit_name dowatch (getpos (object 51289))

You can also have units watch other units, using

unit_name dowatch other_unit_name

How to animate Units

All the movements a unit makes in the game can be replicated by using the playmove and switchmove commands. A full list of all the animations units can perform can be found here. It can be tricky to get units doing just what you want, as some animations need the unit to be in a particular behaviour mode such as safe or careless. Some animations can only be called using switchmove, others with playmove. Some of the more basic moves are detailed below:

  • sit on ground - unit_name switchmove "EffectStandSitDownStill"
  • squat - unit_name switchmove "FXInKneel"
  • press-ups - unit_name switchmove "FXStandDip"
  • fold arms - unit_name switchmove "FXInHandStat"
  • surrender - unit_name switchmove "FXStandSurUniv"
  • hands up - unit_name switchmove "FXWomanSur"
  • salute - unit_name switchmove "EffectStandSalute"
  • at ease - unit_name switchmove "FXStandAtt"
  • punch - unit_name switchmove "StandStrokeFist"
  • use binoculars - unit_name switchmove "CombatToBinoc"
  • sit on chair - unit_name switchmove "FXStandUnivTable"
  • use a telephone (seated) - unit_name switchmove "FXStandTelLoop"

Note that with telephones, the animation in itself will not include the telephone handset. To equip a unit with a telephone, use

unit_name addweapon "phone"

How to control unit movement with script

Although waypoints are a highly effective method of moving units and groups around the map, sometimes you may want to do this using script. The same principles apply however: the unit needs a destination to move to, and you need to know when the unit has reached its destination.


To make a unit move to a specified location

unit_name domove position

position can be specified by using some other object's position, for example

unit_name domove (getmarkerpos "mk_barracks")
unit_name domove getpos sandbags

Be aware that if a unit is part of a group, the unit will return to formation.


To determine if a unit is underway between locations, use the unitready command. If a unit is moving somewhere or undertaking some action, unitready will be false. Once a unit has completed whatever it was doing, unitready will be true. For example

unit_name domove (getmarkerpos "mk_barracks")
#loop
~1
? not (unitready unit_name):goto "loop"
unit_name sidechat format ["This is %1 - I'm at the designated coordinates!", name unit_name]

The above script issues a domove command, in this case to the position of marker "mk_barracks". The script then enters a loop which waits for one second, and if the unit is not 'ready', returns to the loop. Once the unit is ready the loop is ended and the unit reports that it has reached its destination.

This is an alternative to using the @ operator, which loops very fast. For example the above script could read

unit_name domove (getmarkerpos "mk_barracks")
@ unitready unit_name
unit_name sidechat format ["This is %1 - I'm at the designated coordinates!", name unit_name]

This may seem like an easier way of doing things, but be aware that because the @ condition loops so fast, it may cause lag. When checking the status of variables, always give thought to how often you need to check them, or how quickly you need to detect a change.


To make one unit follow another

unit_name dofollow leader_unit

leader_unit is the name of whichever unit you wish unit_name to follow.