Jump to content
Vlue

Basic Game Time + Night/Day

Recommended Posts

It might help you to do something like this:

 

Day.png

This little baby only comes about every fifteen seconds to check what day of the week it is. You can have a common event trigger when, say, Friday comes around. Have it wait a minute, then perform the event, and then set the wait time to however long the rest of the day is. It won't matter, because at the end of the day that switch will be flipped off, and the next time Friday comes around, the event will happen again.

Share this post


Link to post
Share on other sites

Vlue, I found one issue: when you're at an inn, you, say, change the amount of time by eight hours, right?

 

Well, there's one problem: If you go to an inn and you sleep for 8 hours, if you go past midnight, the value for the next day won't come. I could probably create a common event for inns with conditionals for hours that would cause the calendar to go over and into the next day-- or is there a more elegant way to do it in scripts?

Share this post


Link to post
Share on other sites

Vlue, I found one issue: when you're at an inn, you, say, change the amount of time by eight hours, right?

 

Well, there's one problem: If you go to an inn and you sleep for 8 hours, if you go past midnight, the value for the next day won't come. I could probably create a common event for inns with conditionals for hours that would cause the calendar to go over and into the next day-- or is there a more elegant way to do it in scripts?

 

Elegant? Just for that I made it non-elegant! This will do that:

module GameTime
 WEEK_VAR = 1
 def self.change(number)
   $game_time += number
   if $game_time > 1440 then 
     $game_time -= 1440; $game_variables[WEEK_VAR] += 1
     $game_variables[WEEK_VAR] = 0 if $game_variables[WEEK_VAR] > 6 end
   if $game_time < 0
     $game_time += 1440 ; $game_variables[WEEK_VAR] -= 1
     $game_variables[WEEK_VAR] = 6 if $game_variables[WEEK_VAR] < 0 end
   GameTime::tint(0)
 end
end

  • Like 1

Share this post


Link to post
Share on other sites

Is there any way to start with the clock off but still let the player turn it on when they need it?

Share this post


Link to post
Share on other sites

His fix does that, actually- all you need to do is hit the toggle button and WHAM, clock appears.

Share this post


Link to post
Share on other sites

can i use this in commerical and non-commercial game because i'm using it for a competition that i will join...

but i will credit you if you want!!!

and also it there anyway to modify the script to use real-time that been set on a pc.

Edited by jomarcenter

Share this post


Link to post
Share on other sites

can i use this in commerical and non-commercial game because i'm using it for a competition that i will join...

but i will credit you if you want!!!

and also it there anyway to modify the script to use real-time that been set on a pc.

 

This particular baby is free to use in any project, commercial or not, as long as credit is given.

And yes there is a way to do that. Using my fancy shcmany Real Time script! Actually I'm just kidding, that would be pretty redundant.

Shove this little blurb anywhere below my GameTime script and it will update based on system time.

module GameTime
 def self.update
   hour = Time.now.hour
   minute = Time.now.min
   $game_time = (hour * 60) + minute
   GameTime::tint if $game_time_pause_tint != true
 end
end

Share this post


Link to post
Share on other sites

Sorry it took me so long to reply, kind of forgot (I suck, remember Vlue? lol).

 

Anyways, which fix would that be?

 

Also, I'm using this alongside your climate system, and when they're both playing with the Tint's, daytime looks like some kind of insane Sepia tone. I had to set all of the daytime values to 0, but maybe find some other way to fix that if there is, :)

Share this post


Link to post
Share on other sites

Sorry it took me so long to reply, kind of forgot (I suck, remember Vlue? lol).

 

Anyways, which fix would that be?

 

Also, I'm using this alongside your climate system, and when they're both playing with the Tint's, daytime looks like some kind of insane Sepia tone. I had to set all of the daytime values to 0, but maybe find some other way to fix that if there is, :)

 

Now, now! Don't say that! This was the fix:

 

Shove between lines 201 and 202 (hopefully, right below "@gametimeclock = GameTime::Window_Clock.new if USE_CLOCK") this line:

@gametimeclock.visible = false if USE_CLOCK

 

The tint in the climate system actually isn't mine. All the climate system does is set the weather, and the weather in vx ACE auto tints. Which is kinda cool. But could cause problems. You'll have to play with the values!

Share this post


Link to post
Share on other sites

Thanks Vlue! :D

 

Just thought I'd bring that to your attention, ;)

  • Like 1

Share this post


Link to post
Share on other sites

Hmm, is there any way of setting this like Zelda: OoT, so that when you're in a town or whatever, time stands still? All I'd like is the day and night system to work whilst travelling the world map. Also, if you enter a town while it's night time, it will be night time in the town, and vice versa.

Share this post


Link to post
Share on other sites

Hmm, is there any way of setting this like Zelda: OoT, so that when you're in a town or whatever, time stands still? All I'd like is the day and night system to work whilst travelling the world map. Also, if you enter a town while it's night time, it will be night time in the town, and vice versa.

 

You can use events to stop time, so you can set it up that way.

It auto-tints based on time, so yes if it's night time, it will look like night time in the town. Which can also be suppressed with events.

Share this post


Link to post
Share on other sites

The striped one speaks again!

 

Not for my game, but perhaps another game might implement this:

 

How would we go about changing the speed of the timer? So, for example, in the world map time goes by faster, and in other maps (towns, dungeons, etc), it ticks by normally?

Share this post


Link to post
Share on other sites

The striped one speaks again!

 

Not for my game, but perhaps another game might implement this:

 

How would we go about changing the speed of the timer? So, for example, in the world map time goes by faster, and in other maps (towns, dungeons, etc), it ticks by normally?

 

Woot, striped one!

 

You could edit the script and change the three instances of TIME_COUNT to $time_count and then could change the # of frames it takes for a second to pass by just by changing that variable (i.e. $time_count = 30)

Share this post


Link to post
Share on other sites

I wonder, if I set no tinting onto a map, it also won't let me tint a map through an event. I've had to compromise by setting the time via the script. But why won't it let me tint the screen via event?

Share this post


Link to post
Share on other sites

I wonder, if I set no tinting onto a map, it also won't let me tint a map through an event. I've had to compromise by setting the time via the script. But why won't it let me tint the screen via event?

 

Just the silly way it works. There's a better work around. Can use the command GameTime::pause_tint(true) which keeps time going but allows you to set tints until changed back to false.

Share this post


Link to post
Share on other sites

Yes, but if the tint is already to bright then that wouldn't work...

 

What I'm trying to do is make a cave completely dark. To get it that way, I need to set the time to midnight and then pause tinting. But, it just seems kind of a bad workaround. If the player happened to have the clock open, it would suddenly jump to midnight, lol

Share this post


Link to post
Share on other sites

No no, pausing tint like that should let you be able to set the tint to whatever you want through the regular old tint screen option.

Share this post


Link to post
Share on other sites

Oh really? Okay, let me try that out.

 

What does the number between the parentheses in pause_tint mean? It seems to be there for no reason. I put "GameTime::pause_tint(0)" and the tint screen option isn't working. Do I have to change the number into something else so it works?

Edited by Niko Jose DelValle

Share this post


Link to post
Share on other sites

Oh really? Okay, let me try that out.

 

What does the number between the parentheses in pause_tint mean? It seems to be there for no reason. I put "GameTime::pause_tint(0)" and the tint screen option isn't working. Do I have to change the number into something else so it works?

 

True or false

so setting it to true will pause tint

GameTime::pause_tint(true)

Share this post


Link to post
Share on other sites

Oh, thanks for clarifying that. I didn't quite understand it. Now it's working, thanks Vlue! :D

  • Like 1

Share this post


Link to post
Share on other sites

I have a problem with the compatibility script for Khas light effects. I put the ids of the maps that I wanna to be "indoors" but anyway they get tinted, not by the time but by the previous map tint... I dunno if I be clear

 

PD: English is not my native language..... I'm originally speak spanish, so if you don´t understood well what i'm trying to say and if you understand spanish, then tell me to explain it again in spanish.. xd

Share this post


Link to post
Share on other sites

I have a problem with the compatibility script for Khas light effects. I put the ids of the maps that I wanna to be "indoors" but anyway they get tinted, not by the time but by the previous map tint... I dunno if I be clear

 

PD: English is not my native language..... I'm originally speak spanish, so if you don´t understood well what i'm trying to say and if you understand spanish, then tell me to explain it again in spanish.. xd

 

Hmm, it certainly shouldn't be doing that. It's set to default to a near blank tint upon entering a map in the no tint constant. Double check how your entering map ids. For example, some people have had problems by entering them like "001,002,010" as opposed to how it should be: "1, 2, 10"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted