Jump to content
phronk

[Release] Simple IED Script

Recommended Posts

There is a 100% chance it will spawn the amount of IEDs you've defined in the script; The rubbish spawns are random.

Share this post


Link to post
Share on other sites

Is there anyway to add the new mines (cluster) and UXO's from the Laws of War DLC into to the rotation of spawned IED's?

This would give a better overall diversity of threats players could encounter. 

 

Thanks for the hard work on this script.

 

Reed

Share this post


Link to post
Share on other sites

In the settings:

 

    iedMkr         =    ["iedMkr0","iedMkr1","iedMkr2","iedMkr3"];
    iedNum         =    5;
    iedDmg         =    false;
    Dbug         =    false;
    iedBlast     =    ["Bo_Mk82","Rocket_03_HE_F","M_Mo_82mm_AT_LG","Bo_GBU12_LGB","Bo_GBU12_LGB_MI10","HelicopterExploSmall"];
    iedList     =    ["IEDLandBig_F","IEDLandSmall_F","IEDUrbanBig_F","IEDUrbanSmall_F"];
    iedAmmo     =    ["IEDUrbanSmall_Remote_Ammo","IEDLandSmall_Remote_Ammo","IEDUrbanBig_Remote_Ammo","IEDLandBig_Remote_Ammo"];
    iedJunk     =    ["Land_Garbage_square3_F","Land_Garbage_square5_F","Land_Garbage_line_F"];

  • Like 2

Share this post


Link to post
Share on other sites

On deticate server, try change if(!isServer)exitWith{}; 

For this!

if(!isServer or !isDedicated)exitWith{};

Edited by danielmjmarques
syntax error

Share this post


Link to post
Share on other sites

isServer will work for both client-hosts and dedicated hosts, so it isn't necessary as far as I know. In other words, I want the script to work if the script is used in a single-player, local hosted, or dedicated hosted mission.

Share this post


Link to post
Share on other sites

hi @phronk

 

your script looks really nice!

i am looking for a way to include a IED spawner in various sites of my dynamic spawn scripts.

 

would you mind if i implement your code(or parts of it/adaptations of it) in my project? 

 

this is the project:

 

 

i will certainly give adequate credit for your work;)

cheers

vd

  • Like 1

Share this post


Link to post
Share on other sites

Sure, go for it. :)

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
On 11/6/2018 at 3:55 AM, phronk said:

Sure, go for it. :)

thanks!:)

Share this post


Link to post
Share on other sites
On 6/2/2017 at 3:46 AM, phronk said:

I've never seen that before, but it probably has to do with this:

 


_ied setPosATL(getPosATL _ied select 2+1);

 

 

The + 1 at the end adjusts the elevation.  What's weird is I've never seen this in my tests, but I'll investigate more.  To fix it, try to change the + 1 to a 0.

That is not possible. If you replace the 1 with 0 (or anything between 0 and 1) you get an error that says "Type Number, expected Array". Same happens if you delete the +1 completely.

I also tried -to see what happens- with values greater than 1 and I got "Error Zero divisor".

 

Any idea how can I fix that "floating IED" bug? It happens sometimes (not a lot, but still).

 

PD: Awesome script!

Share this post


Link to post
Share on other sites

Just to get som life in to this...

Ace3 mine dont work

Share this post


Link to post
Share on other sites

I may look into rewriting some of the code to fix some of the issues reported. No ETA.

  • Like 1

Share this post


Link to post
Share on other sites

Hi @phronk

I would like to use your script directly when in MP game to dinamically create ied on roads. 

I can run a calling script (PlaceIED.sqf) during game by personal interface. Of course it  runs locally and calls your script (ied.sqf) to be executed on server.

 

PlaceIED.sqf

.... other strings that define the marker area, ieds number...

// Defining of global parameters so to be recognized by called ied.sqf
iedMkr=["SpawnIED"];    //List of markers to spawn IEDs in
iedNum=_numeroied;      //Number of IEDs per marker, defined in iedMkr    [Default: 5]
iedDmg=_armayes;        //Can the IED be killed with weapons?            [Default: false] TRUE = Yes | FALSE = Can only be disarmed
Dbug=_iedshow;          //Show IED markers on map?                        [Default: false]    

// call ied.sqf to be executed on server
["ied.sqf"] remoteExec ["execVM",2,false];

sleep 5; // Note: this gives time to the ied.sqf to complete the run before marker deleting

// deleting of marker
deleteMarker "SpawnIED";
hint "IEDs placed";

 

Your ied.sqf script

/* these are not need because already defined as global variables in PlaceIED.sqf
iedMkr=["iedMkr0","iedMkr1","iedMkr2"]; //List of markers to spawn IEDs in
iedNum=5;              //Number of IEDs per marker, defined in iedMkr [Default: 5]
iedDmg=true;  //Can the IED be killed with weapons? [Default: false] TRUE = Yes | FALSE = Can only be disarmed
Dbug=false;     //Show IED markers on map? [Default: false]
*/

//!!DO NOT EDIT BELOW!!
iedBlast=["Bo_Mk82","Rocket_03_HE_F","M_Mo_82mm_AT_LG","Bo_GBU12_LGB","Bo_GBU12_LGB_MI10","HelicopterExploSmall"];
iedList=["IEDLandBig_F","IEDLandSmall_F","IEDUrbanBig_F","IEDUrbanSmall_F"];
iedAmmo=["IEDUrbanSmall_Remote_Ammo","IEDLandSmall_Remote_Ammo","IEDUrbanBig_Remote_Ammo","IEDLandBig_Remote_Ammo"];
iedJunk=["Land_Garbage_square3_F","Land_Garbage_square5_F","Land_Garbage_line_F"];
if(!Dbug)then{{_x setMarkerAlpha 0;}forEach iedMkr;};

if(!isServer)exitWith{};
iedAct={_iedObj=_this select 0;
if(mineActive _iedObj)then{
_iedBlast=selectRandom iedBlast;
createVehicle[_iedBlast,(getPosATL _iedObj),[],0,""];
createVehicle["Crater",(getPosATL _iedObj),[],0,""];
{deleteVehicle _x}forEach nearestObjects[getPosATL _iedObj,iedJunk,4];
deleteVehicle _iedObj;};};

........... rest of your script

It works in SP but not in MP (dedicated). Any help and suggestions about it?

I tried also to pass variables in the remoteexec but not work.

Maybe the  if(!isServer)exitWith{}; stops the code? If yes why? Because I execute it on server.

Thanks in advance.

  • Like 1

Share this post


Link to post
Share on other sites

Not totally sure why it won't work, but it's possible you need to change:

["PlaceIED.sqf"] remoteExec ["execVM",2];

 

to

 

"PlaceIED.sqf" remoteExec ["execVM",2]; //Script being called doesn't need to be within brackets and also the false isn't necessary to add because it is false by default.

Share this post


Link to post
Share on other sites

Hi phronk thank you for your answer. I tried as you said but doesn't work. The two strings are the same.

I found the solution passing varible in another way.

 

PlaceIED.sqf

.... other strings that define the marker area, ieds number...
       
        _iedMkr=["SpawnIED"];    //List of markers to spawn IEDs in
        
         [[_iedMkr,_numeroied,_armayes,_iedshow],"ied.sqf"] remoteExec ["execVM",2];
    
    sleep 5; // Note: this gives time to the ied.sqf to complete the run before marker deleting
        // deleting of marker
        deleteMarker "SpawnIED";
        hint "IEDs placed";

Your ied.sqf script

// inputs
_iedMkr1 = _this select 0;
_iedNum1 = _this select 1;
_iedDmg1 = _this select 2;
_Dbug1 = _this select 3;

// set global the inputs as requested by your script
iedMkr = _iedMkr1;    //List of markers to spawn IEDs in
iedNum= _iedNum1;    //Number of IEDs per marker, defined in iedMkr    [Default: 5]
iedDmg= _iedDmg1;    //Can the IED be killed with weapons?            [Default: false] TRUE = Yes | FALSE = Can only be disarmed
Dbug = _Dbug1;        //Show IED markers on map?                        [Default: false]    


//!!DO NOT EDIT BELOW!!
iedBlast=["Bo_Mk82","Rocket_03_HE_F","M_Mo_82mm_AT_LG","Bo_GBU12_LGB","Bo_GBU12_LGB_MI10","HelicopterExploSmall"];
iedList=["IEDLandBig_F","IEDLandSmall_F","IEDUrbanBig_F","IEDUrbanSmall_F"];
iedAmmo=["IEDUrbanSmall_Remote_Ammo","IEDLandSmall_Remote_Ammo","IEDUrbanBig_Remote_Ammo","IEDLandBig_Remote_Ammo"];
iedJunk=["Land_Garbage_square3_F","Land_Garbage_square5_F","Land_Garbage_line_F"];

.... the rest of the script....

After some tests it works only with this solution.

Anyway thank you, your script is great. Thanks for sharing.

Cheers

Share this post


Link to post
Share on other sites

No problem, glad you were able to get it working.

Share this post


Link to post
Share on other sites

i know this is an old thread but is there any way to make the IEDs spawned within the markers totally random say between 0 and 5 

Share this post


Link to post
Share on other sites

That's the way it is designed; The defined number of IEDs will spawn on random road segments within your defined marker(s). If you want the number of IEDs to be random, set iedNum to:
iedNum = round random 5;

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

×