Author: James (00DC15)
Author Website:

Requirements: No addons required

Version: 1.0

Short description: This script provides you with an easy way to have the AI place an IED & then semi intelligently find an observation location that they can see it from.

Date: 2010-09-23 06:20

Comments: (2)


Advanced IED script

James (00DC15)

This script provides you with an easy way to have the AI place an IED & then semi intelligently find an observation location that they can see it from.

They will place the IED at there current location either at the start of the mission (if the random time put in by you is 0) or sometime up to the maximum random time you put in. If they have waypoints these will now be deleted.

Next they will run to a random position, the type of location depends on where they are & what options you set, they will 1st try buildings (only OA buildings & only the common town/village buildings), next they will try objects & finally random positions all within a pre-defined minimum & maximum range of the IED. If there are no buildings or you set a limit of 0 on buildings, they will search objects, again if there are no objects or you set the object limit to 0 then they will try random positions.

When they get to a building they will move to different building positions (not all of them) as defined by the script, they will also try different stances at each building position where appropriate (1st prone, then crouched & finally standing) if they spot the IED in a specific stance then they will remain in that stance. The building positions & stance types are all configured in the script, for example some buildings may have 10 building positions but the IED men will only try 6 of them, this is to speed up the time it takes for them to find a suitable position & also because some building positions are either too close to another one or don't provide enough of a view outside. Likewise there stances are limited by building position, for example If the IED man is inside by a window he will only stand or if he's on a roof without a wall he will try all 3 stances or if there is a wall he will just try crouched & standing. When trying object locations or random positions they will always try all 3 stances.

Once at a building position, object or random location a hidden dead body is placed by the IED, this body is then made visible for 5 seconds at every stance & then hidden before they move onto the next building or position, once they can see the IED the body is deleted. The body is the only way I could get them to detect the IED, in fact they don't detect the IED they detect the body, I tried objects both buried & on the surface but they can spot them through walls, the only things I found that work are men alive or dead & static weapons ( though they don't work as well as men do ), if anyone can come up with a better solution please do.

Once a position is found they stay there & observe the IED ( using binoculars ( if this option is selected )) until BLUFOR get in range of the IED, at this point if the IED trigger man has knowledge of the BLUFOR unit the IED will be detonated after a random time of up to 5 seconds.

Once the IED is detonated the IED triggerman is given a negative rating of 10000 meaning if he's civilian BLUFOR may now shoot him, also at this point his captive status is removed so if He's OPFOR, BLUFOR will now engage him. Also his never fire condition is now set to Hold fire, so if he's engaged he will shoot back. There is also an option you can set for him to run away, if set he will now sneak off to a randomly picked location within a certain minimum & maximum range, therefore giving you the option to chase him if you weren't killed by the IED.

Finally some other quick notes, there are 4 BAF IED's he can either use 1 of the 4 types or you can set it to random. There is a limit you can put on how many objects or buildings he'll try. There are 2 types of movement you can select when he's looking for an observation position, the first he will run to different locations & the second teleports him to each position (this is the quickest way). There is an option for him to use binoculars when observing the IED waiting for BLUFOR, this makes him more identifiable as an IED triggerman ( he will use binoculars for a few seconds every 20 or so seconds ). In order for him to use all the stances when detecting the IED, I found it problematic if he didn't have a gun, so the script gives him a Makarov pistol & ammo but if you want him to be unarmed you can set it so when he's spotted the IED the pistol is removed.

I think that's about it, I'm no expert in scripting so the more experienced scripters may have a fit about the way I've coded it, but from my point of view it works. I will continue to improve the script & add further options, but if any one wants to re-write sections or adapt it to there requirements please feel free. Finally please feel free to post any comments or questions & I'll try to answer them, if you do change the script or have a better idea please post it in this topic.

Gameplay notes:
1) All IED men are given a Makarov Pistol and ammo by the script, the reason for this is that the AI if unarmed don't seem to go from crouched stance to standing when trying to spot the IED (it can be removed once they have found a hiding position (see Explanation of code)).

2) All IED men are set to captive & never fire, when the script starts (this allows you to use OPFOR & they won't be shot or engaged).

3) Once either they have detonated there IED or the player has spotted them (Spotted them requires the players Knowsabout value to be 4 & for the players cursor to be on them) they will be returned to non captive & have a negative rating (this means if they are civilian you & other BLUFOR may shoot them).

It comes with a mission as a demo version. Extract the folder to your ArmA2\other Profiles\Yournick\Missions and load it in the editor.

Included Demo mission:
It ( well a few units thrown into the editor & some hints to tell you what to do) will show you some of the features of the IED script, due to the random operation of the script and the AI it will play differently each time to a degree, the first 3 IED’s will always be at the same position but the location the IED trigger men hide at will vary to a degree. The 2 IED’s in the town are deployed at a random time so the IED’s position will vary & determine where the trigger men may hide. Also due to the AI sometimes they will not notice the BLUFOR units approaching the IED & the way the triggers work, this leads to the IED not going off, to be honest I like this chance as it sort of simulates a failed detonation. In testing I’ve found this to not happen very frequently.

You may find at the start of the mission nothing happens for a few minutes, this is to be expected as I've stopped the vehicles moving until the 1st 3 IED men are ready, this is normaly under 5 minutes. If & When you play the mission, once you've been dropped off & follow the patrol squad, don't be too realistic in your combat, just leave your unit at there origanal settings (formation, combat mode etc.) & follow the squad infront of you, don't target anyone or worry about scanning the horizon, you will get a chance to do that later.

Place a unit (civilian or OPFOR).

Put this in his Init Line:

null= [this,10,5,Rnd,Sw,0,"bin","noGun","Run",I] execVM "IED_Man_v6.sqf";

Note: The above code line can be configured differently (see below).

Explanation of above code

this = the IED man (If the above code is not in his Init line, this will be the IED mans name).

10 = The maximum amount of building to try (can be any value (0 would mean don't try buildings)).

5 = The maximum amount of objects to try (can be any value (0 would mean don't try objects)).

Rnd = Type of IED to deploy (there are options listed below)
    Rnd = Random IED (could be 1 of the 4 BAF IED's)
    GrndS = BAF IED Ground small.
    GrndL = BAF IED Ground large.
    GarbS = BAF IED Garbage small.
    GarbL = BAF IED Garbage large.

Sw = The type of movement between places (there are options listed below)
    Sw = Teleport him to each position (much quicker for him to find a suitable location).
    Mo = He will run to each location (much slower for him to find a suitable location).

0 = Time (in seconds) before he deploys the IED & looks for a location.
    0 would mean he deploys the IED at the start of the mission.
    120 would mean he waits for a random time up to 120 seconds.
    This can be used if he has waypoints, so he will deploy the IED randomly on his route.

"bin" = When he has found a location he can use binoculars or not (options below)
    "bin" = He will use binoculars.
    "" = He will not use binoculars.
"NoGun" =
    This will remove his pistol the script gave him, once he's found a location (options below).
      "No Gun" = His pistol is removed (Note: if he has a main gun that won't be removed).
      "" = He will have a pistol & ammo.

"Run" = After detonation of the IED he can either stay in position or Run off to another location.
    "Run" = He will leave his current location & move to another random location.
    "" = He won't leave his current location.

So an example: We want him to look for a hiding position in 5 buildings, if that fails then 2 object locations, he will deploy a Ground Large IED, he will Run between locations, he will deploy the IED at a random time less than 60 seconds, he will have binoculars, he will have a handgun, he will run once the IED is detonated, here's the code:

null= [this,5,2,GrndL,Mo,60,"bin","","run"] execVM "IED_Man_v6.sqf"

The test mission requires Operation Arrowhead & the script is designed for OA as well but could be changed to work with ARMA2, the buildings part of the script will only work with the OA buildings.

Documentation errors:
1) Put this in his Init Line: null= [this,10,5,Rnd,Sw,0,"bin","noGun","Run",I] execVM "IED_Man_v6.sqf";
The Rnd & Sw both need to be in quote marks ( "Rnd" "Sw" ).
The I shouldn't be there (don't put it in).

2) Where ever you see either Rnd , GrndS , GrndL , GarbS, GarbL, Sw or Mo put the names in Quote marks.

3) null= [this,5,2,GrndL,Mo,60,"bin","","run"] execVM "IED_Man_v6.sqf"
Again in this line the GrndL should be "GrndL" (in quote marks) & Mo should be "Mo" (in quote marks).

Forum topic:
- BI forums

Enable javascript to be able to download from Armaholic please!

Tags: Ied