RJ Wattenhofer

Tech writing, 3D model building and game design.

April 26, 2024

ArmA 2 | How to Blow Up Buildings

Methods for blowing up hard-coded map objects and other items

arma 2 operation arrowhead logo

Triggered Timer

The first building will be blown up using a timed trigger that activates when a player crosses into it. The image below is the target building:

arma 2 building 01

Click the 'Units' button on the right sidebar and place down a 'Game Logic' unit on the building. Give it the name 'building01'. Create a second 'Game Logic' unit atop the building and name it 'target01'. Make sure the two units are not grouped - you will have more flexibility on where you want the explosion to occur.

Click the 'IDs' button. You will see every map object ID displayed. Find the ID for the building, which is 1553 in this case.

arma 2 building 02

Place down a trigger in the road. Set the 'Axis a' and 'Axis b' to the desired radius. Set the 'Activation' field to BLUFOR, click 'Countdown' and set the 'Min' 'Mid' and 'Max' settings for the timer. Enter this code into the 'On Act.' field:


 

((position building01) nearestObject 1553) setDamage 1;
bomb = "Bo_GBU12_LGB" createVehicle getPos target01;



arma 2 building 03

The image below shows our setup:

arma 2 building 04

Any player stepping into the trigger will detonate the explosion and destroy the building.

arma 2 building 05

Click to Detonate

Instead of using a trigger to activate the bomb we will now set up a detonator that a player can use by clicking. The same building will be utilized and the detonator will be a power generator unit previously placed near the front entrance.

arma 2 building 06

As in the triggered timer tutorial, place down two 'Game Logic' units (ungrouped) on the building and name them'building01' and 'target01'.

Set down another unit to be used as your detonator. This can be absolutely anything you choose. In its 'Initialization' field enter this code:


 

this addaction ["Detonate bomb!", "explosion.sqf"];



Open up your text editor (MS Notepad, etc) and enter the following code into it:


 

hint "The bomb has been activated. You have thirty seconds to exit!";
PlaySound "detonator";
sleep 30;
((position building01) nearestObject 1553) setDamage 1;
bomb = "Bo_GBU12_LGB" createVehicle getPos target01;



Save it as explosion.sqf and drop it into your mission folder.

In the set up image below you will the the detonator (orange dashed rectangle with question mark) and the two game logic units. This time I positioned target01 further out toward the street for a more dramatic effect.

arma 2 building 08

Once the detonator is clicked the player will be give a warning that they have thirty seconds to depart. Line two of the explosion.sqf script is optional. This is the sound effect for the detonator button being pushed.

For sound effects you will need a 'sound' folder in your mission directory, a sound file in .ogg format and this code in your description.ext file:


 

class CfgSounds
{
	// List of sounds (.ogg files without the .ogg extension)
	sounds[] = {detonator};

	class detonator
	{
		name = "detonator"; // Name for mission editor
		sound[] = {\sound\detonator.ogg, db+10, 1.0};
		titles[] = {0, ""};
	};        
        
};



And the final result...

arma 2 building 09

Chain Reaction Bridge Demolition

The target bridge is in the image below. It is comprised of four sections, each with its own ID number. For added impact two vehicles (UAZ Russia models - nice fireballs) have been positioned on the bridge and converted into bombs.

arma 2 bridge 01

First we must gather all the ID numbers which are 243235, 241951, 243237 and 243237. Now place down a game logic unit just to the right of the bridge and name it 'bridge01'.

Set down four more game logic units, each one positioned directly over the individual sections of the bridge. Name each one 'section01', 'section02', 'section03' and 'section04'. Place two+ UAZ's on the bridge and name them 'bridgeveh01' and 'bridgeveh02'.

Place down five triggers in overlapping concentric circles, just slightly off from one another with the radius' at 5. The offsetting is simply so that you can see them, whereas if they completely overlapped they would appear to be one trigger and would be unmanageable.

The image below shows our set up so far:

arma 2 bridge 02

The thin lines with arrow pointers are the waypoint paths for our hapless OPFOR bridge guard and are not necessary for this bridge exercise. You can read more about these in my Implement Looping Waypoints tutorial.

OPTIONAL: In the first trigger place this code:


 
hint "The bomb has been activated. You have thirty seconds to exit!";



You would use this to alert players that the bomb has been detonated when they step into the trigger area. If you do not want to use this then delete the trigger.

In the first of our detonation triggers place this code in the 'On Act.' field:


 
((position bridge01) nearestObject 243235) setDamage 1;
 bomb = "Bo_GBU12_LGB" createVehicle getPos section01; 


'position bridge01' refers to our first game logic unit, which was placed beside the bridge. This unit will be used by all four sections. 'nearestObject 243235' is the ID number of the first bridge section. 'getPos section01' is the game logic unit positioned over object ID 243235.

The bridge section two code is much the same with one addition:


 
((position bridge01) nearestObject 241951) setDamage 1;
 bomb = "Bo_GBU12_LGB" createVehicle getPos section02;
 bomb = "Bo_GBU12_LGB" createVehicle getPos bridgeveh01; 


The third line that references 'bridgeveh01' is what turns the UAZ sitting over section two into a bomb.

To create a chain reaction explosion, you will need to go back into each timer and first choose the side in the 'Activation' drop down that you would like to have trigger the explosion. Then you will need to click the 'Countdown' text.

Finally, enter the delay in seconds in each 'Min' 'Mid' and 'Max' field. Each trigger should be offset by at least a second, with two seconds being preferable. Example: trigger one = 30 seconds, trigger two = 32 seconds, trigger three = 34 seconds and trigger four = 36 seconds.

Here is the bridge explosion:

arma 2 bridge 03

Related article: Adding Mission Tasks [ArmA 2]
Related article: Creating a Mission Intro Splash Screen [ArmA 2]
Related article: Creating Multiplayer Missions [ArmA 2]
Related article: General assembly: ArmA 2 VPN Setup [ArmA 2]
Related article: Detonate on Trigger: IED [ArmA 2]
Related article: Spawning Soldiers with Timers [ArmA 2]
Related article: Implement Looping Waypoints [ArmA 2]

  • xing social button
  • linkedin social button
  • buffer social button
  • reddit social button
  • stumbleupon social button
  • facebook social button
  • google plus button
  • twitter social button
  • renren social button Renren
  • vkontakte social button Share in VK