Jump to content
Sign in to follow this  
fuzi8n

Trying to get this EMP script to work differently! [Need Help]

Recommended Posts

Trying to get this script to work differently. It currently shuts off all of the lights only when you throw a blufor IR grenade. I'd like it to be so I can activate the script via a radio trigger or even better, an object like the laptop. Any help would be greatly appreciated. The script is currently activated through the players init. I just want it so I don't have to throw an IR grenade, just activate a trigger or activate an object.

_AOE = _this select 0; 

  _Lights =  nearestObjects [_AOE , ["Lamps_Base_F", "PowerLines_base_F","PowerLines_Small_base_F","PowerLines_Wires_base_F","Land_PowerPoleWooden_F"], 500]; 

  _DamageOFF = 0.95; 

  _DamageON = 0.00; 

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

  

  _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;

Share this post


Link to post
Share on other sites

I don't see how that wont work from a radio trigger as is.

 

How is it called? The only thing I can see passed to it is the centre position of the radius you want the lights to go out.

 

Stick this in the on act of the radio trigger

 

null = [player] execVM "emp.sqf"

Share this post


Link to post
Share on other sites

I don't see how that wont work from a radio trigger as is.

 

How is it called? The only thing I can see passed to it is the centre position of the radius you want the lights to go out.

 

Stick this in the on act of the radio trigger

 

null = [player] execVM "emp.sqf"

It won't work because I need to throw an IR grenade for the EMP to work. I don't want to throw anything, just activate it from a trigger.

Share this post


Link to post
Share on other sites

Ok, copy the code you quoted in the OP and save it in your mission folder and call it emp.sqf.

 

Create a radio trigger and in the onAct part of it type:

null = [player] execVM "emp.sqf"

The part in brackets will be where you want the centre of the emp blast to be. At the moment it will have to be an object like the player or named object like a satellite phone called blastCentre for example.

null = [blastCentre] execVM "emp.sqf"
  • Like 1

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  

×