Commands

Now that we've completed the body of the mission in the editor, it's time to add some cool stuff! We'll be adding ammo crates, text messages, player ratings and several hints / radio options.

Let's start with adding a radio message at the start of the mission, telling the player to hurry up as reinforcements are coming in. To do so, we have to place a unit to do the shouting. As we want him to be safe and out of the action, place a rifleman - ungrouped - on map square Ah90. After doing so, return to his unit dialog and give him the name "HQ". Next, add a trigger with condition set to "true" and in the On Activation (Image 1): HQ sideChat "HURRY UP, ENEMY REINFORCEMENTS ARE MOVING OUT!";Remember that you can set axis a and b to 0 in order to prevent an unnessary radius from appearing. Upon hitting preview, you should get a radio message. For more information, go to the COMREF sideChat.

An enemy position isn't completed without ammo, let's create an ammo create inside the fishing village. To place an ammo box, head to F1 / units and double click somewhere in the center of the village to bring up the dialog. Head to "empty", "ammo" and "ammo SLA" to place a SLA ammo box. This box contains standard ammo, let's add a weapon - the SVD Dragonov. To do so, use the command addWeaponCargo, which we will type in the initialization of the ammo box. The weapon class can be looked up in the OFPEC Weapons List. The correct classname is "SVD". Check Image 2 for working code.

Image 2

However, adding only a weapon won't be enough. We'll have to add magazines too! To do so, we're going to use the addMagazineCargo command. It needs the correct magazine name for the "SVD", found in the ArmA Weapon List too. Notice that I've added only one magazine as the SVD is quite strong, feel free to add more magazines.

We can give the player extra points with the command addRating. Let's place another tank in the fishing village, that once destroyed, gives additional points. The player however, shouldn't be able to board and use it.

Image 3

In the briefing we'll mention an old BMP awaiting repair and more fuel before being able to operate again. If the player sees the BMP, he should try and go blow it up. Start with placing the BMP in the southeast corner of the town.

Name it "bmp" after selecting "empty", "armored", "bmp-2" and important vehicle lock "locked" (Image 3). Next, the sliders should be moved towards the left side. This is to remove the fuel, ammo and some of its health. Notice that we've locked the vehicle, meaning that the player won't be able to board the BMP. Essentialy, this isn't required as we've set the fuel and ammo to 0 with the slider. Therefore the player wouldn't be able to do anything with the BMP except sitting inside. Most prefer to keep it unlocked as that is more realistic.

Image 4

Now, we need a trigger which will detect if the tank got blown, if so, we use the command to add some points to the player's rating. This rating will be displayed in the debriefing upon completing the mission.

In Image 4, you can see that I use the addRating command to add 2000 points after the condition switches to true - which is when the bmp (notice that we named the BMP-2 object "bmp") isn't alive.

Image 5

Now it's time to use some commands in conjunction with the trigger's radio options. We've already placed a trigger that will save the game upon one objective getting completed - now, let's add an option to save the game with the radio!

To do so, place a trigger somewhere on the map. With the settings as shown in Image 5. Notice that I've selected "Radio Juliet", the 10th option. I did this to make it easier for the player to save the game, instead of using 0-0-1 (radio Alpha) he can use 0-0-0 (radio Juliet). Don't forget to select "repeatly" which will allow the player to use the savegame multiple times!

If you preview the game, and head over to the radio section (press 0-0) you will see 0. SAVEGAME. Notice that "SAVEGAME" is the name I gave the trigger, thus when using a radio trigger - be sure to use the "text" field and give it a proper name as it will be shown ingame (radio section).

As there are no medics or field hospitals for the player to use, let's add an option to heal by using the radio. This option can only be used once in the game and will heal the player completely.

Activation should be by "radio Alpha", name it "First Aid" which will be displayed in the radio menu. The On Activation contains two commands, both having effect on the player. The first will set its health to 100%. Notice that the command setDammage actually exists and did since the first version of Operation Flashpoint (notice the spelling error).

The second command looks hard, but is actually easy. It switches the animation of the player to that of a unit being healed, the animation can be found in the list at the Biki (link above). The full line is:player setDammage 0;player switchMove "AinvPknlMstpSlayWrflDnon_healed";

Upon previewing the game, try the First Aid kit and you will see that any wounds will be healing and the animation will be played! This might save a lot of lives!

You have only seen a few of the hundreds of commands available in the game. The syntax for them can be found in the COMREF. Notice that if you want more commands on one line, you will have to use a semicolon (;) between the commands.

Every time you retry you will have to defeat the enemy resistance to check if something works, like checking if the SVD Dragunov is in the ammo box. We can cheat a bit by using a command to make us appear as friendly to the enemy, go the player's init and add:this setCaptive true;This will effectively make you a friendly, allowing you to kill and destroy anything undisturbed. However, notice that you shouldn't forget to remove the command once you decide to play the mission for real or want to let someone else play it.

It is a powerful command, which you can use to make prisoners (add a soldier, remove his weapons with removeAllWeapons this and add the setCaptive command).

You should now know the basics of how to use commands available in the editor. I suggest looking through the COMREF trying to memorize a great deal of the commands. They are really useful and will be used in a later chapter to construct scripts! Now, it's time to head to Ch. 8: Synchronize - to finalize the dynamic elements present in our mission.