Well it's been a long time coming but my advanced IED script is ready, Ive packaged it with a small test mission ( in editor format, so you can see how it's done ).
Note: 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.
About the script
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.
About the included mission
The included mission ( 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.
Finally, I never intended to upload this script, but because a few people wanted a more advanced script I've decided to, I have tested this version some 40 times & to me it seems to work well, but problems may come to light when more people use it, so think of it as testing it. I have never uploaded a file to the internet before so it could have gone wrong but this should be the link:
Warning read this: It has been brought to my attention (thanks to Gnarly Rider) that there are several errors in the Script documentation, these are as follows:
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).
I would just like to add that this script would not have been possible without all the tutorials out there & the information provided on the forums, I would like to thank everbody who has submitted information & taken the time to write these great tutorials.
Last edited by 00dc15; Sep 20 2010 at 12:33.
Reason: Errors in documentation document
Thanks, it's been a nightmare but I think it's working well now, once again thanks for your help & for posting your scripts & little missions. Having not edited & scripted since the old Operation Flaspoint Days, things have changed a little & I've forgotten alot, but your scripts & missions coupled with some great tutorials around & this forum made it possible.
---------- Post added at 11:45 PM ---------- Previous post was at 11:40 PM ----------
@ Gnarly Rider,
You may be the first test subject, good luck & let me know how you get on.