Jump to content

[TUTORIAL] Customization of Lights! (COP & EMS)


Scalings // Mr. Whale
 Share

Recommended Posts

Hi, This is my first actual Tutorial let me know if I worded it correctly!
 

In this tutorial, I will show you how to get different colour lights etc on your Cop/EMS Vehicles!

The file we'll be editing can be found here:

Cop: Altis_Life.Altis\core\cop

EMS: Altis_Life.Altis\core\medical

Then you should see the file "fn_copLights.sqf" or "fn_medicLights.sqf" . Open them.

To change the colour of the left light go to line 18 and change the "_lightRed"

_lightleft setLightColor _lightRed;

To change the colour of the red light go to line 63 and change the "_lightBlue"

_lightright setLightColor _lightBlue;

Doing the above will allow you to change your lights.

You can change them to the following colours:

  • _light [Pink] (I think)
  • _lightBlue [Blue]
  • _lightGreen [Green]
  • _lightWhite [White]
  • _lightYellow [Yellow]

 

In addition to this, it is possible to change the brightness, how far you can see the lights from etc in the same file.

For instance, if you want to change how bright your left light is, increase '0.2' to a higher number like '0.5'.

_lightleft setLightBrightness 0.2;

Have fun changing your lights & I hope this helped!

 

Let me know if you need further assistance!

- Scalings

Edited by Scalings // Mr. Whale
Link to comment
Share on other sites

  • 4 weeks later...

How would I add extra vehicles say that don't currently have lights on them for the ems , police 

would i just add it to this ?

{
    case "C_Offroad_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.37, 0.0, 0.56]];
    };

    case "B_MRAP_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.37, -1.9, 0.7]];
    };

    case "C_SUV_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.37,-1.2,0.42]];
    };

    case "C_Hatchback_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.35,-0.2,0.25]];
    };
    
    case "C_Hatchback_01_sport_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.35,-0.2,0.25]];
    };

    case "B_Heli_Light_01_F":
    {
        _lightleft lightAttachObject [_vehicle,[-0.37, 0.0, -0.80]];
    };

    case "B_Heli_Transport_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.5, 0.0, 0.81]];
     };
};

 

Link to comment
Share on other sites

Yes add the class name to your case statement to add an additional vehicle. You'll need to figure out the positions but it won't take too long.

Also worth noting, you can't just change the variable from _lightBlue to _lightPink without first creating another variable above it called _lightPink and assigning it an RGB color.

Link to comment
Share on other sites

5 hours ago, iamepic161 said:

How would I add extra vehicles say that don't currently have lights on them for the ems , police 

would i just add it to this ?

{
    case "C_Offroad_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.37, 0.0, 0.56]];
    };

    case "B_MRAP_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.37, -1.9, 0.7]];
    };

    case "C_SUV_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.37,-1.2,0.42]];
    };

    case "C_Hatchback_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.35,-0.2,0.25]];
    };
    
    case "C_Hatchback_01_sport_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.35,-0.2,0.25]];
    };

    case "B_Heli_Light_01_F":
    {
        _lightleft lightAttachObject [_vehicle,[-0.37, 0.0, -0.80]];
    };

    case "B_Heli_Transport_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.5, 0.0, 0.81]];
     };
};

 

4

Hi,

switch (typeOf _vehicle) do
{
    case "C_Offroad_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.37, 0.0, 0.56]];
    };

You change your case, in this instance, "C_Offroad_01_F", it's your vehicle's class name. The lights position will vary but can be edited by changing the values. In this case, you would be changing [-0.37, 0.0, 0.56].

Edited by Scalings // Mr. Whale
Link to comment
Share on other sites

  • 3 weeks later...
36 minutes ago, Deadlesszombie said:

Find where _lightleft is defined and make your own for _lightright? And use that offset tool to guide you......?????? Cmon man think about this lol. It's called lightLEFT

You think i´m Stubid?

If you could read right,, i want du have light in the front siren and the back siren.... 

Just think

  • Sad 1
Link to comment
Share on other sites

the standard script is only able to handle ONE on the left and right side... if you want to have two you need to re-do the whole script

 

if (vehicle is vehicle where you want to have 2 lights on every side) then {blablabla...};

then you can add 2 lightpoints on every side...

Link to comment
Share on other sites

  • 4 months later...
  • 2 weeks later...
  • 6 months later...

 

49 minutes ago, ToxicFFS said:

hello i am trying to move  the cop lights to new positions in front and the back  of the SUV but i dont know the positions on the Lamps market on the pictures can someone tell me please???

Just use trial and error or a mod/mission that helps, such as the one recommended by @Deadlesszombie:

On 9/23/2017 at 8:42 AM, Deadlesszombie said:

You could use this to help you get that relative offset

http://www.armaholic.com/page.php?id=31072

 

Link to comment
Share on other sites

now i cant get the light on the back of the SUV to work  here is my fn_copLight.sqf file        what is wrong???

 

/*
    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, specifically the offroad.
*/
Private ["_vehicle","_lightBlue","_lightBlue","_lightleft","_lightright","_lightleft1","_lightright1","_leftBlue"];
_vehicle = _this select 0;

if (isNil "_vehicle" || isNull _vehicle || !(_vehicle getVariable "lights")) exitWith {};
_lightBlue = [20, 0.1, 0.1];
_lightBlue = [0.1, 0.1, 20];

_lightleft = "#lightpoint" createVehicle getPos _vehicle;
sleep 0.2;
_lightleft setLightColor _lightBlue;
_lightleft setLightBrightness 5.0;
_lightleft setLightAmbient [0.1,0.1,1];

_lightleft1 = "#lightpoint" createVehicle getPos _vehicle;
sleep 0.2;
_lightleft1 setLightColor _lightBlue;
_lightleft1 setLightBrightness 5.0;
_lightleft1 setLightAmbient [0.1,0.1,1];

switch (typeOf _vehicle) do
{
    case "C_Offroad_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.37, 0.0, 0.56]];
    };

    case "B_MRAP_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.37, -1.9, 0.7]];
    };

    case "C_SUV_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.4,2.299,-0.473]];
        _lightleft1 lightAttachObject [_vehicle, [0.5,-2.901,-0.173]];
    };

    case "C_Hatchback_01_sport_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.35,-0.2,0.25]];
    };

    case "B_Heli_Light_01_F":
    {
        _lightleft lightAttachObject [_vehicle,[-0.37, 0.0, -0.80]];
    };

    case "B_Heli_Transport_01_F":
    {
        _lightleft lightAttachObject [_vehicle, [-0.5, 0.0, 0.81]];
     };
};

_lightleft setLightAttenuation [0.181, 0, 1000, 130];
_lightleft setLightIntensity 10;
_lightleft setLightFlareSize 0.38;
_lightleft setLightFlareMaxDistance 150;
_lightleft setLightUseFlare true;

_lightleft1 setLightAttenuation [0.181, 0, 1000, 130];
_lightleft1 setLightIntensity 10;
_lightleft1 setLightFlareSize 0.38;
_lightleft1 setLightFlareMaxDistance 150;
_lightleft1 setLightUseFlare true;

_lightright = "#lightpoint" createVehicle getPos _vehicle;
sleep 0.2;
_lightright setLightColor _lightBlue;
_lightright setLightBrightness 5.0;
_lightright setLightAmbient [0.1,0.1,1];

_lightright1 = "#lightpoint" createVehicle getPos _vehicle;
sleep 0.2;
_lightright1 setLightColor _lightBlue;
_lightright1 setLightBrightness 5.0;
_lightright1 setLightAmbient [0.1,0.1,1];

switch (typeOf _vehicle) do
{
    case "C_Offroad_01_F":
    {
        _lightright lightAttachObject [_vehicle, [0.37, 0.0, 0.56]];
    };

    case "B_MRAP_01_F":
    {
        _lightright lightAttachObject [_vehicle, [0.37, -1.9, 0.7]];
    };

    case "C_SUV_01_F":
    {
        _lightright lightAttachObject [_vehicle, [0.4,2.299,-0.473]];
        _lightright1 lightAttachObject [_vehicle, [-0.5,-2.901,-0.173]];
    };

    case "C_Hatchback_01_sport_F":
    {
        _lightright lightAttachObject [_vehicle, [0.35,-0.2,0.25]];
    };

    case "B_Heli_Light_01_F":
    {
        _lightright lightAttachObject [_vehicle,[0.37, 0.0, -0.80]];
    };

    case "B_Heli_Transport_01_F":
    {
        _lightright lightAttachObject [_vehicle, [0.5, 0.0, 0.81]];
     };
};

_lightright setLightAttenuation [0.181, 0, 1000, 130];
_lightright setLightIntensity 10;
_lightright setLightFlareSize 0.38;
_lightright setLightFlareMaxDistance 150;
_lightright setLightUseFlare true;

_lightright1 setLightAttenuation [0.181, 0, 1000, 130];
_lightright1 setLightIntensity 10;
_lightright1 setLightFlareSize 0.38;
_lightright1 setLightFlareMaxDistance 150;
_lightright1 setLightUseFlare true;

//ARE YOU ALL HAPPY?!?!?!?!?!?!?!?!?%#[email protected]?TGD?BN?ZDHBFD?GA
_lightleft setLightDayLight true;
_lightleft1 setLightDayLight true;
_lightright setLightDayLight true;
_lightright1 setLightDayLight true;

_leftRed = true;
while{ (alive _vehicle)} do
{
    if (!(_vehicle getVariable "lights")) exitWith {};
    if (_leftRed) then
    {
        _leftRed = false;
        _lightright setLightBrightness 0.0;
        sleep 0.05;
        _lightleft setLightBrightness 6;
    }
        else
    {
        _leftRed = true;
        _lightleft setLightBrightness 0.0;
        sleep 0.05;
        _lightright setLightBrightness 6;
    };
    sleep (_this select 1);
};
deleteVehicle _lightleft;
deleteVehicle _lightright;

Link to comment
Share on other sites

7 minutes ago, Deadlesszombie said:

no, you are just adding pointless brackets, man, please read your code "if (_leftRed) then { x y z happens, else xyz happens, you are just adding pointless brackets, add the _lightright1 and _lightleft1 where you see _lightRed and _Lightleft, trial and error with that

you mean Like this?  im trying my bests to understand

f55b6a4844b407d2cc28efc55af75415.png

Link to comment
Share on other sites

  • 1 month later...

hello guys I have a problem I find the doctors who only have the blinkers in the offroad while on the other vehicles no, so I copied the same classes of police vehicles as they are equal and added classes to the fn_mediclights file and fn_sirenlight file I added the affected vehicles but it does not work!
 

Link to comment
Share on other sites

27 minutes ago, Federick90 said:

hello guys I have a problem I find the doctors who only have the blinkers in the offroad while on the other vehicles no, so I copied the same classes of police vehicles as they are equal and added classes to the fn_mediclights file and fn_sirenlight file I added the affected vehicles but it does not work!
 

There is plenty you need to edit for this:

The vehicle needs to be in your keyhandler: https://github.com/AsYetUntitled/Framework/blob/master/Altis_Life.Altis/core/functions/fn_keyHandler.sqf#L203

It needs to be in the array for medicSirensLights: https://github.com/AsYetUntitled/Framework/blob/master/Altis_Life.Altis/core/medical/fn_medicSirenLights.sqf#L14

Multiple switches need your vehicle in medicLights: https://github.com/AsYetUntitled/Framework/blob/master/Altis_Life.Altis/core/medical/fn_medicLights.sqf#L26

Link to comment
Share on other sites

15 minuti fa, ha detto che:

where am I wrong?
 

Questo è un hundler chiave

 // L Key?
    caso 38: {
        // Se la poliziotta controlla se le luci sono accese.
        se (_shift && playerSide in [west, independent]) poi {
            if (! (isNull objectParent player) && (typeOf vehicle player) in ["C_Offroad_01_F", "B_MRAP_01_F", "C_SUV_01_F", "C_Hatchback_01_sport_F", "B_Heli_Light_01_F", "B_Heli_Transport_01_F"]) poi {
                if (! IsNil {vehicle player getVariable "lights"}) poi {
                    if (playerSide isEqualTo west) quindi {
                        [vehicle player] chiama life_fnc_sirenLights;
                    } else {
                        [vehicle player] chiama life_fnc_medicSirenLights;
                    };

                };
            };
        };

 

Questo è medico light.sqf

/ *
    File: fn_medicLights.sqf
    Autore: mindstorm, modificato da Adanteh
    Link: http://forums.bistudio.com/showthread.php?157474-Offroad-Police-sirens-lights-and-underglow

    Descrizione:
    aggiunge l'effetto luce ai veicoli della polizia, in particolare all'offroad.
* /

params [
    ["_vehicle", objNull, [objNull]],
    ["_lightTime", 0.22, [0]]
];

if (isNil "_vehicle" || {isNull _vehicle || {! (_ veicolo getVariable "lights")}}) exitWith {};

private _lightRed = [0.1, 0.1, 20];
private _lightBlue = [0.1, 0.1, 20];

_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_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 "B_Heli_Light_01_F": {
        [-0.37, 0.0, -0.80];
    };
    case "B_Heli_Transport_01_F": {
        [-0.5, 0.0, 0.81];
    };
};

_lightLeft setLightAttenuation [0.181, 0, 1000, 130];
_lightLeft setLightIntensity 10;
_lightLeft setLightFlareSize 0.38;
_lightLeft setLightFlareMaxDistance 150;
_lightLeft setLightUseFlare true;

_lightRight = "#lightpoint" createVehicleLocal getPos _vehicle;
sleep 0.2;
_lightRight setLightColor _lightBlue;
_lightRight setLightBrightness 0.2;
_lightRight setLightAmbient [0.1,0.1,1];

private _offset = switch (typeOf _vehicle) do {
    case "C_Offroad_01_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 "B_Heli_Light_01_F": {
        [-0.37, 0.0, -0.80];
    };
    case "B_Heli_Transport_01_F": {
        [-0.5, 0.0, 0.81];
    };
};

_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 _leftRed = true;
while {alive _vehicle} do {
    if !(_vehicle getVariable "lights") exitWith {};
    if (_leftRed) then {
        _lightRight setLightBrightness 0.0;
        sleep 0.05;
        _lightLeft setLightBrightness 6;
    } else {
        _lightLeft setLightBrightness 0.0;
        sleep 0.05;
        _lightRight setLightBrightness 6;
    };
    _leftRed = !_leftRed;
    sleep _lightTime;
};

deleteVehicle _lightLeft;
deleteVehicle _lightRight;

 

 

 

and sirenlights

 

#include "..\..\script_macros.hpp"
/*
    File: fn_sirenLights.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Lets play a game! Can you guess what it does? I have faith in you, if you can't
    then you have failed me and therefor I lose all faith in humanity.. No pressure.
*/
params [
    ["_vehicle",objNull,[objNull]]
];
if (isNull _vehicle) exitWith {}; //Bad entry!
if !(typeOf _vehicle in ["C_Offroad_01_F","B_MRAP_01_F","C_SUV_01_F","C_Hatchback_01_sport_F","B_Heli_Light_01_F","B_Heli_Transport_01_F"]) exitWith {}; //Last chance check to prevent something from defying humanity and creating a monster.

private _trueorfalse = _vehicle getVariable ["lights",false];

if (_trueorfalse) then {
    _vehicle setVariable ["lights", false, true];
    if! (isNil {(_vehicle getVariable "lightsJIP")}) then {
        private _jip = _vehicle getVariable "lightsJIP";
        _vehicle setVariable ["lightsJIP", nil, true];
        remoteExec ["", _jip]; // rimuovi dalla coda JIP
    };
} else {
    _vehicle setVariable ["lights", true, true];
    private _jip = [_vehicle, 0.22] remoteExec ["life_fnc_medicLights", RCLIENT, true];
    _vehicle setVariable ["lightsJIP", _ jip, true];
};

 

 

Edited by Federick90
Link to comment
Share on other sites

  • 1 year later...

My medic lights are like this with numbers.

private _lightRed = [20, 0.1, 0.1]; <-- These are both red
private _lightBlue = [20, 0.1, 0.1]; <--
 


I want to make yellow ones for my repair vehicles and code looks like this and they don't work.


private _lightYellow = [20, 0.1, 0.1]; <--do these numbers need to be changed to something else?
private _lightYellow = [0.1, 0.1, 20]; <--

Link to comment
Share on other sites

Hello Guys.

Here is my solution for the customizable cop lights. You can define the light for each vehicle and each side. Just need to modify the RGB code.

fn_coplights.sqf
 

Spoiler

 

/*
    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 {};

//Format: [[left position], [right position]], [left color], [right color]
(switch (typeOf _vehicle) do {
    case "C_Offroad_01_F": {
        [[-0.37, 0.0, 0.56], [0.37, 0.0, 0.56], [20, 0.1, 0.1], [0.1, 0.1, 20]];
    };
    case "B_MRAP_01_F": {
        [[-0.37, -1.9, 0.7], [0.37, -1.9, 0.7], [0.1, 0.1, 20], [0.1, 0.1, 20]];
    };
    case "C_Van_01_transport_F": {
        [[-0.37,-1.2,0.7], [0.37,-1.2,0.7], [20, 20, 0.1], [20, 20, 0.1]];
    };
    case "C_SUV_01_F": {
        [[-0.37,-1.2,0.42], [0.37,-1.2,0.42], [20, 20, 0.1], [20, 20, 0.1]];
    };
    case "C_Hatchback_01_sport_F": {
        [[-0.35,-0.2,0.25], [0.35,-0.2,0.25], [20, 0.1, 0.1], [0.1, 0.1, 20]];
    };
    case "B_Heli_Light_01_F": {
        [[-0.37, 0.0, -0.80], [0.37, 0.0, -0.80], [20, 0.1, 0.1], [0.1, 0.1, 20]];
    };
    case "B_Heli_Transport_01_F": {
        [[-0.5, 0.0, 0.81], [0.5, 0.0, 0.81], [20, 0.1, 0.1], [0.1, 0.1, 20]];
    };
    default {
        [[-1], [-1], [0.1, 0.1, 0.1], [0.1, 0.1, 0.1]];
    };
}) params ["_leftOffset", "_rightOffset", "_lightRed", "_lightBlue"];

if (_leftOffset isEqualTo [-1]) exitWith {
    diag_log format ["Vehicle emergency lights not set for: %1", _vehicle];
    hint localize "STR_NOTF_ELSNotSet";
};

private _lightLeft = "#lightpoint" createVehicleLocal getPos _vehicle;
sleep 0.2;
_lightLeft setLightColor _lightRed;
_lightLeft setLightBrightness 0.2;
_lightLeft setLightAmbient [0.1,0.1,1];

_lightLeft lightAttachObject [_vehicle, _leftOffset];

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

_lightRight lightAttachObject [_vehicle, _rightOffset];

_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 _leftcheck = true;
while {alive _vehicle} do {  
    if !(_vehicle getVariable "lights") exitWith {};
    if (_leftcheck) then {
        _lightRight setLightBrightness 0.0;
        sleep 0.05;
        _lightLeft setLightBrightness 6;
    } else {
        _lightLeft setLightBrightness 0.0;
        sleep 0.05;
        _lightRight setLightBrightness 6;
    };
    _leftcheck = !_leftcheck;
    sleep _lightTime;  
};

deleteVehicle _lightLeft;
deleteVehicle _lightRight;

 

But i have a little problem.

case "C_Van_01_transport_F": {
        [[-0.37,-1.2,0.7], [0.37,-1.2,0.7], [20, 20, 0.1], [20, 20, 0.1]];

Added the boxer in cop shop

Added the boxer in sirenlight.sqf 

Spoiler

if !(typeOf _vehicle in ["C_Offroad_01_F","C_Van_01_transport_F","B_MRAP_01_F","C_SUV_01_F","C_Hatchback_01_sport_F","B_Heli_Light_01_F","B_Heli_Transport_01_F"]) exitWith {}; //Last chance check to prevent something from defying humanity and creating a monster.

Added the boxer with yellow lights.

AAAAnd not working for me. The boxer didnt have any lights. Other cars have the defined lights. Pickup(red, blue), Mrap(blue,blue), Hatchback(yellow, yellow). So everything looks fine.

Any suggestion? Thank a lot if you have.

G.

Edited by GoTCHa
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.