Author: I34dKarma
Author Website:

Requirements: No addons required

Version: 1.1

Short description: This script creates roadblocks with a bar gate surrounded by different objects depending on the type of site selected.

Date: 2013-12-21 10:49

Comments: (4)


Road Block Script


This script allows you to easily configure and place roadblocks into your mission. The roadblock consists of two small bunkers with a bargate that is animated if you are on the same side as the units manning the gate. Bargate will not animate if units manning the roadblock are KIA. Simply Put down a map marker in the editor, set the config options in your init.sqf file and that is all that is needed.

There is also a mod version of the script that can be downloaded that creates roadblocks in a module, you can download it from here: Karma Modules

Installation / Usage:
1. Extract the karma_roadblock folder and then copy the karma_roadblock folder into your mission folder i.e:
\MyDocuments\Arma 3-Other Profiles\YourProfileName\missions\YourMissionName
2. Add the following lines of code to your mission init.sqf file. The location of these two lines is not to critical so you can try it at the end of your init.sqf or the beginning and see what works best for you:
karma_roadblock_list = [["roadblock_1",0,"NATO",1,0,1,0,10],["roadblock_2",0,"AAF",1,1,1,0,10]];
#include "karma_roadblock\karma_roadblock_start.sqf"

Example Breakdown:
This is a description of the karma_roadblock_list array example:
karma_roadblock_list = [["your_marker_name_here",direction the roadblock would face (0-360),"side of units you want manning the gate",bargate destruction option (1 or 0),site type option (0,1,2,3),auto road direction (0,1),auto direction flip (0,1),roadscan distance (10)]];
The karma_roadblock_list array I used as an example will produce the following:
Site 1 - Basic roadblock site with 3 NATO units and a bargate that is indestrutable
Site 2 - Same basic site but is armed with static HMGs manned by AAF units and a bargate that can fall over.
Site 3 - Large Sandbag Bunkers
Site 4 - Spawns base around roadblock (Instabase).

3. Place markers on the map in the editor.
Following the example code above you would place to markers on your map called roadblock_1 and roadblock_2. The names can be anything you would like to use as long as you edit the karma_roadblock_list array to reflect the maker names you would like to use. Any kind of marker listed in the editor will work I use the invisible marker type so it will not show up on the map while in game. You can also add additional roadblock as long as you follow the format shown in the example karma_roadblock_list that was shown above.

4. Set the direction in degrees you want the roadblocks to face in the array.
The example listed uses 180 degrees and 90 degrees. This might require a little tweaking in the editor to get the roadblock placed how you like it.
Hint on the smaller sites the marker on the map seems to correspond with one of the legs of the bargate.

5. Set the desired side in the array. Accepted values are "NATO", "CSAT", "FIA", "AAF", "CUSTOM".
"CUSTOM" is designed to get the script to work with custom units made by the Arma Community. This option will require some additional configuration in the karma_roadblock_list array. Below for an example.

6. Set Option for bargate destruction.
Use 1 for an indestructible bargate that will damage vehicles. Use 0 for a bar gate that will just fall over when hit. Handy If you want to crash through roadblocks.

7. Set Site Type. Currently I made 3 different sites (List will get bigger in time)
Use 0 for simple site with 3 units (Same As Version .01)
Use 1 gives a site that appears the same as 0 but with 2 Static HMGs in bunkers.
Use 2 to give you a basic site with Large Sandbag Bunkers instead of small ones (Handy in large open areas)
Use 3 to creates a base around a site identical to site number 1, or "Instabase" as I call it.

8. Set Auto Road Direction Mode.
Use 1 to enable auto direction mode. This will get the direction of the road the roadblock is placed on.
Use 0 for standard placement method.

9. Set Auto Road Direction Flip
Use 1 to rotate the direction of the roadblock 180 degrees when auto direction mode is on.
Use 0 for standard placement or to keep the default direction of the road direction.

10. Set Road Scan Distance
Use any number to find road segments within the given distance. (5 to 10 seems to work well)

11. Preview and enjoy.
Note: Side of the AAF will change depending on the side selected in the Mission Editor Intel Area for Independents.

Custom Unit Usage:
To use with Mod units you will need the class names of the mod units you would like to use. Then add them to the the karma_roadblock_list. The side of the custom units will also be required:
karma_roadblock_list = [["roadblock_1",0,"CUSTOM",1,0,1,0,10,WEST,["B_Soldier_F", "B_soldier_AR_F", "B_soldier_LAT_F", "B_Soldier_GL_F"]],
["roadblock_2",0,"CUSTOM",1,1,1,0,10,WEST,["B_Soldier_F", "B_soldier_AR_F", "B_soldier_LAT_F", "B_Soldier_GL_F"]],
["roadblock_3",0,"CUSTOM",1,2,1,0,10,WEST,["B_Soldier_F", "B_soldier_AR_F", "B_soldier_LAT_F", "B_Soldier_GL_F"]],
["roadblock_4",0,"CUSTOM",1,3,1,0,10,WEST,["B_Soldier_F", "B_soldier_AR_F", "B_soldier_LAT_F", "B_Soldier_GL_F"]]];

Add the side of the units after the site type value. Then add an array of the class names that you would like to use. This list can contain as many different units classes you want to use and the three units will be selected at random in the script.

Optional Script Parameters:
-Debug Mode
I added this to aid with install and a quick way to check if the script was installed correctly. Add this line of code in your init.sqf file somewhere above the karma_roadblock_list:
karma_roadblock_debug = 1;
If this variable is set to 1 you will get a hint telling you the script is running. The hint will also tell you how many sites should be spawned.There is also a side chat that will trigger for each time the site is spawned.

Set karma_roadblock_debug to 0 if you want to leave the variable but disable Debug Mode.
- Gate Timing And Control Options
Add these two lines to your init to customize the gate checking timing and distance:
karma_roadblock_distance = 15;
karma_roadblock_check_sleep = 2;
Distance is the distance to check for new units in area of bargates. Similar to area of a trigger. Check sleep will allow you to time how fast the gate will check for new units. The higer the value the longer you will have to wait at a bargate, as well as increase the time it will remain open. Lower sleep values may affect script performance.

Sttosin made a few videos testing out the script if you would like to take a look:

Future plans:
-Different Site Layouts For The Roadblock I.E. Different Bunkers And Other Objects
-Different Ways To Get Gate Open If Troops Manning It Are Alive I.E. Present Credentials,Bribe,Talk

If you have any bugs or feature requests feel free to let me know.

Credits & Thanks:
Thanks to the entire Arma Community and BI Forums for any help that you provided
sickboy - Giving a great example of dynamically naming objects and for SixConfigBrowser.
Kylania - His website with all the great script examples. Great guide when I started scripting.
subminuentisch - For his help with development and PBOing of the Mod version of the script.
ARJay - For his function for finding direction of road segments.

- Add Auto Direction Option for the roadblock to automaticly get the direction of the road the roadblock was placed on.

- Add option for custom (mod) units
- Add Timing and Distance as customizable values
- Minor script improvements.

v0.5 Alpha
- Added debug mode to easily test proper installation of script
- Changed file name of the init.sqf file in the karma_roadblock folder to prevent confusion of 2 init.sqf files
- Changed bunker spacing to make it look more realistic on two lane roads.
- Now Three different types of sites that can be spawned.
- Set bargate damage mode added as an option for each site. (Indestructible Or Destructible Bar Gates)
- Tested in multiplayer game.
- Some Basic Code Improvement.

v0.1 alpha
- first release

Forum topic:
- BI forums

Enable javascript to be able to download from Armaholic please!

Tags: Gate,   Roadblock