Working House Lighting

Yes, theres like only one house lightning up.

The bug crashes the script, it does seem to start up again. Is when nearestObjects returns just one object (house in this case) I think. I need to test to be sure. Only noticed when flying around the map, most people shouldn't notice..
 
Just letting you know that I'm currently using your script on my server and its awesome :)
I think that previously the desyncs ware caused by my hosting, not the lights so sorry for all the drama I made :p

Wysyłane z mojego HTC Desire S za pomocą Tapatalk 2
 
I've just started using this today, and it looks great. I'm running it on Taviana though, so I don't think your script detects the Taviana-specific buildings. Would it be possible for you to implement this? (or teach me how to do it myself)

I'm excited to see it working with the street lights if/when you are able to get that working.
 
As far as I know the script will work on any map, so long as they have non enterable houses with windows that light up. I removed the ambient light sources from enterable buildings early on due to the glare..

I have this fixed now and am considering lighting up workshops, supermarkets etc. in their own style of lighting but am a little hesitant as I don't want to ruin the experience..

Am quite happy with this mission, as a first attempt, and am looking at a new idea based around spawning a building, of sorts, as a kind of place for a lost survivor to call home..

Am honestly not sure at the moment, but I will be releasing something else soon. This lighting mission will not get left, just need to collect ideas n get some real game time with it..

I am grateful for all the feedback and to hear it is working, keep the ideas coming for the next update :)

EDIT: I am also going to implement the power outage in thunderstorm idea and am toying with having a 'power station' for each area, obviously cherno and electro have an obvious location. I am thinking of incorporating a switch that could be thrown to turn lights on or off for each town / suburb..
 
Oh, ok. Well, I guess the Taviana buildings don't have light points built in. Damn. Would there be a way to do something, like to create 'floating' lights on/inside/around the unlit buildings for Taviana? I don't have too much experience with this modding. A lot of the modifications that I've made have been through the database, and I've only recently started modifying the mission.pbo, server.pbo and BE script exception files.

Some light around the loot areas would be nice. Tbh, I would be really happy with just street lighting.

I want to get a nice level of lighting working on the Taviana.com map as night doesn't attract a lot of players. There is a lot of city and open area in the map, so I don't think it would detract from the core experience.
 
This code, basically, looks for houses within a radius then switches on the 'lights', this lights up the windows but provides no surrounding ambient light. The code then looks for a #lightpoint within the building, if it finds one it lights it up (this is for players that have left and re-joined the server as the lightpoint is persistent). If it doesn't find one it creates a new lightpoint, sets colour etc. and 'switches it on'.

What I need to do is add a loop of nearestObjects, searching from an array of building names, the buildings to light up will have to be provided individually. Then do the last part and look for an existing, or create a new, lightpoint. There won't be a bulb or physical light but there will be an ambient light source..

Will update this soon, sadly I have work getting in the way of doing this :)
 
i just want to say this is awesome, and I am using it. It works pretty good, there are a couple bugs, but it's normal. Just curious is there a way to add objects into the world and having them give off light? I am missing alot of light in the cities, due to no ambient effects. So I was wondering if i could add the Land_NavigLight. I'd like to add some more light around, cause I can't get the full moon script to work on my server.
 
You can add most items in using the --with-buildings add on using Reality. Then spread the light posts around the map. I have an updated version of the script that adds the ambient light source (the one that lights the surrounding area) to enterable buildings.

That could be tweaked to include custom objects, such as this light post. What map are you running, aren't those the runway lights from Zargabad ? Have read that the bulb on top is already lit, which would make the effect much better.

Like the houses that have their windows 'switched on' they don't cast any ambient light, which is why I have added a lightpoint. Haven't had time to really look at this much, work commitments and my spare time spent trying to get vehicles and buildings to spawn into the server during gameplay.

My update needs a bit of testing but I will test adding in the custom objects. This is the basic idea (again, not tested)
Code:
_range=600;//Distance to scan for buildings / houses.
_buildings = ["Land_A_FuelStation_Shed","Land_A_GeneralStore_01","Land_A_GeneralStore_01a","Land_A_Hospital","Land_A_Office01"];//Array of buildings to create lightpoints for.
 
 
_objBuildings = nearestObjects [player, [_buildings], _range];
        {
        _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 building..
        _pos = getPos _x;
        _xpos = _pos select 0;
        _ypos = _pos select 1;
        _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
     
            if((_awayx>1 or _awayx<-1)or(_awayy>1 or _awayy<-1))then
            {
 
                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.1;
                };
 
            }
            else
            {
                _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.1;
            };
     
        } forEach _objBuildings;

You would add your lightpost to the _buildings array, like this:
Code:
_buildings = ["Land_NavigLight","Land_A_FuelStation_Shed","Land_A_GeneralStore_01","Land_A_GeneralStore_01a","Land_A_Hospital","Land_A_Office01"];//Array of buildings to create lightpoints for.

Technically that should add an ambient light source to the objects in the _buildings array. Add it into the existing code after
Code:
} forEach _objHouse;

I haven't released this yet as I need to find a way to make these lights fail randomly and am working on adding a power source in before the lights will come on. That's some way off as I need to get the spawning of objects in-game sussed and I wanted to force the player to have some metal and maybe engine parts before being able to build a power source..

Annoyingly I got the code, to spawn vehicles into the server and save them to the database, working last Saturday night, using Xyberviri's code and with a fair bit of help from him. Then managed to delete my MPMissions folder when setting up 1.7.5 and before a backup was taken. Most hacked off as I am not entirely sure how I got it working, back to the drawing board..
 
I am running cherna straight, no Rmod.

I will do testing for it for sure! Thanks for the help.

I'm still trying to get to where I can spawn them in and save them to the DB. I have most of it, but I can't get how to spawn them in, XD. You think you could help with that? There aren't any tuts I see on that, just the saving part.
 
Have you got the two tables building and instance_building in your mysql database ? If so you can add each occurrence of Land_NavigLight that you want in the instance_building table: Add the worldspace where you want to place it, the instance_id should be 1 and building_id is the id from the building table.

You can get worldspace coordinates by going to the spot with your character, then copy the worldspace from the survivor table for your alive player.

If you don't have those tables you need to run the Reality build with the --with-buildings option. I have added objects before using the deployable and instance_deployable tables. Ayan4mi said at the time that it wasn't a good idea though :)

There is a readme on the github page for the reality package here if you get stuck with any bits will try and help..
 
With my host I only have deployables and instance deployables, could I just change the "_Buildings" to "_deployables" ? That is how Ive placed buildings and such, you said that that was able to work, could you give me a little help?
 
Your deployable table is basically a list of available objects to delpoy around the map. I have used that table to place flags on the map so I have added FlagCarrierBLUFOR_EP1 to the class_name field. The ID is generated automatically when you add the new class_name.

Refresh the table and make a note of the ID, in my case it is 8. Then go to the instance_deployable table and add a new row and edit the following fields:

id is automatically generated, don't worry about it.

unique_id is normally generated by the game but is seems safe take the last number and add a 1.

deployable_id is the id from the deployable table so, for me, is 8.

owner_id, you need to open the survivor table and find an id in there to use, same as we have done in deployable. The only thing here is when that survivor is cleaned out of the table the deployable may also be cleaned up, like tents. I use one of my own and make sure I leave him in the table even after dying (haven't actually got so far as cleaning the entry out to see what happens)

instance_id is your world id, default for Chernarus is a 1, check the world table if you use any other maps and to ensure you should use a 1 for chernarus.

worldspace is the location of the new object. The easiest way to get this is to take your survivor and stand in the spot that you want to spawn the new object, even look the way you want it orientated. Wait a minute then go to the survivor table, find your current survivor. With mySQL run this command
Code:
SELECT * FROM `dayz`.`survivor` where is_dead=0 and unique_id='<insert your unique id here>'
You need to put your own unique_id in, normally an 8 digit number (but can vary). A worldspace array looks like this: [158,[6917.85,8100.64,0.00296021]]

Inventory. Default empty inventory is [], for items that take stuff you can add an inventory array in here. Usually best to copy the inventory from an already existing item. Or for a new one, spawn it into the game then add some items and edit the results. Most people don't know that Land_Campfire / Land_Fire_burning can hold an inventory (8 slots). It is not persistent and a burning fire will consume what you put into it. And, allegedly,adding wood will make the fire burn for longer. Is very handy for storing stuff temporarily when going on runs into dangerous territory.


last_updated I usually copy the value from the row above.

created is generated by mySQL, don't worry about.

Since the last dayz / hive update there are some new fields, I can only guess at what these may do but the defaults will work fine, so if you leave them mySQL will fill the fields with the defaults. Maybe they are to fix issues with 1.7.5.1 and just 'be there' for queries from the game, I don't know. I would like to think they are a sign of things to come..

Hitpoints default value [], hitpoints are normally used in the instance_vehicle to define the parts of the vehicle that are damaged, have seen a video of zeds breaking a house, I winder if there are plans for houses to be damaged incrementally and pull survivors through windows :)

Fuel: fairly self explanatory, default vale of 0 (zero) will do, normal values range from 1 (full tank) down to zero (out of fuel, boooh). Are they introducing generators or some other static object that requires fuel ?

Damage, again a default of 0 (zero) will suffice here, values range from zero to one. Normally with vehicles, damage of one means ka-boom..


Hope that helps explain the fields for you and give you a clue as what to do with them. Again, I have been warned off from using this table to spawn objects so I would keep an eye on server performance etc. I only run a small, friendly server and can't say I have noticed anything. You can check the .rpt log to see if they have spawned, there usually is an error along the lines of cannot generate non-ai blah blah for banned stuff.

The best way to add buildings is by building your server using the --with-buildings option and updating the database with the same options to create the tables. However stuff like Land_Fire_burning really belongs in the deployable tables as they have an inventory..

Once you have added all your new objects, take a backup of the database and keep it, in case your survivor, that owns the new objects, gets cleaned out and you lose your objects. You don't want to lose your work..
 
Hey i'm interested in Streetlights only but no house lighting? Has anyone mentioned this please direct me to that post, or explain it.
 
Hey i'm interested in Streetlights only but no house lighting? Has anyone mentioned this please direct me to that post, or explain it.

Think we have covered this, if you want streetlights you either need to work out if the streetlamp object has a bulb that will glow and provide an ambient light, and either 'unban' it from the dayZ code.

Or, this seems most likely, add a light source to create the light on each object, similar to how the house light code does.. have done lots of googling and improved on the best answer I could find with the house lighting.

Next upgrade I am looking at including custom objects to light up, no reason why street lamps couldn't be included..
 
Let me know when the custom script is done please I just moved over to a dedicated server and have the -Buildings added and all those added so whenever that custom script to create light points around them is done I would love to test for you! =)
 
Think we have covered this, if you want streetlights you either need to work out if the streetlamp object has a bulb that will glow and provide an ambient light, and either 'unban' it from the dayZ code.

Or, this seems most likely, add a light source to create the light on each object, similar to how the house light code does.. have done lots of googling and improved on the best answer I could find with the house lighting.

Next upgrade I am looking at including custom objects to light up, no reason why street lamps couldn't be included..

I cant find it could you send me a link to where you covered it?
 
Well I moved to a dedicated box and was able to get the chernarus buildings to flicker with your default script but I'm on namalsk and want to light custom buildings because that's mainly why people play my map, "det0x namalsk". So obviously the two or three hour nights would be very creepier with barracks and markets flickering etc
 
Back
Top