/* File: fn_copLights.sqf Author: mindstorm, modified by Adanteh Link: http://forums.bistudio.com/showthread.php?157474-Offroad-Police-sirens-lights-and-underglow Description: Adds the light effect to cop vehicles. */ params [ ["_vehicle", objNull, [objNull]], ["_lightTime", 0.22, [0]] ]; if (isNil "_vehicle" || {isNull _vehicle || {!(_vehicle getVariable "lights")}}) exitWith {}; private _lightBlue = [20, 0.1, 0.1]; private _lightBlue = [0.1, 0.1, 20]; private _lightLeft = "#lightpoint" createVehicleLocal getPos _vehicle; sleep 0.2; _lightLeft setLightColor _lightBlue; _lightLeft setLightBrightness 0.2; _lightLeft setLightAmbient [0.1,0.1,1]; private _offset = switch (typeOf _vehicle) do { case "C_Offroad_01_Blue_F": { [-0.37, 0.0, 0.56]; }; case "B_MRAP_01_F": { [-0.37, -1.9, 0.7]; }; case "C_SUV_01_F": { [-0.37,-1.2,0.42]; }; case "C_Hatchback_01_sport_F": { [-0.35,-0.2,0.25]; }; case "C_Hatchback_01_F": { [-0.35,-0.2,0.25]; }; case "I_MRAP_03_F": { [-0.37, 0.0, 0.50]; }; case "B_CTRG_LSV_01_light_F": { [-0.2, 2.3, 0.975]; }; case "B_GEN_Van_02_transport_F": { [-0.5, 1.6, 1.45]; }; case "B_GEN_Van_02_vehicle_F": { [-0.5, 1.6, 1.45]; }; default { [-1]; }; }; if (_offset isEqualTo [-1]) exitWith { diag_log format ["Vehicle emergency lights not set for: %1",_vehicle]; hint localize "STR_NOTF_ELSNotSet"; }; _lightLeft lightAttachObject [_vehicle, _offset]; _lightLeft setLightAttenuation [0.181, 0, 1000, 130]; _lightLeft setLightIntensity 10; _lightLeft setLightFlareSize 0.38; _lightLeft setLightFlareMaxDistance 150; _lightLeft setLightUseFlare true; private _lightRight = "#lightpoint" createVehicleLocal getPos _vehicle; sleep 0.2; _lightRight setLightColor _lightBlue; _lightRight setLightBrightness 0.2; _lightRight setLightAmbient [0.1,0.1,1]; _offset = switch (typeOf _vehicle) do { case "C_Offroad_01_Blue_F": { [0.37, 0.0, 0.56]; }; case "B_MRAP_01_F": { [0.37, -1.9, 0.7]; }; case "C_SUV_01_F": { [0.37,-1.2,0.42]; }; case "C_Hatchback_01_sport_F": { [0.35,-0.2,0.25]; }; case "C_Hatchback_01_F": { [0.35,-0.2,0.25]; }; case "I_MRAP_03_F": { [0.37, 0.0, 0.50]; }; case "B_CTRG_LSV_01_light_F": { [0.2, 2.3, 0.975]; }; case "B_GEN_Van_02_transport_F": { [0.5, 1.6, 1.45]; }; case "B_GEN_Van_02_vehicle_F": { [0.5, 1.6, 1.45]; }; }; _lightRight lightAttachObject [_vehicle, _offset]; _lightRight setLightAttenuation [0.181, 0, 1000, 130]; _lightRight setLightIntensity 10; _lightRight setLightFlareSize 0.38; _lightRight setLightFlareMaxDistance 150; _lightRight setLightUseFlare true; _lightLeft setLightDayLight true; _lightRight setLightDayLight true; private _leftBlue = true; while {alive _vehicle} do { if !(_vehicle getVariable "lights") exitWith {}; if (_leftBlue) then { _lightRight setLightBrightness 0.0; sleep 0.05; _lightLeft setLightBrightness 50; } else { _lightLeft setLightBrightness 0.0; sleep 0.05; _lightRight setLightBrightness 50; }; _leftBlue = !_leftBlue; sleep _lightTime; }; deleteVehicle _lightLeft; deleteVehicle _lightRight; params [ ["_vehicle", objNull, [objNull]], ["_lightTime", 0.22, [0]] ]; if (isNil "_vehicle" || {isNull _vehicle || {!(_vehicle getVariable "lights")}}) exitWith {}; private _lightBlue = [20, 0.1, 0.1]; private _lightBlue = [0.1, 0.1, 20]; private _lightLeft2 = "#lightpoint" createVehicleLocal getPos _vehicle; sleep 0.2; _lightLeft2 setLightColor _lightBlue; _lightLeft2 setLightBrightness 0.2; _lightLeft2 setLightAmbient [0.1,0.1,1]; private _offset2 = switch (typeOf _vehicle) do { case "B_GEN_Van_02_transport_F": { [-0.5, -2.9, 1.45]; }; case "B_GEN_Van_02_vehicle_F": { [-0.5, -2.9, 1.45]; }; default { [-1]; }; }; if (_offset2 isEqualTo [-1]) exitWith { diag_log format ["Vehicle emergency lights not set for: %1",_vehicle]; hint localize "STR_NOTF_ELSNotSet"; }; _lightLeft2 lightAttachObject [_vehicle, _offset2]; _lightLeft2 setLightAttenuation [0.181, 0, 1000, 130]; _lightLeft2 setLightIntensity 10; _lightLeft2 setLightFlareSize 0.38; _lightLeft2 setLightFlareMaxDistance 150; _lightLeft2 setLightUseFlare true; private _lightRight2 = "#lightpoint" createVehicleLocal getPos _vehicle; sleep 0.2; _lightRight2 setLightColor _lightBlue; _lightRight2 setLightBrightness 0.2; _lightRight2 setLightAmbient [0.1,0.1,1]; _offset = switch (typeOf _vehicle) do { case "B_GEN_Van_02_transport_F": { [0.5, -2.9, 1.45]; }; case "B_GEN_Van_02_vehicle_F": { [0.5, -2.9, 1.45]; }; }; _lightRight2 lightAttachObject [_vehicle, _offset2]; _lightRight2 setLightAttenuation [0.181, 0, 1000, 130]; _lightRight2 setLightIntensity 10; _lightRight2 setLightFlareSize 0.38; _lightRight2 setLightFlareMaxDistance 150; _lightRight2 setLightUseFlare true; _lightLeft2 setLightDayLight true; _lightRight2 setLightDayLight true; private _leftBlue = true; while {alive _vehicle} do { if !(_vehicle getVariable "lights") exitWith {}; if (_leftBlue) then { _lightRight2 setLightBrightness 0.0; sleep 0.05; _lightLeft2 setLightBrightness 50; } else { _lightLeft2 setLightBrightness 0.0; sleep 0.05; _lightRight2 setLightBrightness 50; }; _leftBlue = !_leftBlue; sleep _lightTime; }; deleteVehicle _lightLeft2; deleteVehicle _lightRight2;