Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
Basic Game Time + Night/Day v1.6

by V.M.


Introduction

Provides a series of functions to set and recall a new variable known as game time, as well custom tints based on current game time to give the appearance of night and day.

Features

- Game Time, complete with unfancy little clock

- Night and Day cycle with custom tints and timing

Screenshots

GameTime.png
How to Use

Plug and play and customize if needed

Script

Convenient Pastebin: Here

FAQ

None at the moment

Credit and Thanks

- By V.M.

- Free to use in any project with credit given

Author's Notes

Hopefully nothing explodes

V1.6: Added function to hide and show clock with script call

V1.5: Added functions to stop time or tinting

V1.4: Fixed bug where toggling game clock with it unused would crash game
 
Last edited by a moderator:

Gailbraithe

Veteran
Veteran
Joined
Mar 23, 2012
Messages
37
Reaction score
4
First Language
English
Primarily Uses
Awesome. I wanted something just like this for my game.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
I spent the last 48 hours look for something like this.

Its pretty much perfect but is there a way to have the clock pause when you are talking to people, or more importantly when you open the menu.
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
I spent the last 48 hours look for something like this.

Its pretty much perfect but is there a way to have the clock pause when you are talking to people, or more importantly when you open the menu.
Why yes! There is now! New version is up which features two new options.

PAUSE_NOT_IN_MAP will stop time while not in a map scene

PAUSE_IN_MESSAGE will stop time while the message window is visible
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Why yes! There is now! New version is up which features two new options.

PAUSE_NOT_IN_MAP will stop time while not in a map scene

PAUSE_IN_MESSAGE will stop time while the message window is visible
Wow fast respond time! I noticed however my favorite feature about your system no longer works. Time would continue to flow in combat. I been struggling to add this to my other time system but failed. Is there anyway to have time pause when on the menu or in message windows, but have it pass normally in combat?

Also I tried adding something to your script that when you press "L" or default Q, it would hide the clock, it acts like a toggle so you can toggle on the clock and hide it when you feel. Is that something you could add next update?
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
Wow fast respond time! I noticed however my favorite feature about your system no longer works. Time would continue to flow in combat. I been struggling to add this to my other time system but failed. Is there anyway to have time pause when on the menu or in message windows, but have it pass normally in combat?

Also I tried adding something to your script that when you press "L" or default Q, it would hide the clock, it acts like a toggle so you can toggle on the clock and hide it when you feel. Is that something you could add next update?
Ah, it happened again, those were added too! Though it fought me the whole time :D

PAUSE_IN_COMBAT variable added, defaulted to false. Self-explanatory.

CLOCK_TOGGLE variable added, set to any input number (available choices can be found in the INPUT help file) to use that to toggle le clock.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
<3 I think this is the perfect Time system.

My hands off (I dont wear hats) to you, your quite the quick and skilled programmer.

EDIT: Actually I have a question, Im tired but I dont see any switches or variables, how can I make say a shop that is only open from 9am-5pm? Or a rare monster that spawns only from midnight to 3pm.

EDIT2: In addition, can you advance the clock by a specific amount? Say sleeping in a bed will automatically add 8 hours? Is this possible or you can only set it as sleeping in a bed will set it to 8am regardless of time.
 
Last edited by a moderator:

Angius

Villager
Member
Joined
Apr 3, 2012
Messages
19
Reaction score
2
First Language
Polish
Primarily Uses
Cool script, but yeah, variables will be useful. And in both - time changes variable, and variable changes time.

Also it's incompatible with Khas Awesome Light Effects. I mean - there's no lights.
 
  • Like
Reactions: DRS

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
<3 I think this is the perfect Time system.

My hands off (I dont wear hats) to you, your quite the quick and skilled programmer.

EDIT: Actually I have a question, Im tired but I dont see any switches or variables, how can I make say a shop that is only open from 9am-5pm? Or a rare monster that spawns only from midnight to 3pm.

EDIT2: In addition, can you advance the clock by a specific amount? Say sleeping in a bed will automatically add 8 hours? Is this possible or you can only set it as sleeping in a bed will set it to 8am regardless of time.
Oh quite simple, they are there! When making a conditional branch go to the script option and you would use some functions there.

Examples! Yes! Say you want something to only occur at 4am, then in the script option you'd put: GameTime::hour? == 4

However if you want a range like that shop, little more complicated but still doable! You'd put: GameTime::hour? >= 9 and GameTime::hour? < 17

That puts it at only doing what's within the conditional branch if the time is between 9am and 5pm! (It uses a 24 hour clock, gotta remember)

Second Edit: Yes there was a way to change the clock time by a specified amount! But a bit of a runaround and complicated so instead I just

added a function for that, grab the new version. The function is GameTime::change(time)
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
Cool script, but yeah, variables will be useful. And in both - time changes variable, and variable changes time.

Also it's incompatible with Khas Awesome Light Effects. I mean - there's no lights.
Variables!? You can do that! If you wanted to set a variable to the current time you can use the script call:

$game_variables[]=(variable id, GameTime::hour?) to set variable id to the hour

$game_variables[]=(variable id, GameTime::minute?) to set variable id to the minute

$game_variables[]=(variable id, $game_time) to set variable id to the minute of the day (range of 0-1440)

To change time with a variable? Just as complimicated! Script calls:

GameTime::set($game_variables[](variable id)) to set time to the number of the variable, in minutes

GameTime::change($game_variables[](variable id)) to increment time in minutes by the variable (available in the most recent version only)

As for the Khas Awesome Lighting Effects business, that's a pretty fancy script! And no not compatible straight off the bat.

But here, if you put this at the end of my script, or in a new block anywhere below it, you can achieve that... to some degree.

Might have to edit tones a bit... I suggest more blue. Everyone likes blue.

Code:
module GameTime
  def self.init
	$game_time = 0
	$game_time_surface = $game_map.effect_surface
  end
	def self.tint(tint = 60)
	if USE_TINT != true then return end
	for i in NOTINTMAPS
	  if $game_map.map_id == i
		$game_map.effect_surface.change_color(0,10,10,10,25)
		return
	  end
	end
	if SceneManager::scene_is?(Scene_Map) then else return end
	case $game_time
	when PRESUNRISE_TIME .. SUNRISE_TIME
	  $game_map.effect_surface.change_color(tint,PRESUNRISE_TONE.red,PRESUNRISE_TONE.green,PRESUNRISE_TONE.blue,PRESUNRISE_TONE.gray)
	when SUNRISE_TIME .. NOONSTART_TIME
	  $game_map.effect_surface.change_color(tint,SUNRISE_TONE.red,SUNRISE_TONE.green,SUNRISE_TONE.blue,SUNRISE_TONE.gray)
	when NOONSTART_TIME .. NOONEND_TIME
	  $game_map.effect_surface.change_color(tint,NOONSTART_TONE.red,NOONSTART_TONE.green,NOONSTART_TONE.blue,NOONSTART_TONE.gray)
	when NOONEND_TIME .. PRESUNSET_TIME
	  $game_map.effect_surface.change_color(tint,NOONEND_TONE.red,NOONEND_TONE.green,NOONEND_TONE.blue,NOONEND_TONE.gray)
	when PRESUNSET_TIME .. SUNSET_TIME
	  $game_map.effect_surface.change_color(tint,PRESUNSET_TONE.red,PRESUNSET_TONE.green,PRESUNSET_TONE.blue,PRESUNSET_TONE.gray)
	when SUNSET_TIME .. 1440
	  $game_map.effect_surface.change_color(tint,SUNSET_TONE.red,SUNSET_TONE.green,SUNSET_TONE.blue,SUNSET_TONE.gray)
	when 0 .. MIDNIGHT_TIME
	  $game_map.effect_surface.change_color(tint,SUNSET_TONE.red,SUNSET_TONE.green,SUNSET_TONE.blue,SUNSET_TONE.gray)
	when MIDNIGHT_TIME .. PRESUNRISE_TIME
	  $game_map.effect_surface.change_color(tint,MIDNIGHT_TONE.red,MIDNIGHT_TONE.green,MIDNIGHT_TONE.blue,MIDNIGHT_TONE.gray)
	end
  end
end
 
Last edited by a moderator:

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Oh quite simple, they are there! When making a conditional branch go to the script option and you would use some functions there.

Examples! Yes! Say you want something to only occur at 4am, then in the script option you'd put: GameTime::hour? == 4

However if you want a range like that shop, little more complicated but still doable! You'd put: GameTime::hour? >= 9 and GameTime::hour? < 17

That puts it at only doing what's within the conditional branch if the time is between 9am and 5pm! (It uses a 24 hour clock, gotta remember)

Second Edit: Yes there was a way to change the clock time by a specified amount! But a bit of a runaround and complicated so instead I just

added a function for that, grab the new version. The function is GameTime::change(time)
Thanks again, every is working perfectly :) .

FYI I dont know if theres a better way but what I did was.

Event1- Page1 Condition branch time =24 then switch 1 on. (parallel process)

Page2 Display text "Im a shady character" (with graphic and all)

Event2 - Parallel Process, (somewhere in the corner) Condition GameTime::hour? >= 24 and GameTime::hour? < 4 . ELSE Turn switch 1 off.

Hope that makes sense, it does for me and it works.
 

Warpmind

Twisted Genius
Veteran
Joined
Mar 13, 2012
Messages
936
Reaction score
578
First Language
Norwegian
Primarily Uses
Sweet... Now I wonder, can that clock conform to "real world" time, as well? I mean, there's a diabolical little imp in the back of my head suggesting to arrange matters so that when you play at night, the game is enjoying the dark of night, and all sorts of unsavory people and creatures stalk the streets and forests, while if you play during the daytime, shops are open and so forth and so on... which would mean potentially higher replay value to catch those hours you missed on the first playthrough...

Also, a realtime battle system with the clock ticking could lead to some VERY interesting fights... "Keep the vampire lord busy a little longer - sunrise is in a mere three minutes!" :D
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
Sweet... Now I wonder, can that clock conform to "real world" time, as well? I mean, there's a diabolical little imp in the back of my head suggesting to arrange matters so that when you play at night, the game is enjoying the dark of night, and all sorts of unsavory people and creatures stalk the streets and forests, while if you play during the daytime, shops are open and so forth and so on... which would mean potentially higher replay value to catch those hours you missed on the first playthrough...

Also, a realtime battle system with the clock ticking could lead to some VERY interesting fights... "Keep the vampire lord busy a little longer - sunrise is in a mere three minutes!" :D
I've already made a real time uh.. thingy! Basic Real Time (System Time)

It doesn't have the tints or the clock though :(
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
As for the Khas Awesome Lighting Effects business, that's a pretty fancy script! And no not compatible.

But here, if you put this at the end of my script, or in a new block anywhere below it, you can achieve that... to some degree.

Might have to edit tones a bit... I suggest more blue. Everyone likes blue.

Code:
module GameTime
  def self.init
	$game_time = 0
	$game_time_surface = $game_map.effect_surface
  end
	def self.tint(tint = 60)
	if USE_TINT != true then return end
	for i in NOTINTMAPS
	  if $game_map.map_id == i
		$game_map.effect_surface.change_color(0,10,10,10,25)
		return
	  end
	end
	if SceneManager::scene_is?(Scene_Map) then else return end
	case $game_time
	when PRESUNRISE_TIME .. SUNRISE_TIME
	  $game_map.effect_surface.change_color(tint,PRESUNRISE_TONE.red,PRESUNRISE_TONE.green,PRESUNRISE_TONE.blue,PRESUNRISE_TONE.gray)
	when SUNRISE_TIME .. NOONSTART_TIME
	  $game_map.effect_surface.change_color(tint,SUNRISE_TONE.red,SUNRISE_TONE.green,SUNRISE_TONE.blue,SUNRISE_TONE.gray)
	when NOONSTART_TIME .. NOONEND_TIME
	  $game_map.effect_surface.change_color(tint,NOONSTART_TONE.red,NOONSTART_TONE.green,NOONSTART_TONE.blue,NOONSTART_TONE.gray)
	when NOONEND_TIME .. PRESUNSET_TIME
	  $game_map.effect_surface.change_color(tint,NOONEND_TONE.red,NOONEND_TONE.green,NOONEND_TONE.blue,NOONEND_TONE.gray)
	when PRESUNSET_TIME .. SUNSET_TIME
	  $game_map.effect_surface.change_color(tint,PRESUNSET_TONE.red,PRESUNSET_TONE.green,PRESUNSET_TONE.blue,PRESUNSET_TONE.gray)
	when SUNSET_TIME .. 1440
	  $game_map.effect_surface.change_color(tint,SUNSET_TONE.red,SUNSET_TONE.green,SUNSET_TONE.blue,SUNSET_TONE.gray)
	when 0 .. MIDNIGHT_TIME
	  $game_map.effect_surface.change_color(tint,SUNSET_TONE.red,SUNSET_TONE.green,SUNSET_TONE.blue,SUNSET_TONE.gray)
	when MIDNIGHT_TIME .. PRESUNRISE_TIME
	  $game_map.effect_surface.change_color(tint,MIDNIGHT_TONE.red,MIDNIGHT_TONE.green,MIDNIGHT_TONE.blue,MIDNIGHT_TONE.gray)
	end
  end
end
I too am looking for lighting effects, I tried using KHAS but it requires the screen to be too dark and lags the game. Kylock Autolight would be perfect if it was for ACE.

Anyways I don't understand I added your "spoiler" new script at the end of you day and night one, it gave me an error, I added it in a new script block and it still gave me an error! I want to see how this looks :(
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
I too am looking for lighting effects, I tried using KHAS but it requires the screen to be too dark and lags the game. Kylock Autolight would be perfect if it was for ACE.

Anyways I don't understand I added your "spoiler" new script at the end of you day and night one, it gave me an error, I added it in a new script block and it still gave me an error! I want to see how this looks :(
Well, that's not right! Let's figure this out.

What's the error?
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Script .. Line 29:NoMethodError occurred.

undefined method 'effect_surface' for # <Game_Map:0x85b6064>

What does that script even do? It looks like it would darken the screen?
 
Last edited by a moderator:

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
Oh, hehehe. That blurb is to make my script work 'with' Khas Awesome Lighting Effects.

I suppose I could've been more clear in that. It'll error without it installed.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Oh, hehehe. That blurb is to make my script work 'with' Khas Awesome Lighting Effects.

I suppose I could've been more clear in that. It'll error without it installed.
Oh lol! I had KHAS, it worked fine before with your script for me, I just didn't like it because it made your night so much darker and it lagged.
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
Oh lol! I had KHAS, it worked fine before with your script for me, I just didn't like it because it made your night so much darker and it lagged.
Yah, it would conflict with extra tones and darker blippity blahs. I think that's what the extra script was about... with a recommendation with lighter tones.

The lag however I don't know about!
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Im working with someone right now to fix Kylock's Autolight on Ace, because in my opinion this is the best looking and easiest script. If you want if he gets it working 100% (currently have 1 area, the lighting wont show when the clock hits 6pm and your hero is on another map then zone into the map with lighting) I could send you the script if you wanted an addon? Assuming he gives permission, since he did all the work im just finding the errors lol.
 

Latest Threads

Latest Profile Posts

A good way to practice writing is to write "flash fiction"; very short stories. Link
Dam, does the night get to me, I sound and look like a monster. Its 3:54 am right now...I need sleep...or...coffee.
It has nothing to do with my project, but I'm in love with voxels
If you feel like your story isn't that great, just look at final fantasy.

Forum statistics

Threads
110,484
Messages
1,053,639
Members
143,576
Latest member
hsytrggfsdb
Top