Using BAF IEDs via scripting

The new BAF IEDs work like Satchel Charges. You can place them and detonate them within 300m remotely. You can even command, via the Action Commands, a grouped AI to place and Touchoff a BAF IED. A demo mission showing these commands at work is available.

There are two types of IED in BAF – garbage (shells under garbage) and ground (buried IED). Each type has a large and small explosion version:

Satchel charges in A2 just need “pipebombmuzzle” to be used via scripting. BAF IEDs are slightly more complicated, with each IED having it’s own muzzle name as shown here. An ammobox filled with IEDs is available under Empty -> Ammo -> Explosives Stash (or by using the BAF_IEDBox classname to create one).

IED Classnames and Muzzlenames:

BAF_ied_v1      BAF_ied_v1_muzzle
BAF_ied_v2      BAF_ied_v2_muzzle
BAF_ied_v3      BAF_ied_v3_muzzle
BAF_ied_v4      BAF_ied_v4_muzzle


In A2:BAF to get an AI to place an IED via scripting you use these commands:

To equip an AI with an IED:

this addMagazine "BAF_ied_v2";

To place an IED (replace the muzzle classname with the matching muzzle type for whatever class IED the unit has):

placingUnit Fire ["BAF_ied_v2_muzzle"]

To explode an IED:

anyUnit action ["TOUCHOFF", placingUnit];

The action command TOUCHOFF can use any unit to set off the IED. Even if the placing unit is dead.

IEDs can be set to explode via timer as well, just like a satchel charge.

Bug Notes:
Players will see incorrect labels in their action menu for these IEDs. They will see “Put IED (ground large)” for the V3 version which is actually just “ground”, the small charge.

V1 (garbage small) is also broken to various degrees. Players won’t even get the option to place it. If you use the action commands to tell an AI to place it your action will be blank and he’ll set it to 30 seconds automatically. Thankfully it’s a small bang!

  1. #1 by Thomas on September 3, 2010 - 8:48 PM

    Oh my god, awesome work and examples, keep up the coding!

Comments are closed.