generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Dynamic daytime w/ fog coloring

Previous Thread :: Next Thread 
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
27 Nov 2012 06:11 PM
This script colors, sets fog start and fog end, a gui tint, and brightness relative to day of time, which changes constantly.
It works fine, but any other ideas on the weather part? Just sunny, foggy, or cloudy? How could I do rain (No guis).


repeat wait() until _G.DAY_AND_NIGHT ~= nil

light = game:service("Lighting")
respawnTime = 12
local MinutesInDay = 60 * 24 --1440
local light = game.Lighting
wbright,wfoge,wfogs,wtint = 1,1,1,1

function chooseWeather()
local w_n = math.random(1,10)
if w_n == 1 or w_n == 2 then
print("Sunny Day")
bright = 1.5
foge = 1
fogs = 1
tint = 1
elseif w_n == 3 then
print("Foggy day")
bright = 0.7
foge = 1.5
fogs = 2
tint = 1
else
print("Cloudy day")
bright = 0.7
foge = 1
fogs = 1
tint = 0.8
end
return bright,foge,fogs,tint
end

while _G.DAY_AND_NIGHT and wait(_G.DAY_AND_NIGHT_SPEED) do
if game.Lighting.TimeOfDay == "00:00:00" then
wbright,wfoge,wfogs,wtint = chooseWeather()
end
if not booted then
print("Day and night loop running")
booted = true
end
local t = light:GetMinutesAfterMidnight()
local color = -.5*math.cos(2 * math.pi * (t / MinutesInDay)) + .5
light.FogStart = 100 * color / wfogs
light.FogEnd = 700 * color + 300 / wfoge
light.FogColor = Color3.new(color, color, color)
light.Brightness = light.FogEnd / 1000 * wbright
local players = game.Players:children()
for i = 1, #players do
players[i].PlayerGui.Scripts.Darkness.BackgroundTransparency = light.FogEnd / 1000 + 0.15 / wtint
end
light:SetMinutesAfterMidnight(light:GetMinutesAfterMidnight()+1)
end
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
27 Nov 2012 06:34 PM
Rain is a pain.

If you want the rain effect itself and if GUIs are out of the question, falling bricks would be the best way to do it, sadly enough.

A simple drizzle may be possible, but for a bad storm falling bricks could be unacceptably laggy. The correct move is therefore to cheat, and try to get the best effect possible with as few bricks as possible. What you might be able to do to save some moving bricks is simulate the other effects of a severe thunderstorm (extremely dense fog, occasional thunder, sound of rain falling) and then have like 1 or 2 bricks per second spawned in front of the player's field of view in the fog (to give the impression that the rain is difficult to see so the player writes off not seeing a lot of it).
Report Abuse
Wowgnomes is online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
27 Nov 2012 07:23 PM
that's pretty awesome
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Nov 2012 07:32 PM
GUIs are best for rain.
Bricks that fall down would be VERY laggy and I recommend you don't do it.
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
27 Nov 2012 07:34 PM
billboard guis for rain cus i do it da complex hard way
Report Abuse
Wowgnomes is online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
27 Nov 2012 07:38 PM
billboard guis = even more rain lol
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
27 Nov 2012 07:40 PM
lolno i hat dem gnomfe wif dem ugly faic.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
27 Nov 2012 08:56 PM
@Jarod

Kind of, sort of.
Simple GUIs look atrocious if the player, for instance, looks down (THE RAIN IS FALLING SIDEWAYS, AHHH).
Billboard GUIs look better, but it's tricky to get them as good as bricks.

A few (on the order of 10/20 total in the place), carefully placed bricks shouldn't lag more than any other moving part.

Roblox needs to give us real particle effects. :/
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
28 Nov 2012 09:19 AM
I think it could be possible to make the gui rain "particles" go in the direction relative to the localplayers camera CFrame, I would now know how to do this though
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
29 Nov 2012 03:33 PM
anyone know ?
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
29 Nov 2012 03:36 PM
wiki.roblox.com has your answers.

- thedestroyer115
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image