Need a bit of help.

I have a day/night script. I want to make it so its light when you go in buildings, and I want another script so where its night, lanterns outside light, but when its morning, the lights from the lanterns go away… how would I do this?

if (playerenters) {
toweapons -daysystem;
timeout = 0.2;
if (timeout) {
if (!isweapon) return;
timeout = 0.2;
function dayCycle() {
this.timer = timevar;
this.totaltime = 250;
this.time = this.timer%this.totaltime;
this.time = this.time;
this.time = this.time/this.totaltime*2;
function render() {
this.r = 1;
this.g = 0.54;
this.b = 0;
this.scale = (abs(this.time-1)-.25)2;
if (this.scale > 1) this.scale = 1;
if (this.scale < 0) this.scale = 0;
this.r = this.scale;
this.b = this.scale;
this.g = this.scale;
this.maxdarkness = .65;
seteffect this.r

Why don’t you experiment with it a bit first? This should be a simple enough system for you to figure out by yourself.

why not use it, looks like downsiders script anyway :expressionless:

Maybe you could add a flag when it’s night time and when the flag is true you could set the light however you want in each level. But that’s probably one of if not the hardest way to do this… I’ve just never done it and it’s how I would figure it out the first time. It might actually take two flags to work successfully the way I mentioned… one to determine when it’s night time and one to cause the day/night script to be ignored when you are inside any “interior levels” so you can set your lighting appropriately with an additional npc inside and outside of the level(s) in question. Or perhaps you could setup an array within your code to ignore the time of day when in any level within the array and just be bright like normal.Play around and see what you come up with that will work for what you need done. By the way, I would recommend setting a flag for when it’s night time pretty much no matter what, though if someone else recommends otherwise they are probably correct… anyway, the reason being that you want your lanterns and torches or whatever etc to turn off at morning, and this is the easiest method I know of for creating that effect. Basically just display a different image (the light not on) when you want it off, and hide the light emitting npc as well whenever your flag is not true. Or do it the other way around, telling when it’s daytime and turning them on and off accordingly with that flag instead, whichever is easier for you. But like I said, anything conflicting with my advice is probably better as I’ve not scripted many things quite that complex, and never dealt with a day/night system… yet. Just wanted to try to help give you some ideas.

use prefix for outside levels


Sorry about that, as I said in the reason for editing that post, the words were mashed together, and editing did not solve the issue.

Crossfire, experiment with scripting. You blindly use scripts for your server which takes away part of the fun. I may not be able to script amazing like Downsider, Tricxta, or any other good scriptors out there, but I’m able to understand scripts when I use them and I can manipulate them. I played with the offline editor for two months in scripting, leveling, and with graphics before starting a server.