Hey hope this helps you all. and hope this posts correctly. first script so you may want to trim down on things or rewrite but it works. oh starts only at 8pm to start at other times change hour and minutes then change starting variables to how it would look in game (go in game press tab set it to where you want to start find the values for Fog colours, Ambience Intensity, Surface Intensity, and Surface colours write them down then add around 20 to each lol seems those numbers don't directly correspond with the coding then change the starting variables FG= fog green SB = surface Blue SI =surface intensity) hope that clears up any confusion.
[quote="
--Created by: Mr. EA King www.Youtube.com/mreaking
--set the hour and minutes to start at
local HourOfDay = 20
local MinuteOfDay = 0
-- timer variables
local TimePassed = 0
local TimeStamp = 0
local Time1 = 0
local Time2 = 0
local MinuteLength = .003 -- change to 1 to make 1 sec = 1 minute.
-- Fog colour, Ambience intensity and Surface variables
local FR = 40
local FG = 40
local FB = 40
local AmbI = 55
local SI = 35
local SR = 40
local SG = 40
local SB = 40
--init
function daynightcycle_init(e)
end
function daynightcycle_main(e)
--displays prompt checks if its AM
if HourOfDay <=12 then
if MinuteOfDay <= 9 then
Prompt ("time is " .. HourOfDay .. ":0".. MinuteOfDay .. " AM")
end
if MinuteOfDay >= 10 then
Prompt ("time is " .. HourOfDay .. ":".. MinuteOfDay .. " AM")
end
end
--displays prompt checks if its PM
if HourOfDay >=13 then
if MinuteOfDay <= 9 then
Prompt ("time is " .. HourOfDay - 12 .. ":0".. MinuteOfDay .. " PM")
end
if MinuteOfDay >= 10 then
Prompt ("time is " .. HourOfDay - 12 .. ":".. MinuteOfDay .. " PM")
end
end
--Time
if TimeStamp == 0 then
Time1 = g_Time
TimeStamp = 1
end
Time2 = g_Time
TimePassed = (Time2 - Time1) * 0.001
if TimePassed >= MinuteLength then
MinuteOfDay = MinuteOfDay + 1
if MinuteOfDay == 60 then
HourOfDay = HourOfDay + 1
--add the hour
if HourOfDay == 24 then
-- is th day done reset hours
HourOfDay = 1
end
--reset minutes
MinuteOfDay = 0
end
--time checkers
-- see what hour it is and change the variables accordingly to get sunsets/rises
--reset fog to white brighten and darken scene
if HourOfDay >= 20 then
FR = FR - .032
FG = FG - .032
FB = FB - .032
AmbI = AmbI - .06
SI = SI - .0165
SR = SR - .0165
SG = SG - .0165
SB = SB - .0165
end
if HourOfDay <= 3 then
FR = FR + .032
FG = FG + .032
FB = FB + .032
AmbI = AmbI + .0165
SI = SI + .0165
SR = SR + .0165
SG = SG + .0165
SB = SB + .0165
end
if HourOfDay == 4 or HourOfDay == 5 then
FR = FR + .18
FG = FG + .09
FB = FB + .03
AmbI = AmbI + .04
SI = SI + .0165
SR = SR + .165
SG = SG + .082
SB = SB + .0165
end
if HourOfDay == 6 or HourOfDay == 7 then
FR = FR + .03
FG = FG + .09
FB = FB + .18
AmbI = AmbI + .04
SI = SI + .0165
SR = SR + .165
SG = SG + .082
SB = SB + .0165
end
if HourOfDay == 8 or HourOfDay == 9 then
FR = FR + .032
FG = FG + .032
FB = FB + .032
AmbI = AmbI + .0165
SI = SI + .0165
SR = SR + .0165
SG = SG + .0165
SB = SB + .0165
end
if HourOfDay >= 10 and HourOfDay <= 13 then
FR = FR
FG = FG
FB = FB
AmbI = AmbI
SI = SI
SR = SR
SG = SG
SB = SB
end
if HourOfDay >= 14 and HourOfDay <= 16 then
FR = FR - .032
FG = FG - .032
FB = FB - .032
AmbI = AmbI - .0165
SI = SI - .0165
SR = SR - .0165
SG = SG - .0165
SB = SB - .0165
end
if HourOfDay == 17 or HourOfDay == 18then
FR = FR - .03
FG = FG - .09
FB = FB - .18
AmbI = AmbI - .0165
SI = SI - .0165
SR = SR - .0165
SG = SG - .0165
SB = SB - .0165
end
if HourOfDay == 19 then
FR = FR - .3
FG = FG - .18
FB = FB
AmbI = AmbI - .0165
SI = SI - .0165
SR = SR - .0165
SG = SG - .0165
SB = SB - .0165
end
SetFogRed(FR)
SetFogGreen(FG)
SetFogBlue(FB)
SetAmbienceIntensity(AmbI)
SetSurfaceIntensity(SI)
SetSurfaceRed(SR)
SetSurfaceGreen(SG)
SetSurfaceBlue(SB)
TimeStamp = 0;
end
end
"]
[video=https://youtu.be/T44ilKyqVsY]