Working House Lighting

If i followed these instructions for the houselights 100% would it work in Taviana?
It will be fine, look for the link (in the first post) for the newer version as you can add custom buildings. even without that it will light up anything with a house class.

I am installing tavi to my test server for the streetlights and plan on upgrading / merging the house lights in soon. Give it a go and let me know if any issues.

There have been reports of lights being visible a different distances, i think thus is due to the low brightness required to reduce glare. Have since worked out how to remove the glare..
 
Hey could you take a quick look at my pbo and see if there correct please sir I think I added them right the scripts are in the pbos and my server is working however it is night time and no lights :(
 
Thanks bro here they are

Heres link for mission to large http://www.gamefront.com/files/23175855/dayz_mission.rar
Nothing obvious, I have moved the public variable declaration further up as there is a wait for the client afterwards, is possible that the client is running the street_light.sqf too early, have also grouped some of the commands together where they run at the same place (!isDedicated / isServer). Let me know if it helps.

I am assuming you are running this on Chernarus ? House Lighting will work for other maps, Street Lights is currently Chernarus and Celle only (See latest post for Celle)..
 

Attachments

  • init.sqf
    2.8 KB · Views: 18
Oooh, this is pretty cool! I think I will be using this..... :D My server is set up to be like the apocalypse just happened so there are ai survivors and things running about and military heli's flying over head... complete chaos and this will add to the effect with the lights flickering out and a few lights left on :)
 
Having some issues. Street lights work fine, but not houselights. At the very bottom of my init.sqf:
if (!isDedicated) then {
//StreetLights
[] execVM "lights\street_lights.sqf";
};

if (!isDedicated) then {
[] execVM "fixes\change_streetlights.sqf";
};

execVM "Scripts\DRN\DynamicWeatherEffects\DynamicWeatherEffects.sqf";
 
Having some issues. Street lights work fine, but not houselights. At the very bottom of my init.sqf:
if (!isDedicated) then {
//StreetLights
[] execVM "lights\street_lights.sqf";
};

if (!isDedicated) then {
[] execVM "fixes\change_streetlights.sqf";
};

execVM "Scripts\DRN\DynamicWeatherEffects\DynamicWeatherEffects.sqf";


Change too:

Code:
if (!isDedicated) then {
//StreetLights
[] execVM "lights\street_lights.sqf";
[] execVM "fixes\change_streetlights.sqf";
};

This should resolve your issue
 
dayZ House, Building and Custom Object (Streetlamp) Lights.
>>>There is a new version of this script further down<<<
>>>this thread that is currently in testing..Click on: <<<
lights_stary.jpg

I found this thread http://dayzmod.com/forum/index.php?/topic/96862-dayz-night-lighting/ when trying to turn on street lights. I really like the idea of having some lighting, personally I think it adds to the 'atmosfear'..​
Apparently the actual street lights are banned, but using the code in that thread I decided to go for the next best thing and turn the lights on in buildings and then add an ambient light to light the surrounding area.​
This will light up non-enterable houses within a distance of 600m of the player. It creates an ambient light source that lights the surrounding area.​
Not all houses are lit each time and there is a random chance that power will fail to each house, the lights will flicker off if this happens.​
It is still dark at night and finding the loot spawns is still difficult as they are not lit. I haven't noticed that it makes you more visible to zombies.​
Put this in <path to arma2 installation>/MPMissions/<mod folder>/fixes/
change_streetlights.sqf
Code:
while {alive player}
do
{
if(daytime<6||daytime>18)//EDITABLE - Change the stop and start times for the script. No need to create lights in the day. If server set to Static time, local time seems to be 12.5007..
then {
private ["_strMessage","_brightness","_objLightPoint","_awayx","_awayy","_lp","_test","_hcount","_dir","_animlightpoint"];
_objHouse = nearestObjects [player, ["House"], 600]; //EDITABLE - Change distance, (in metres) from the player, at which houses have their lights switched on.
_housecount = count _objHouse;
_hcount=0;
{
//hint format ["(%1) %2 | Script Running..",_hcount, daytime];
_switching = random 100;//Generate random chance for power failures
_switchpercent = 85;//EDITABLE - Percentage for reliability of power supply. eg. 65 will be 65% chance of lights coming on in each house and 35% chance that lights will fail and flicker off.
_lightstate = _x animationPhase "Lights_1";//Window lights on or off
_pos = getPos _x;
_xpos = _pos select 0;
_ypos = _pos select 1;
_dir = getDir _x;
 
if(_lightstate==0) then
{
if(_switching<_switchpercent)then //Turn on lights in house windows
{
for "_i" from 1 to 5 do {
_x animate [format ["Lights_%1",_i],1];
};
sleep 0.1; // Give time for engine to register light on - I found ambient light wasn't creating without this pause.
};
};
 
 
_objLightPoint = nearestObject [_x, "#lightpoint"];
_lightpos = getPos _objLightPoint;
_lightposX = _lightpos select 0;
_lightposY = _lightpos select 1;
_awayx=_xpos-_lightposX;
_awayy=_ypos-_lightposY;// x/y distance of lightpoint from current house
_test = getDir _objLightPoint;
 
if((_awayx>1 or _awayx<-1)or(_awayy>1 or _awayy<-1))then
{
if(_x animationPhase "Lights_1"==1) then //Only create lightsource for houses with windows lit, stops unlit houses, barns etc having a light source
{
if(_switching<_switchpercent)then //Do lightpoint stuff
{
_lp = "#lightpoint" createVehicle [0,0,0];
_lp setLightColor [1, 1, 1]; // Set its colour
_lp setLightBrightness 0.01; // Set its brightness
_lp setLightAmbient[5, 5, 5]; //Light the surrounding area
_lp setPos [_xpos,_ypos,-3];// Position it underground to reduce glare and spread
_lp setDir _dir;
//hint format["(%5) %4 Houses: Create Lightpoint  ! Distance %1:%2. Test:%3",_awayx,_awayy,_test,_housecount,_hcount];
sleep 0.5;
};
};
}
else
{
if(_x animationPhase "Lights_1"==1) then //Only recreate lightsource for houses with windows lit
{
_objLightPoint setLightColor [1, 1, 1]; // Set its colour
_objLightPoint setLightBrightness 0.01; // Set its brightness
_objLightPoint setLightAmbient[5, 5, 5]; //Light the surrounding area
};
//hint format["(%5) %4 Houses: Lightpoint (%6) Found  ! Distance %1:%2. Test:%3",_awayx,_awayy,_test,_housecount,_hcount,_objLightPoint];
sleep 0.5;
};
 
 
if(_lightstate==1) then  //Decide if to turn Light Off with Animation..
{
if(_switching>_switchpercent)then
{
_animlightpoint = nearestObject [_x, "#lightpoint"];
for "_s" from 1 to 5 do {
 
if(_s%2==0)then
{
_brightness=0;
for "_l" from 1 to 5 do {
_x animate [format ["Lights_%1",_l],0];
};
}
else
{
_brightness=0.01;
for "_l" from 1 to 5 do {
_x animate [format ["Lights_%1",_l],1];
};
 
};
 
_animlightpoint setLightBrightness _brightness;
 
_sleeptime=random 100;
_sleeptime=_sleeptime/500;
sleep _sleeptime;
 
};
 
for "_l" from 1 to 5 do {
_x animate [format ["Lights_%1",_l],0];
};
_animlightpoint setLightBrightness 0;
//hint format["(%3) %2 Houses: Switch light off Test:%1",_test,_housecount,_hcount];
sleep 6;
};
};
 
_hcount=_hcount+1;
 
} forEach _objHouse;
};
}
Add this to init.sqf
Code:
if (!isDedicated) then {
[] execVM "fixes\change_streetlights.sqf";
};
lights_cherno.jpg
Flying across a city in a chopper is quite fun, watching the lights catch up with you.​
. You can edit 3 parameters (commented with \\EDITABLE):​
  • The times that the script will start and stop running.
  • The distance, from the player, at which the script will work.
  • The reliability of the power supply. The chance that a house will light up and the chance that the light will fail and flicker out.
BattlEye: Edit your scripts.txt (<path to arma2 installaion>\<mod folder>\BattlEye\scripts.txt), find the line with createVehiclenear the start, on the end of this line add
Code:
!"fixes\change_streetlights.sqf"
to stop BE booting players when using this script.​
Use notepad, I prefer notepad++, to edit the files mentioned here..​
This post has been edited a few times since the first version. This is the latest version of the code. This thread covers most issues with getting it running. Please ask if you are having trouble or have any suggestions.​
>>>There is a new version of this script further down<<<
>>>this thread that is currently in testing..Click on: <<<
hey love this script was wondering how to get the streetlights to work as well thanx
 
Can't get these to work alongside street lights. Post above did not fix it for me. Only street lights seem to work
 
Hi,

both scripts work good, but after the installation my RPT file is spammed with this:

Wrong text element 'null'
 
The only thing I can see is that I always run the scripts after starting the player monitor, try this.
 

Attachments

  • init.sqf
    2.5 KB · Views: 14
Back
Top