Jump to content
tankguy67

How to turn on the lights on a helicopter during a night mission?

Recommended Posts

I cannot seem to figure it out, collision lights go on fine but the regular lights or the "searchlight" never go on.

Share this post


Link to post
Share on other sites

Here is a script for the hellcat, could easily be adapted to other airframes.

@pierremgi might be able to help you also.

 

Thanks

Share this post


Link to post
Share on other sites

Yap....@pierremgi is the man..here's a script from him which works very well...

 

Spoiler

Here is my movable searchlight. (SP / MP)

You have to name the helicopter : hellcat.

I have to define a global variable SL1 for the search light. Don't forget to script a SL2 , SL3 for different search lights if you need it.


 

// In initPlayerLocal.sqf (or run that locally when player exists: 0= [] spawn {waitUntil local player};  ...} )
//___________________________________________________________

toggle_SL = 0;
_SL_on = {
  player addAction ["<t color='#11ff11'>S.L. On</t>", {
    params ["_tgt","_caller","_id"];
    private _SLMenu = (_tgt actionParams _id) select 0;
    if (_SLMenu isEqualTo "<t color='#11ff11'>S.L. On</t>") then {
      _SLMenu = "<t color='#ff1111'>S.L. Off</t>";
      _caller action ["SearchlightOn",vehicle _caller];
      missionNamespace setVariable ["SLBright",0.9,true];
      missionNamespace setVariable ["SLAmbient",[2.3, 2.3, 2.55],true];
    } else {
      _SLMenu = "<t color='#11ff11'>S.L. On</t>"; 
      _caller action ["SearchlightOff", vehicle _caller];
      missionNamespace setVariable ["SLBright",0,true];
      missionNamespace setVariable ["SLAmbient",[0,0,0],true];
    };
    (_this select 1) setUserActionText [(_this select 2),_SLMenu];
    },nil,0.8,false,true,"", " _this == (vehicle _this) turretUnit [0] && vehicle _this == hellcat"]
  };
 
  call _SL_on;
  player addEventHandler ["respawn", {call _SL_on}];
};
 
 
// in init.sqf (or run that on all clients)
//________________________________________________

SL1 = "#lightpoint" createVehicleLocal [0,0,0];
SL1 setLightBrightness 0;
SL1 setLightAmbient[0,0,0];
SL1 setLightColor[230, 230, 255];
SL1 setLightUseFlare true;
SL1 setLightFlareSize 100;

addMissionEventHandler ["EachFrame", {
  if (local (hellcat turretUnit [0])) then {
	_ins = lineIntersectsSurfaces [AGLToASL positionCameraToWorld [0,0,5],AGLToASL positionCameraToWorld [0,0,300],hellcat,objNull,true,1,"VIEW","NONE"];
    if (count _ins > 0) then {  
      missionNamespace setVariable ["SLpos",(_ins select 0 select 0),true]
    };
  };
  SL1 setPosASL (missionNamespace getVariable ["SLpos",[0,0,0]]);
  SL1 setLightBrightness  (missionNamespace getVariable ["SLBright",0]);
  SL1 setLightAmbient  (missionNamespace getVariable ["SLAmbient",[0,0,0]]);
}];
 

NOTA : you need to specify : vehicle _this == hellcat (name of helicopter) in the condition of addAction.

 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

No.

Definitely,  lightOff /On actions don't work on Hellcat. You need to use "searchLightOn" / off (on copilot) and "collisionLightOn" / off (on Pilot), then loop that at high rate (sleep 0.1) if you want something useful for all behaviors.

The script mentioned by zagor64bz is something totally different, addAction on player, while gunner, to dramatically improve the search light.

  • Like 2

Share this post


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

 

The script mentioned by zagor64bz is something totally different, addAction on player, while gunner, to dramatically improve the search light.

Yeah..

maybe he's looking for something like this...

https://www.youtube.com/watch?v=ZLGJHO_WZtc

http://steamcommunity.com/sharedfiles/filedetails/?id=779558222

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

×