Jump to content

[Script] Brighter Nights


Recommended Posts

So an issue I see on a lot of servers is night time is horrible, I found this awhile back and well, it does this:

[Note: the level of brightness you add can be configured, so if it's too bright for you, don't worry.]

Before:

D834F18128741BCB30FE711AD69B5D36A3B1A877

After:

1AE6610AEED63CF9200379A411723912C59C316F

Install Instructions:

Place this code at the bottom of your initPlayerLocal.sqf

[] spawn {
    _adjustLight = {
        CHBN_adjustBrightness = CHBN_adjustBrightness max 0 min 1;
        _brightness = if (CHBN_adjustBrightness > 0) then {200 * abs (1 - (2 ^ CHBN_adjustBrightness))} else {0};
        CHBN_light setLightAttenuation [10e10,(30000 / (_brightness max 10e-10)),4.31918e-005,4.31918e-005];
        CHBN_light setLightAmbient CHBN_adjustColor;
    };
    
    waitUntil {time > 0};
    if (missionNamespace getVariable ["CHBN_running",false]) exitWith {systemChat "CHBN script is running. Addon disabled."};
    CHBN_running = true;
    
    CHBN_adjustBrightness = missionNamespace getVariable ["CHBN_adjustBrightness",1]; // edit the level of brightness here, set to 1, can be 0.1 to however high you want it
    CHBN_adjustColor = missionNamespace getVariable ["CHBN_adjustColor",[0.5,0.7,1]];

    if (!isNil "CHBN_light") then {deleteVehicle CHBN_light};
    CHBN_light = "#lightpoint" createVehicleLocal [0,0,0];
    CHBN_light setLightBrightness 1;
    CHBN_light setLightDayLight false;
    call _adjustLight;

    for "_i" from 0 to 1 step 0 do {
        _adjustBrightness = CHBN_adjustBrightness;
        _adjustColor = CHBN_adjustColor;
        waitUntil {!(_adjustBrightness isEqualTo CHBN_adjustBrightness) || !(_adjustColor isEqualTo CHBN_adjustColor)};
        call _adjustLight;
    };
};

To edit the brightness, change the

["CHBN_adjustBrightness",1];

0.1 to whatever, personally i prefer 0.7

 

  • Like 2
  • Thanks 1
Link to post
Share on other sites
  • 2 weeks later...
  • 10 months later...
On 4/25/2019 at 9:34 AM, Kaiden said:

It does

17:20:19 Error in expression <"from 0 to 1 step 0 do{_adjustBrightness=CHBN_adjustBrightness;_adju>
17:20:19   Error position: <=CHBN_adjustBrightness;_adju>
17:20:19   Error Missing ;

 

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

17:20:19 Error in expression <"from 0 to 1 step 0 do{_adjustBrightness=CHBN_adjustBrightness;_adju>
17:20:19   Error position: <=CHBN_adjustBrightness;_adju>
17:20:19   Error Missing ;

 

Pastebin your "initPlayerLocal.sqf". It looks like you messed something up in there or have a hidden character in the file.

  • Like 1
Link to post
Share on other sites
2 hours ago, imthatguyhere said:

Pastebin your "initPlayerLocal.sqf". It looks like you messed something up in there or have a hidden character in the file.

Indeed some hidden characters (4!)

Forgot to post an update here

Thank you

Edited by Vliek
Link to post
Share on other sites
  • 6 months later...

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.

×
×
  • Create New...

Important Information

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