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: Seasons.

Previous Thread :: Next Thread 
tommyfun is not online. tommyfun
Joined: 04 Jan 2011
Total Posts: 1404
28 Mar 2014 03:25 PM
Ok, I'm sew to scripting, so if someone could point me in the direction of a wiki article or just explain how to do this, I would appreciate it.

Ok, I want to make a map that changes depending on the time of year the game chooses. So, say it's winter. The game would tell all the water to turn to ice, all the ground to have snow on it (this would be a bit of a challenge, and may cause lag I think) and so forth. If the game chose summer, all the water would stay thawed, grass everywhere, increased thirst, ect.

How would I do this?
Report Abuse
tommyfun is not online. tommyfun
Joined: 04 Jan 2011
Total Posts: 1404
28 Mar 2014 03:32 PM
Bump please.
Report Abuse
sycips is not online. sycips
Joined: 21 Mar 2011
Total Posts: 1368
28 Mar 2014 03:36 PM
Well, then you have to be able to check the time in a year (which month is it?) Now there is a function called tick(). It tells you how many seconds passed since 1 January 1970. You could use this to calculate which month of the year it is. I guess that would work like this:

print(math.floor(((tick()/3600/24/365)%1)*12))

This will print the number of the month I guess...

I hope this works

~sycips~
Report Abuse
ALERIFICALNEUMORAITI is not online. ALERIFICALNEUMORAITI
Joined: 21 Nov 2010
Total Posts: 302
28 Mar 2014 03:59 PM
Do you want the seasons to correspond with actual seasons in real life? Because those can vary (i.e. Australia having a winter whilst the US has summer)
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
28 Mar 2014 04:03 PM
1 Player servers ^

Could he make
Report Abuse
ALERIFICALNEUMORAITI is not online. ALERIFICALNEUMORAITI
Joined: 21 Nov 2010
Total Posts: 302
28 Mar 2014 04:06 PM
Yes, 1 Player servers are nice and all, but I'm asking him the question, not asking if it's possible. I'd find it preferable to use local parts.
Report Abuse
tommyfun is not online. tommyfun
Joined: 04 Jan 2011
Total Posts: 1404
28 Mar 2014 04:28 PM
No, I don't want the seasons to occur at the same time as in real life. I want the game to randomly pick a month and the map will load with that month as the time of year.
Report Abuse
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
28 Mar 2014 04:31 PM
well, then you would make a table, no?

seasons = {"winter", "spring", "summer", "fall" }

if one of those is selected then you can make your stuff
Report Abuse
ALERIFICALNEUMORAITI is not online. ALERIFICALNEUMORAITI
Joined: 21 Nov 2010
Total Posts: 302
28 Mar 2014 05:03 PM
You can take this plenty of ways, which I'm sure would take a modest amount of work. I'm sure the easiest, most friendly of doing this would be something like this:

Seasons = {
Current = {},
ChangeTo = function(self, index)
if self.Current.seasonModel then
self.Current.seasonModel:Destroy()
end

local mainModel = Instance.new("Model") --create model where all seasonal parts will go
self[index](mainModel) --add season parts
self.Current = {seasonName = index, seasonModel = mainModel} --update current season status
mainModel.Name = index.." Scenery"
mainModel.Parent = workspace --make it appear

print("Changed to "..index.." season!")
end,
Summer = function(mainModel)
--make summer parts, parent them to mainModel
end,
Winter = function(mainModel)
--make winter parts
end,
Spring = function(mainModel)
--make spring parts
end,
Autumn = function(mainModel)
--make fall parts
end,
}

while true do
Seasons:ChangeTo("Spring")
wait(60*5) --60 * number of minutes
Seasons:ChangeTo("Summer")
wait(60*5)
Seasons:ChangeTo("Autumn")
wait(60*5)
Seasons:ChangeTo("Winter")
wait(60*5)
end

Hope I didn't go too overboard. All you have to do is change where I noted to make the parts for each season. The parts in each section will all appear when the season is reached, as well as a message in the output telling that the season changed. The old season's parts will also disappear. It's possible to add seasons by just setting one up in the table like all of the others are; for example:
CustomSeason = function(mainModel)
--make customseason parts
end

Simple as that.
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