Randomly generated roadside IEDs

brians200
8
17,965
Hello,

I am here to release a script I created that randomly generates IEDs. It is based off of the original work from Tankbuster and Mantls's update on that.

VIDEOS
Release v1.0 video - https://www.youtube.com/watch?v=_XRlKUd7d2k
Release v1.1 video - https://www.youtube.com/watch?v=v7CZDESIw8g
Release v1.2 video - https://www.youtube.com/watch?v=YZRS37J6CIY
Release v1.5 video - https://www.youtube.com/watch?v=ZeyHyyuFawo
Release v2.1 video - https://www.youtube.com/watch?v=mX8FVK6CjJA
Release v2.2 video - https://www.youtube.com/watch?v=r-a28OFb8xs
v1.5 Tutorial video - https://www.youtube.com/watch?v=E2EdlbSlcrc
v2.3 Tutorial video - https://www.youtube.com/watch?v=soq0VFX47O0

IMAGES
http://i.imgur.com/tirV1Dk.jpg
http://i.imgur.com/ttIV6LX.jpg
http://i.imgur.com/nr2nbVM.jpg (556 kB)

Adding the script to your mission file is pretty simple, all you need to do is put the folder into your mission folder and add the following to your init.sqf
Code:
[] spawn {call compile preprocessFileLineNumbers "EPDIed_Init.sqf";};
And copy the following into your description.ext
Code:
class CfgFunctions {
    #include "EPDEPDcfgFunctions.hpp"
};
If you want to change where or how many IEDs are spawned when the mission starts, modify the variable called iedInitialArray in Ied_Settings.sqf.

There are several ways to define where you want the IEDs placed.
Code:
//These are the actual IEDs that will spawn. Add them using one of the following formats.
//mapLocations must have their type defined as one of "NameCityCapital","NameCity","NameVillage", "NameLocal"
//["All", side]
//["AllCities", side]
//["AllVillages", side]
//["AllLocals", side]
//["mapLocation", side]
//["mapLocation", amountToPlace, side];
//["mapLocation", iedsToPlace, fakesToPlace, side]
//["mapLocation", amountToPlace, [fakeChance, smallIedChance, mediumIedChance, largeIedChance], side]
//["predefinedLocation", side]
//["predefinedLocation", amountToPlace, side];
//["predefinedLocation", iedsToPlace, fakesToPlace, side]
//["predefinedLocation", amountToPlace, [fakeChance, smallIedChance, mediumIedChance, largeIedChance], side]
/*********Marker size > 1**********************/
//["marker", amountToPlace, [fakeChance, smallIedChance, mediumIedChance, largeIedChance], side]
//["marker", iedsToPlace, fakesToPlace, side]
//["marker", amountToPlace, side]
//["marker", side]
/*********Marker size = 1**********************/
//["marker", side]
//["marker", chanceToBeReal, side]
//["marker", [fakeChance, smallIedChance, mediumIedChance, largeIedChance] , side]

//The side can be a single side, or an array of sides
//Ex. "West"   or ["West,"East"]
//http://community.bistudio.com/wiki/side
The way it works is that it will use the markerName as the center and find all the roads within the radius of the marker (make sure you set it!), then it will randomly place real and fake IEDs somewhere within it.
There are several predefined locations for Altis in EPDIed_Settings.sqf that you can use if you don't feel like making your own markers. As of version 1.3, you can also use the names of locations in the game. If you want to share your predefined locations for other maps for others to use, feel free to, and I will post them here on the front post.
Here is a map of where each AltisRandom corresponds to.
If you do not specify how many to place, it will calculate an amount based on the size of the marker you gave it. If the marker has a size of 1, it will place exactly 1 IED in that exact spot, allowing you to pick where the IED is at, rather than a random road near the marker. There is an example of each type in EPDIed_Settings.sqf.

There are currently 4 types of IEDs
  • Secondary IED - Designed to kill first responders after the other IEDs goes off.
  • Infantry IED - Will kill the person who sets it off and injure most other squad members near him
  • Light Armor IED - Will destroy hunter type vehicles and usually disable marshall type vehicles.
  • Heavy Armor IED - Will destroy all vehicles and cause lots of mayhem

The type of IED also determines what size the object it is hiding in is. Heavy Armor IEDs will be hidden in things like trash piles and wrecked vehicles. Infantry IEDs will be hidden in things like buckets and tires.

IEDs are set off based on speed and proximity. If your horizontal velocity squared is higher than 2.8, and you are within 11 meters of it, you will set it off.
The IEDs can be disarmed if you have the appropriate items and are within 3 meters. If you fail while trying to disarm an IED, you will set it off.

Settings that can be changes as of version 2.0
  • EPD_IED_debug - If this is set to true, it will create map markers indicating where the IEDs and fakes are. It will create a message showing if a player is near an IED and give their distance and speed (see picture 2). It will also create a message if there are secondaries incoming. These will only show up to the person who is the server. This is mostly useful for testing while developing a map.
  • hideIedSectionMarkers - Set this to true if you want it to hide the marker you used to position the IED circle.
  • hideSafeZoneMarkers - Set this to true if you want it to hide the marker you used to position safezones.
  • itemsRequiredToDisarm - A player must have all of these items in order to have a disarm option.
  • betterDisarmers - Players of these classes have an increased chance of disarming IEDs
  • baseDisarmChance - Default chance of successfully disarming an IED
  • bonusDisarmChance - Players who are in the betterDisarmers array will have this amount added to their baseDisarmChance
  • secondaryChance - Chance that secondary explosions will spawn
  • smallChance - Chance that an IED will be small sized
  • mediumChance - Chance that an IED will be medium sized
  • largeChance - Chance that an IED will be large sized
  • iedSecondaryItems - Items secondary IEDs will hide in
  • iedSmallItems - Items Infantry IEDs will hide in
  • iedMediumItems - Items Light Armor IEDs will hide in
  • iedLargeItems - Items Heavy Armor IEDs will hide in
  • predefinedLocations - If you want to use the same locations over lots of missions without having to create markers over and over, define them here using the following format ["Name",[LocationX,LocationY,LocationZ],size]. Most of Altis has been provided as an example.
  • allowExplosiveToTriggerIEDs - If this is set to true explosions can set off the IEDs.
  • iedInitialArray - This is where you actually pick where the IEDs are spawned and how many when the mission starts. See the code above for the format
  • iedSafeZones - Place the mapLocations, predefinedLocations, and markerNames of places you don't want any random IEDs spawning


Explosives Requirements
  • Planted explosives and Bombs have a 100% chance of setting off IEDs if they are within 6 meters
  • Hand grenades have a 35% chance of setting off IEDs if they are within 6 meters
  • Rockets, Missiles, Shells, and Submunitions have a 100% chance of setting off IEDS if they are a direct hit
  • Launched grenades have a 50% chance of setting off IEDs if they are a direct hit
  • Explosive bullets have a 40% chance of setting off IEDs if they are a direct hit


Creating IEDs after the mission has started
Version 2.0 introduced the ability to create IEDs in the middle of a mission. Create an array similar to how you did for the iedInitialArray then call the CREATE_IED_SECTION function. For example,

Code:
[["OreoKastro", "West"]] call CREATE_IED_SECTION;
This will return a randomly generated string of the new section created, hold onto this if you plan on doing any other functions with this section.

OR
Code:
["sectionName", ["OreoKastro", "West"]] call CREATE_IED_SECTION;
This will return the sectionName string you passed in, hold onto this if you plan on doing any other functions with this section.


Checking the status of a section of IEDs
If you want to know how many IEDS have been blown up or disarmed in a section, use the GET_IED_SECTION_INFORMATION function.
Code:
"sectionName" call GET_IED_SECTION_INFORMATION;
//Returns [#iedsExploded, #iedsDisarmed]
If you want to know how many IEDs remain in a section, use the GET_REMAINING_IED_COUNT function.
Code:
"sectionName" call GET_REMAINING_IED_COUNT;
Removing sections of IEDs
If you want to remove a section of IEDs, use the REMOVE_IED_SECTION function.
Code:
 "sectionName" call REMOVE_IED_SECTION;
Getting the last IED explosion location
If you would like to set up ambushes and the like, you can check the value of lastIedExplosion to get the location of the last IED to go off. Then have your units react appropriately.

Change Log:
Version 2.3
  • Triggers are now created and deleted as they are needed to reduce the strain on the server. Only IEDs with a soldier or vehicle within 250 meters of them will have a trigger actively checking for victims.
  • Fixed the "bucket bug". This should remove the lag the explosions were creating on servers with more than a few players. Special thanks to serjames
  • Smoke plumes now travel much faster.
  • Reduced the number of plumes for each IED.
    1. Small IED: 0-7
    2. Medium IED: 5-19
    3. Large IED: 15-34
  • Rocks are now flung a little bit farther so you can see them outside of the smoke.
  • Other small particle tweaks.
  • Fixed shrapnel logic so it produces different amounts based on the size of the IED. (The code was in the wrong order in the last release, causing it to produce the same amount for every IED)

Spoiler:


Known Issues:
  • Sometimes the IEDs will spawn behind a wall.
  • Deactivating a charge near an IED will set off the IED.



Download Here v2.3
Armaholic Mirror
Older versions
Spoiler:

Comments

Copyright © 2017. APC Technology Group. All Rights Reserved.