Jump to content

Recommended Posts

Hello,

there are many ways to create an IED script but many things involve public or external variables, triggers and many stuff that makes it complex.

This is a simple script that you also can use as function for multiple objects and triggers the IED automatically with just one script line inside the object you'd like to blow up.

 

Does this work in multiplayer?

Yes, it works in MultiPlayer and SinglePlayer

 

How does this script work?

As soon as AI or a player walks near it, it just explodes, leaving scripted debriefs and craters based on explosion intensity.

 

Parameters

It accept 3 parameters:

- currentObject → it is the object in the editor that you trigger to explode;

- iedIntensity → It used 3 level of intensity (how big is the blast), obviously you can put 1, 2 or 3.

- isCar → boolean value (true, false) if is a car, if true keeps wreck of the vehicle.

 

How do I call the script?

Just open the object you'd like to have an IED and put the following line:

[this, 1, true] execVM "iedBlast.sqf";

iedBlast.sqf

//Uncomment following if used as function
//params["_currentObject","_iedIntensity","_isCar"];
//Uncomment following if used as script
_currentObject = _this select 0; _iedIntensity = _this select 1; _isCar = _this select 2;
  
_positionCrater = getPosATL(_currentObject);
_debriesCount = 0;
_exploded = false;
while { !_exploded } do
{
	//Check if players are around
	{
		if((_x distance _currentObject) < 5) then { _exploded = true; };
	} forEach allUnits;
	if(_exploded) then
	{
		switch(_iedIntensity) do
		{
			case 1:
			{
				_bombType = "M_Titan_AT" createVehicle (getPos _currentObject);
				soilCrater = "Land_ShellCrater_01_F" createVehicle ([0,0,0]);
				_debriesCount = 3;
			};
			case 2:
			{
				_bombType = "Bo_Mk82" createVehicle (getPos _currentObject);
				soilCrater = "Land_ShellCrater_02_small_F" createVehicle ([0,0,0]);
				_debriesCount = 10;
			};
			case 3:
			{
				_bombType = "IEDLandBig_Remote_Ammo" createVehicle (getPos _currentObject);
				soilCrater = "Land_ShellCrater_02_large_F" createVehicle ([0,0,0]);
				_debriesCount = 15;
			};
		};
		soilCrater setPos _positionCrater;
		//---Keep Car Wreck---
		if(!_isCar) then { deletevehicle _currentObject; }
		else { _currentObject setDammage 1; };
		//---Spawning debries---
		//Land_ShellCrater_02_debris_F
		for "_i" from 1 to _debriesCount do
		{
			_distance = [2, _debriesCount] call BIS_fnc_randomInt;
			_direction = [0,359] call BIS_fnc_randomInt;
			_randomPos = [_positionCrater, _distance, _direction] call BIS_fnc_relPos;
			"Land_ShellCrater_02_debris_F" createVehicle _randomPos;
		};
	};
};

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×