Jump to content

Recommended Posts

Does anyone know if the spotlight on the Hellcat is working? I just tried it and I can see the spotlight moving around but using the option "Searchlight on" there is no light that comes on. I'm looking to make a search mission and this is crucial to that. I've downloaded a few scripts that "mimic" a searchlight but I'm not a fan of how any of them work and most vanilla helicopters spotlights shine directly down and are not visible from the cockpit (my server is strictly first person).

 

I found the bug reports on the Arma tracker and one comment says that they are broken but this was from 1+ years ago. Seems like it would be a simple fix if it is broken...

https://feedback.bistudio.com/T68596

Share this post


Link to post
Share on other sites

Last time I tried, it worked like this:

- it has to be night

- you have to be on the co pilot seat

- Press "L" or use the action

- searchlight faces, where you are looking at with the "spotting view"

Share this post


Link to post
Share on other sites

What @bloodwyn1756 said. Also:

The searchlight on the hellcat has a limited range of around 40-50m.

Every bicycle light is stronger.

 

Whoever tested this before implementation didn't put in too much effort I assume.

 

Cheers

  • Like 2
  • Haha 1

Share this post


Link to post
Share on other sites

Ahh yeah, I was trying it during the day but it is static like some of the comments in the bug tracker said. What a shame would be so cool if this actually worked like it should.

 

Also thanks pierremgi, that might work for what I'm trying to do.

Share this post


Link to post
Share on other sites

Hey guys,

 

the searchilght can sadly not be moved. I have been trying to find a solution to this for months but no luck whatsoever. BI knows about the issue but they continue to ignore it for some reason. And pierremgi's post looks great but you can still not move the searchlight. Also it is open from the start and you cannot even close it. I do not understand why not a single script has been made to fix this issue. One that will just spawn a cool light source like in pierremgi's solution but that would also be movable and working.

Share this post


Link to post
Share on other sites

You can script an addaction for on/off, then move the spot light with cursortarget while you are gunner. The main difficulty is to sync for all players in MP

Share this post


Link to post
Share on other sites

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;
MGI_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 MGI_SL_on;
  player addEventHandler ["respawn", {call MGI_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 2

Share this post


Link to post
Share on other sites

Here is an SP/MP script for movable searchlights on all vehicles with turret. Vehicle spawn/respawn compatible.

 

You can change vehicles for any array of vehicles you want.

This one is "addAction on vehicle" oriented.  The difficulty is to "kill" the light when vehicle is destroyed. I added a loop for that. Enough.

 

In init.sqf:

 

0 = [] spawn {

  _check = "
    if (local (_target turretUnit [0])) then {
      private _ins = lineIntersectsSurfaces [AGLToASL positionCameraToWorld [0,0,5],AGLToASL positionCameraToWorld [0,0,300],_target,objNull,true,1,'FIRE','NONE'];
      if (count _ins > 0) then {
        _target setVariable ['SLpos',(_ins select 0 select 0),true];
      } else {
        _target setVariable ['SLpos',AGLToASL positionCameraToWorld [0,0,300],true]
      };
    };
    (missionNamespace getVariable 'SL'+str(_target)) setPosASL (_target getVariable ['SLpos',[0,0,300]]);      
    (_this == _target turretUnit [0]) && local _this
  ";

  while {true} do {
    {
      _x setVariable ["spotted",true];
      _x addAction ["<t color='#11ff11'>S.L. On</t>", {
        params ["_veh","_gunner","_id","_check"];
        private _SLMenu = (_veh actionParams _id) select 0;
        private _SL = "SL"+str(_veh);
        if (_SLMenu isEqualTo "<t color='#11ff11'>S.L. On</t>") then {
          _SLMenu = "<t color='#ff1111'>S.L. Off</t>";
          _gunner action ["SearchlightOn",_veh];
          missionNamespace setVariable [_SL,"#lightpoint" createVehicle [0,0,0],true];
          [_SL,{(missionNamespace getVariable _this) setLightBrightness 0.9;
          (missionNamespace getVariable _this) setLightAmbient [2.3, 2.3, 2.55];
          (missionNamespace getVariable _this) setLightColor [230, 230, 255];
          (missionNamespace getVariable _this) setLightUseFlare  true;
          (missionNamespace getVariable _this) setLightAttenuation [3,50,80,50,0,50];
          (missionNamespace getVariable _this) setLightFlareSize 50}] remoteExec ["call",0,_veh];
        } else {
          _SLMenu = "<t color='#11ff11'>S.L. On</t>";
          _gunner action ["SearchlightOff", _veh];
          deleteVehicle (missionNamespace getVariable _SL);
        };
        _veh setUserActionText [_id,_SLMenu];
      },_check,0.8,false,true,"",_check];
    } forEach (vehicles select {!(_x getVariable ["spotted",false]) && {["Turret",[0,1]] in (_x call BIS_fnc_vehicleRoles) or ["Turret",[0]] in (_x call BIS_fnc_vehicleRoles)}});
    
    {
      if (!alive _x) then {_x setVariable ["spotted",false]; removeAllActions _x};
      if (!isNil {missionNamespace getVariable 'SL'+str(_x)} && !alive _x) then {
        deleteVehicle (missionNamespace getVariable 'SL'+str(_x));
        missionNamespace setVariable ['SL'+str(_x),nil,true];
      }
    } forEach (vehicles  select {_x getVariable ["spotted",false]});
    
    sleep 3;
  }
};

 

Share this post


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

Here is an SP/MP script for searchlights on all vehicles with turret. Vehicle spawn/respawn compatible.

 

You can change vehicles for any array of vehicles you want.

This one is "addAction on vehicle" oriented.  The difficulty is to "kill" the light when vehicle is destroyed. I added a loop for that. Enough.

 

In init.sqf:

 


0 = [] spawn {

  _check = "
    if (local (_target turretUnit [0])) then {
      private _ins = lineIntersectsSurfaces [AGLToASL positionCameraToWorld [0,0,5],AGLToASL positionCameraToWorld [0,0,300],_target,objNull,true,1,'FIRE','NONE'];
      if (count _ins > 0) then {
        _target setVariable ['SLpos',(_ins select 0 select 0),true];
      } else {
        _target setVariable ['SLpos',AGLToASL positionCameraToWorld [0,0,300],true]
      };
    };
    (missionNamespace getVariable 'SL'+str(_target)) setPosASL (_target getVariable ['SLpos',[0,0,300]]);      
    (_this == _target turretUnit [0]) && local _this
  ";

  while {true} do {
    {
      _x setVariable ["spotted",true];
      _x addAction ["<t color='#11ff11'>S.L. On</t>", {
        params ["_veh","_gunner","_id","_check"];
        private _SLMenu = (_veh actionParams _id) select 0;
        private _SL = "SL"+str(_veh);
        if (_SLMenu isEqualTo "<t color='#11ff11'>S.L. On</t>") then {
          _SLMenu = "<t color='#ff1111'>S.L. Off</t>";
          _gunner action ["SearchlightOn",_veh];
          missionNamespace setVariable [_SL,"#lightpoint" createVehicle [0,0,0],true];
          [_SL,{(missionNamespace getVariable _this) setLightBrightness 0.9;
          (missionNamespace getVariable _this) setLightAmbient [2.3, 2.3, 2.55];
          (missionNamespace getVariable _this) setLightColor [230, 230, 255];
          (missionNamespace getVariable _this) setLightUseFlare  true;
          (missionNamespace getVariable _this) setLightAttenuation [3,50,80,50,0,50];
          (missionNamespace getVariable _this) setLightFlareSize 50}] remoteExec ["call",0,_veh];
        } else {
          _SLMenu = "<t color='#11ff11'>S.L. On</t>";
          _gunner action ["SearchlightOff", _veh];
          deleteVehicle (missionNamespace getVariable _SL);
        };
        _veh setUserActionText [_id,_SLMenu];
      },_check,0.8,false,true,"",_check];
    } forEach (vehicles select {!(_x getVariable ["spotted",false]) && {["Turret",[0,1]] in (_x call BIS_fnc_vehicleRoles) or ["Turret",[0]] in (_x call BIS_fnc_vehicleRoles)}});
    
    {
      if (!alive _x) then {_x setVariable ["spotted",false]; removeAllActions _x};
      if (!isNil {missionNamespace getVariable 'SL'+str(_x)} && !alive _x) then {
        deleteVehicle (missionNamespace getVariable 'SL'+str(_x));
        missionNamespace setVariable ['SL'+str(_x),nil,true];
      }
    } forEach (vehicles  select {_x getVariable ["spotted",false]});
    
    sleep 3;
  }
};

 

Is this one moveable also?

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

×