Working House Lighting

You actually do not need to re-pbo your MPMission file for it to read it. Save yourself some time.

Ick, I feel sorry for you man, I've screwed up my files before. Gotta back that stuff up. :oops:

Hmm, so according to your init file, I've done the same thing you have, and no lights for me.

Here's what I'm doing to test if it works. I'm putting myself on top of the grain silos in cherno, setting my server to night. I log in and it's dark as hell, no lights anywhere. I tried at a similar location in zelenogorsk. No lights. I didn't run around the map.

I am also running rMod. I don't see anything in your code that should affect anything based on anything I'm running. I'm stumped.
 
the thing that breaks lights is in the dayz_anim.pbo/config.pbo file with rmod it fixes that, to make a light you need to create it.

The way you do it is you need to create a light and attach it to the light house:

http://forums.bistudio.com/archive/index.php/t-75422.html

this is the code to put in the init line:
Code:
light = "#lightpoint" createVehicleLocal position this; light setLightBrightness 0.9; light setLightAmbient[0.0, 0.0, 0.0]; light setLightColor[1.0, 1.0, 1.0]; light lightAttachObject [this, [0,0,30]]

which would create a light 30m above what ever "this" is, you could also create an invisible market and attach the light to that.

however if the light house actually has a light on it the way you turn that on is with the switchlight function:

http://www.ofpec.com/COMREF/index.php?action=details&id=362&game=All
 
Had a little play with this, as it currently stands it looks kinda ok. But some of the lights (Like the ones in the supermarkets) don't work really well
 
Yeah agreed, they look VERY unnatural

I agree, I don't like the glowing purple houses. This is because the ambient light source is glowing through the wall and bleeding the colour out. There seems to be a lot of purple about..

Some darker houses work well. I may just remove the bad looking ones and work on the enterable buildings a bit. The problem with creating a new light source is that it produces glare, like vehicle headlights, when you look at them. Even more annoying..
 
Have updated the code in the original post.

Essentially a bit of an improvement on the aesthetics, in that the ambient lights are toned down a bit and I have positioned them properly underground. I think the attachObject command was setting the Z axis from somewhere central to the house height. I now get the X and Y from the house and set Z myself.. That's for non-enterable houses with windows that light up..

I have got rid of the vehicle light sources in the supermarkets etc. mainly because these were constantly being created on a loop, probably the cause of the server slow down Mattz. And there doesn't seem to be a sensible way to remove the glare from these either..

I have seen a couple of nice looking light additions to enterable buildings so will have another go at this. I, most likely, will do this once I work out how to create these on the server so they are permanent and visible by all..
 
I am messing with the init.sqf and have this:
Code:
if (!isDedicated) then {
_offset=0;//Edit this to offset start and stop times
_daytime=daytime+_offset;
if(_daytime<6||_daytime>20) then {
[] execVM "fixes\change_streetlights.sqf";
}
};
The only issue I have though is that daytime seems to return the same time regardless of any offset / static settings in HiveExt.ini. During testing I changed my system time and timezone, I am guessing that time is retrieved from an internet time server. Obviously if there is an offset on your server time then this could be a problem. Which is why I added the offset value.

Obviously the start / stop times can also be edited. I found 20:00 to be a good time as it is just getting dark. Morning I haven't tested so much, the closer to just after dawn the better I would say..

This won't work if you have Static in your HiveExt.ini as the server will get out of sync on each restart.. In that case remove completely and just call the function, like so:

Code:
if (!isDedicated) then {
 
[] execVM "fixes\change_streetlights.sqf";
 
};
 
Hi BlackHeart. I have looked at the streetlights thinking of creating a light source within the light box on the top of the poles. The only issue I can see is the glare that is created from these light sources. I have seen a good script for adding light bulbs to street lamps, was going to have a look through this at some point, might be worth a look..

I am currently adding to this script to improve performance and add some effects. I am stuck trying to pass an object to another function though..
 
Thanks for linking me here axeman. I want to try this, but the problem is my server is very popular during the day (always full) and settles to about 10 people throughout the night whilst it's pitch black. What effects will this have on performance?
 
To be honest, at the moment I don't know. I am updating the script and have added some performance improvements. I will be putting it on my live server tonight or tomorrow, I don't report the server back so is not too busy. I mainly use it for friends but we do have a few regulars now..

You can completely switch off the script based on time and I would have thought you wouldn't see any issues with 10 people. The script is a mission so runs on the client pc. Though the light sources are created 'vehicles' which do seem to persist in some capacity.

On the next update I will run a before and after fps / processor n ram usage test on client and server, I usually get a couple on most nights, will try and pick a busier time then report back..
 
Firstly i would like to thank You for sharing this.
I'm running it on my server atm and it works. Only tried it myself (1 player) so still testing.

- lights in windows appear from grater distance when you zoom in your view (by defaul right mb). dunno if its a graphical glitch or how the script works
- driving a car into a town does not always switch on the ambient light. when you get out of the car it still off. probably only another player would trigger the script (assumption)
- i think loot spawn takes a little bit longer then usual

Gonna report back here with the results with more ppl playing.
 
Thanks for the feedback. I have noticed some odd triggering times. I think a lot of it can be put down to the script 'catching up' as it lights up houses you have passed, especially when driving or flying. I can confirm that it will trigger from a chopper, I would assume a car should work too, though not tested.

The next version, I am hoping to release later, is a bit more refined and does more checks on existing lit houses. I have not found a way to check if an existing #lightpoint is on or off though, I have not yet found a way to get any info. back from one of these from the game engine.
 
Thanks Axeman. If you do get it working i would <3 you forever lol :) Im not good at code like this so its hard for me so anything you can do i would much appreciate.
I know there is a script reducing the glare from lights, cant remember if it was sunlight only though. Maybe the two combined would work well. Ill have to double check that though.
 
Ok, tested it with about 20 players.
Got massive desync. Had to disable it. Still I encourage you to continue youre work
 
We may have to honour rockets wishes and be stalked by zombies in the dark :)

I think the issue is with each client individually creating the ambient light source for, up to, hundreds of houses.
 
Back
Top