Jump to content
Sign in to follow this  
Antman2o1o

EMP Grenade To Kill De-mining Drones

Recommended Posts

Does anyone know of a script for a an EMP grenade that is associated to the IR grenade that would take out a  demining drone flying above?

 

Any ideas or suggestions appreciated Ant.

Share this post


Link to post
Share on other sites

Little help If I can get it. Hey folks i am trying to put together an EMP Script that is assigned to the NATO I.R. Grenade.

With little to no luck. Not sure if I am on the right track here at all. Maybe someone with more skill can help guide this to become something.

 

Got Idea from HallyG's post 

 

 

The goal of the script is to toss a NATO IR grenade out to help combat the Drone Kiddies who sit with de-mining drones limiting everyone's ability to move anywhere on the map.

I could not find the de-mining drone class name so not sure about that either. The script needs to work in a multi-player environment.

 

So here goes.

 

emp.sqf

AOE = _this select 0; 
 _Drones =  nearestObjects [_AOE , ["B_UAV_01_F", "I_UAV_01_F","O_UAV_01_F"], 50]; 
 _DamageOFF = 0.95; 
 _DamageON = 0.00; 
 _Vehicles = nearestObjects [(getpos _AOE), ["Car", "Drones"], 50]; 

 _CountLights = count _Lights; 
 (_Lights select 0) say3D "electricity_loop"; 
 sleep (floor(random 3) +2); 

 for "_i" from 0 to _CountLights do //this will run 1 extra time
 //replace 0 with 1 or _CountLights with (_CountLights - 1)
 { 
if (getDammage (_Lights select _i) < 0.90) then 
   { 
       (_Lights select _i) setDamage _DamageOFF; 
       sleep 0.1; 
       (_Lights select _i) setDamage _DamageON; 
       sleep 0.1; 
       (_Lights select _i) setDamage _DamageOFF; 
       sleep 0.1; 
   }; 
 }; 
   {  
       if (isEngineOn _x) then {_x setHit ["motor", 1]} 
   } foreach _Vehicles;

 

 

main mission init.sqf

 

player addEventHandler ["Fired", 
 { 
 if (_this select 5 == "B_IR_Grenade")  
  then { 
   _this spawn { 
                _bullet = _this select 6; 
                _newpos = getPosATL _bullet; 
                while {(_newpos select 2) > .1}  
                do { 
                    _newpos = getPos _bullet; 
                    sleep 0.1; 
                    }; 
                      [_bullet] execVM "addons\scripts\emp.sqf"; 
                }; 
        }; 
 }]; 

 

Any Help Appreciated 

Ant

 

Share this post


Link to post
Share on other sites

@Antman2o1o,

If you just focus on what you want to add it would be something like,

	_posThis= position _this; //determine the grenade position (_AOE in reference script)
	_drone = nearestObjects [(getpos _posThis), ["DRONENAMES"], 200]; //this array must contain the class names of possible drones 
	_countTargDrone = count _drone;
for "_i" from 0 to _CountTargDrone do {{setDammage 1;} forEach _drone;};// this can just be added to the reference script

This isn't a use-able script but you should get an idea how to add your drones to the reference script.

All you really need to do is determine the drones and set their damage.

Have fun!

Share this post


Link to post
Share on other sites

Hey Wogz thanks for taking time out of your day. Quick question is the code you provided be the entire script once the drone names are added or does it need to be added to the original script i provided?

Sorry to ask I am not that good at coding but trying to figure it out.

 

Any insight or  appreciated

 

Ant

Share this post


Link to post
Share on other sites

Oh. On second thought it's even easier,

_Vehicles = nearestObjects [(getpos _AOE), ["Car", "drone"], 150];

except I can't determine if "drone" is the correct name.

Share this post


Link to post
Share on other sites
42 minutes ago, wogz187 said:

I can't determine if "drone" is the correct name.

I think it's "UAV"

  • Like 1

Share this post


Link to post
Share on other sites

Sorry for the typo's earlier now i am way lost from your last post?

I have not been able to find the demining drone class name.... i come up with the backpack in which you assemble the drone from so not sure.

I know the class names for the regular drones i believe they are  ["B_UAV_01_F", "I_UAV_01_F","O_UAV_01_F"]

 

I guess if we could make it work for one of the regular drones then adding the class name later would be simple.

 

Still not sure on your code reference and how that goes together... I am an extreme noob to coding and dont know all the snytax.

 

Ant

Share this post


Link to post
Share on other sites

Also rather than setDamage maybe you should set fuel to 0. The drones will crash or fall down rather than explode.

  • Like 1

Share this post


Link to post
Share on other sites

Hey guys still lost here H had a good idea about draining the fuel. I am still not sure how the parts of code tie together.

 

Ant

Share this post


Link to post
Share on other sites

What i have now is that does not work ...when i try in multiplayer...not sure if it is triggered from the main mission init.

emp.sqf

 

_AOE = _this select 0; 
 _Drones =  nearestObjects [_AOE , ["B_UAV_01_F", "I_UAV_01_F","O_UAV_01_F"], 150]; 
 _DamageOFF = 0.95; 
 _DamageON = 0.00; 
 _Vehicles = nearestObjects [(getpos _AOE), ["Car", "UAV"], 150]; 

 _CountLights = count _Lights; 
 (_Lights select 0) say3D "electricity_loop"; 
 sleep (floor(random 3) +2); 

 for "_i" from 0 to _CountLights do //this will run 1 extra time
 //replace 0 with 1 or _CountLights with (_CountLights - 1)
 { 
if (getDammage (_Lights select _i) < 0.90) then 
   { 
       (_Lights select _i) setDamage _DamageOFF; 
       sleep 0.1; 
       (_Lights select _i) setDamage _DamageON; 
       sleep 0.1; 
       (_Lights select _i) setDamage _DamageOFF; 
       sleep 0.1; 
   }; 
 }; 
   {  
       if (isEngineOn _x) then {_x setHit ["motor", 1]} 
   } foreach _Vehicles;

 

main mission init.sqf

 

player addEventHandler ["Fired", 
 { 
 if (_this select 5 == "B_IR_Grenade")  
  then { 
   _this spawn { 
                _bullet = _this select 6; 
                _newpos = getPosATL _bullet; 
                while {(_newpos select 2) > .1}  
                do { 
                    _newpos = getPos _bullet; 
                    sleep 0.1; 
                    }; 
                      [_bullet] execVM "addons\scripts\emp.sqf"; 
                }; 
        }; 
 }]; 

 

Any Help Appreciated 

Ant

Share this post


Link to post
Share on other sites
32 minutes ago, Antman2o1o said:

B_IR_Grenade

Use B_IRStrobe instead 

  • Like 1

Share this post


Link to post
Share on other sites

H that did not work either its like the script doesnt run not sure if it should be triggered from the main mission init? 

Share this post


Link to post
Share on other sites

If I were you I would test bit by bit. For example : does the eh fire? Add a systemChat in there to check. Are the drones defected  etc. Also check localities for the commands you use.

Share this post


Link to post
Share on other sites

Also from toying with ER grenades I can tell you this: the strobe is deleted when created when it's daytime. Try at night!

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
Sign in to follow this  

×