ID:268862
 
I need coding for seasons, like days , months , winter , summer , spring & fall like what WB has on Harvest Moon: Trinity Ranch but for my Zelda game & DBZ game
Contract Jack wrote:
I need coding for seasons, like days , months , winter , summer , spring & fall like what WB has on Harvest Moon: Trinity Ranch but for my Zelda game & DBZ game

No, I'm not going to give you a program for seasons, but I will help you.

What you need are some global variables which tell the time.

var
time_season
time_month
time_week
time_day


When the world starts, you want to start a timer which starts everything up, basically. Depending on how long you want one day to be, it will be different.

world/New()
..()
startTimer() // when the world is created, start the timer

proc/startTimer()
spawn while(world) // the while() proc keeps on doing what is beneath it until the argument is null. while(1) would work too.
sleep(600) // every 60 seconds, a day will pass. You can change this to whatever you want.
time_day ++ // the ++ sign is the same as doing += 1.
if(time_day > 7) // this is some day check
time_week ++
time_day = 1
if(time_week > 4) // and continue on checking weeks
time_month ++
// and so on until you finish the months


This is one very simple time-keeping procedure, which is untested. Please do not copy/paste this unless you understand how every goes, and good luck.

If you want to save the time from the last time the server was open, you can save the variables to a savefile.

~~> Dragon Lord

PS: Don't request coding on the forums, it is rude and annoying.
In response to Unknown Person
ok and on the weather part i just put the weather system demo i fount somehow with it , hanks for your help
In response to Contract Jack
How would i make it when it is season 1 the grass is bright green then is season 2 the grass is dark green like icon changing a world thing

var
time_season
time_day

world/New()
..()
startTimer() // when the world is created, start the timer

proc/startTimer()
spawn while(world) // the while() proc keeps on doing what is beneath it until the argument is null. while(1) would work too.
sleep(500) // every 60 seconds, a day will pass. You can change this to whatever you want.
time_day ++ // the ++ sign is the same as doing += 1.
if(time_day > 12) // this is some day check
time_season ++
time_day = 1

mob
verb
Time_Check()
set category = "Commands"
usr << "Day : [time_day]"
usr << "Season: [time_season]"
In response to Contract Jack
one way is
for(var/turf/grass/E in world)
E.icon_state = "darkgrass"

this would make massive lag i think when it changes
all of them and is based on the turf being called grass.

anyone know a better way ?