Jump to content
stesniper79

It's even possible to meke some kind of electric generator???

Recommended Posts

Hi to everyone.

I'm editing a stealth mission to my team, and i want to know if it's even possible to create a kind of electric generator.

This generator should turn off all the light in an area when it's detroyed or turned off itself with a voice in the scroll menu.

Do anyone know ho to do that?

Thank you for answer :satisfied:

 

Share this post


Link to post
Share on other sites

You can have all the lights on and via a script have them turned off. Do this by adding an addAction to the generator

Share this post


Link to post
Share on other sites

hello, unpretentious, look at the link in my signature, it might interest you

Share this post


Link to post
Share on other sites
12 hours ago, DÄZ said:

hello, unpretentious, look at the link in my signature, it might interest you

Still ACE dependent?

 

 

If you need a simple script, without dependency and working for switching off even the runway/taxiways lights:

 

place a diesel ground power unit (or an object like that),

In init field:

 

this call {
  _radiusLights = 3000;
  _lights = nearestObjects [ _this,["Lamps_base_F","PowerLines_base_F","PowerLines_Small_base_F"],_radiusLights];
   _lamps =
          ("_x == (configFile >> 'CfgVehicles' >> 'Land_Runway_PAPI') or
             (inheritsFrom _x) == (configFile >> 'CfgVehicles' >> 'Land_Runway_PAPI')
             or _x == (configFile >> 'CfgVehicles' >> 'Land_NavigLight')
             or (inheritsFrom _x) == (configFile >> 'CfgVehicles' >> 'Land_NavigLight')
             or (inheritsFrom (inheritsFrom _x)) == (configFile >> 'CfgVehicles' >> 'Land_NavigLight')" configClasses (configFile >> "CfgVehicles")) apply {tolower(getText (_x >> "model")splitString "\" joinString "\")};
  _lampouz = (nearestTerrainObjects [_this,[],_radiusLights]) select {((getModelInfo _x) select 1) in _lamps};
  _this addAction ["switch off lights",{
        params ["_gene","_caller","_id","_lux"];
        private _geneMenu = (_gene actionParams _id) select 0;
        if (_geneMenu isEqualTo "switch off lights") then {
          _geneMenu = "switch on lights";
          {
            [_x,false] call BIS_fnc_switchLamp;
            false;
          } count (_lux select 0);
          {_x hideObjectGlobal true} forEach (_lux select 1);
        } else {
           _geneMenu = "switch off lights";
          {
            [_x,true] call BIS_fnc_switchLamp;
            false;
          } count (_lux select 0);
          {_x hideObjectGlobal false} forEach (_lux select 1);
        };
        _gene setUserActionText [_id,_geneMenu];
      },[_lights,_lampouz],0.8,false,true,"", "!(_target getvariable ['destroyed',false])"];
  _this addEventHandler ["hit", {
    params ["_gene"];
    if (damage _gene > 0.2) then {
      _gene setVariable ["destroyed",true];
      _gene setDamage 1;
      _radiusLights = 3000;
      _lights = nearestObjects [ _gene,["Lamps_base_F","PowerLines_base_F","PowerLines_Small_base_F"],_radiusLights];
      _lamps =
          ("_x == (configFile >> 'CfgVehicles' >> 'Land_Runway_PAPI') or
             (inheritsFrom _x) == (configFile >> 'CfgVehicles' >> 'Land_Runway_PAPI')
             or _x == (configFile >> 'CfgVehicles' >> 'Land_NavigLight')  
             or (inheritsFrom _x) == (configFile >> 'CfgVehicles' >> 'Land_NavigLight')
             or (inheritsFrom (inheritsFrom _x)) == (configFile >> 'CfgVehicles' >> 'Land_NavigLight')" configClasses (configFile >> "CfgVehicles")) apply {tolower(getText (_x >> "model")splitString "\" joinString "\")};
      _lampouz = (nearestTerrainObjects [_gene,[],_radiusLights]) select {((getModelInfo _x) select 1) in _lamps};
      {
        [_x,false] call BIS_fnc_switchLamp;
        false;
      } count _lights;
      {_x hideObjectGlobal true} forEach _lampouz;
      _gene removeEventHandler ["hit",_thisEventHandler]}
    }];
  };

 

This script will add an action menu (switch on /off ) on the generator,

NB: change radius (_radiusLights) for your setting , both at start and inside event handler (EH),

You can also change the amount of damage for destroying the object (in EH, here is set to 0.2. So, when the damage reaches 0.2, the generator is destroyed and you are in the dark.

 

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, pierremgi said:

Still ACE dependent?

 

no, here is the vanilla version here

  • Like 1

Share this post


Link to post
Share on other sites

If you wanted to add a voice / sound to it like "SYSTEM POWER FAILURE!" you can implement sound files with say3D which would add to the immersion. Also, there is a module within the editor which lets you name some map objects which may help you.

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

×