Basic Game Time + Night/Day

It couldn't hurt.
New problem here...

I don't know why but everytime I use "False" in the clock and then I press the toggle hide button it always give me error...

Something wrong? :huh:
New problem here...

I don't know why but everytime I use "False" in the clock and then I press the toggle hide button it always give me error...

Something wrong? :huh:
What a silly error by that Vlue fellow. Well I know why, it's because when you press the toggle button it's trying to hide a window that isn't there!

New version has been posted which fixes that little bug.
I was wondering if it was possible to temporarily disable the tint of the screen.

So that if you were to activate an event, it could change the tint of the screen until the event is over, then changes the tint back to what it should be depending on the time.
I was wondering if it was possible to temporarily disable the tint of the screen.

So that if you were to activate an event, it could change the tint of the screen until the event is over, then changes the tint back to what it should be depending on the time.
I'm quite certain it is now! Hint hint, nudge nudge.
Edit Edit: Silly me I figured it out!

Thanks as usual works like a champ!
I'm having problems with the NOTINTMAPS option. Whenever I add ID's (like, let's say, [006]) to the NOTINTMAPS section of the script, I receive this error when I get to the title screen.

TimeError.png

I kind of need to make sure certain maps aren't tinted, because it is otherwise weird, lol

How do I stop this from happening?

I've disabled the script for the time being until this is figured out, would love to use it though because this is currently the only time system I've found for Ace, lol
Gotta add them like this:

NOTINTMAPS = [1, 34, 54, 67, 122]

so forth..

If it still errors, let me know, I'll look into it
OH!!! Thanks for clarifying that, rofl, I would've never figured that one out on my own. I guess I suck, XD
Is there a way to prevent the Tinting of onscreen windows? such as the time clock?

I would also want to prevent it for my hp/mp/exp bar that I use for "Blasphemia ABS" if at all possible?

(BTW this is amazing and its what I've been looking for and it works awsome with Khans script!)
If it's tinting things that means their z isn't high enough! If you have some scripting know how you can run around shoving self.z = ## (Where ## is a number, I'm not sure how high it has to be... message windows are 200 and they don't get tinted) into the start functions of the windows and sprites that are being tinted that you don't want to be tinted.
This is great! Would it be possible to make a VX version? I know this won't work because of stuff like data manager.
This is great! Would it be possible to make a VX version? I know this won't work because of stuff like data manager.
Fairly easy:

Spoiler
Code:
#Basic Game Time + Night/Day
#----------#
#Features: Provides a series of functions to set and recall current game time
#		  as well customizable tints based on current game time to give the
#		  appearance of night and day.
#
#Usage:   Script calls:
#		   GameTime::minute?   - returns the current minute
#		   GameTime::hour?	 - returns the current hour
#		   GameTime::set(time) - sets the game time to time, in frames (max:1440)
#		   GameTime::change(time) - increments the game time! (can be negative)
#		   GameTime::pause_time(set) - stops time for events and stuff, true or false
#		   GameTime::pause_tint(set) - time runs, but tints do not update
#		   GameTime::clock(set) - sets whether clock is visible or not
#		
#Customization: Set below, in comments.
#
#Examples: GameTime::set(360)
#
#----------#
#-- Script by: V.M of D.T
#--- Free to use in any project with credit given

#---Game Clock---#
#USE_CLOCK to true to display game time clock
#CLOCK_POSITION for position of clock
#  1 = topleft, 2 = topright, 3 = bottomleft, 4 = bottomright
#CLOCK_TOGGLE is any input button available, see the INPUT help file for options
#------#
USE_CLOCK	   = true
CLOCK_POSITION  = 4
CLOCK_TOGGLE	= Input::SHIFT

module GameTime
  #---Game Time Details---#
  #Number of frames in a game minute, 60 frames = 1 second
  TIME_COUNT	  = 60
  #Sets whether to tint screen based on game time
  USE_TINT		= true

  #True to pause time while not in map or while during a message
  PAUSE_IN_COMBAT  = false
  PAUSE_NOT_IN_MAP = true
  PAUSE_IN_MESSAGE = true

  #Sets time frames of tints by minute count, one day is 1440 minutes
  # 0 = 12am, 360 = 6am, 720 = 12pm, 1080 = 6pm  etc...
  PRESUNRISE_TIME = 240
  SUNRISE_TIME	= 360
  NOONSTART_TIME  = 660
  NOONEND_TIME	= 900
  PRESUNSET_TIME  = 1080
  SUNSET_TIME	 = 1260
  MIDNIGHT_TIME   = 60  #Must be greater than 0

  #Sets custome tints
  PRESUNRISE_TONE = Tone.new(-75,-75,0,50)
  SUNRISE_TONE	= Tone.new(0,0,0,0)
  NOONSTART_TONE  = Tone.new(45,45,0,-25)
  NOONEND_TONE	= Tone.new(0,0,0,0)
  PRESUNSET_TONE  = Tone.new(-50,-50,0,25)
  SUNSET_TONE	 = Tone.new(-75,-100,0,75)
  MIDNIGHT_TONE   = Tone.new(-125,-125,0,125)

  #Include the ids of any maps not to be tinted based on time
  # Usually reserved for indoor maps
  NOTINTMAPS = [2]
  #---END---#

  def self.init
	$game_time = 0
	$game_time_pause_time = false
	$game_time_pause_tint = false
  end
  def self.update
	if $game_time_pause_time then return else end
	case $scene.is_a?(Scene_Map)
	when true
	  if $game_message.visible == true && PAUSE_IN_MESSAGE then else
	  $game_time += 1 if Graphics.frame_count % TIME_COUNT == 0 end
	when false
	  if $scene.is_a?(Scene_Battle) && PAUSE_IN_COMBAT != true
	  $game_time += 1 if Graphics.frame_count % TIME_COUNT == 0 end
	end
	if $game_time == 1440 then $game_time = 0 end
	GameTime::tint if $game_time_pause_tint != true
  end
  def self.hour?
	return $game_time / 60
  end
  def self.minute?
	return $game_time % 60
  end
  def self.time?
	meri = "AM"
	hour = GameTime::hour?
	minute = GameTime::minute?
	if hour > 11 then meri = "PM" end
	if hour == 0 then hour = 12; meri = "AM" end
	if hour > 12 then hour -= 12 end
	if hour < 10 then hour = " " + hour.to_s else hour.to_s end
	if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
	return hour.to_s + ":" + minute.to_s + " " + meri
  end
  def self.set(number)
	$game_time = number if number < 1440
	GameTime::tint(0)
  end
  def self.change(number)
	$game_time += number
	$game_time -= 1440 if $game_time > 1440
	$game_time += 1440 if $game_time < 0
	GameTime::tint(0)
  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.screen.start_tone_change(Tone.new(0,0,0,0),0)
		return
	  end
	end
	if $scene.is_a?(Scene_Map) then else return end
	case $game_time
	when PRESUNRISE_TIME .. SUNRISE_TIME
	  $game_map.screen.start_tone_change(PRESUNRISE_TONE, tint)
	when SUNRISE_TIME .. NOONSTART_TIME
	  $game_map.screen.start_tone_change(SUNRISE_TONE, tint)
	when NOONSTART_TIME .. NOONEND_TIME
	  $game_map.screen.start_tone_change(NOONSTART_TONE, tint)
	when NOONEND_TIME .. PRESUNSET_TIME
	  $game_map.screen.start_tone_change(NOONEND_TONE, tint)
	when PRESUNSET_TIME .. SUNSET_TIME
	  $game_map.screen.start_tone_change(PRESUNSET_TONE, tint)
	when SUNSET_TIME .. 1440
	  $game_map.screen.start_tone_change(SUNSET_TONE, tint)
	when 0 .. MIDNIGHT_TIME
	  $game_map.screen.start_tone_change(SUNSET_TONE, tint)
	when MIDNIGHT_TIME .. PRESUNRISE_TIME
	  $game_map.screen.start_tone_change(MIDNIGHT_TONE, tint)
	end
  end
  def self.pause_time(set)
	$game_time_pause_time = set
  end
  def self.pause_tint(set)
	$game_time_pause_tint = set
  end
  def self.clock(set)
	$scene.clock_visible?(set)
  end

  class Window_Clock < Window_Base
	def initialize
	  case CLOCK_POSITION
	  when 1
		super(0,0,115,56)
	  when 2
		super(429,0,115,56)
	  when 3
		super(0,360,115,56)
	  when 4
		super(429,360,115,56)
	  end
	end
	def update
	  self.contents.clear
	  self.contents.draw_text(0,0,100,24,GameTime::time?)
	end
  end

end

class Scene_File
  alias gt_read_save_data read_save_data
  alias gt_write_save_data write_save_data
  def read_save_data(file)
	gt_read_save_data(file)
	$game_time		 = Marshal.load(file)
  end
  def write_save_data(file)
	gt_write_save_data(file)
	Marshal.dump($game_time,		 file)
  end
end

class Scene_Map < Scene_Base
  alias gametime_post_transfer perform_transition
  alias gametime_update_map update
  def perform_transition
	GameTime::tint(0)
	@gametimeclock = GameTime::Window_Clock.new if USE_CLOCK
	@gametimeclock.visible = false
	gametime_post_transfer
  end
  def update
	gametime_update_map
	@gametimeclock.update if @gametimeclock.nil? == false
	if Input.trigger?(CLOCK_TOGGLE) and @gametimeclock.nil? == false
	  @gametimeclock.visible ? @gametimeclock.visible = false : @gametimeclock.visible = true
	end
  end
  def clock_visible?(set)
	@gametimeclock.visible = set
  end
end

class Scene_Base
  alias gametime_update update
  def update
	gametime_update
	GameTime::update
  end
end

GameTime::init
Thanks!
i get an error (Line 176:NameError occurred. undefined method 'make_save_contents' for class 'Module')

can you help with this Vlue?

Untitled.png
i get an error (Line 176:NameError occurred. undefined method 'make_save_contents' for class 'Module')

can you help with this Vlue?
The script is for vx ace and you have vx there. Delete the GameTime script and use the one I put in a spoiler just a couple posts up (Post #33)
The script is for vx ace and you have vx there. Delete the GameTime script and use the one I put in a spoiler just a couple posts up (Post #33)
i got an other error from that one (line 89 NoMethodError occurred undefined method '/' for nil;NilClass)
i got an other error from that one (line 89 NoMethodError occurred undefined method '/' for nil;NilClass)
Only way I could see that happening is if you missed copying the very last line from the script. Make sure you have that. It'll say GameTime::init at the bottom if you do have it.
Only way I could see that happening is if you missed copying the very last line from the script. Make sure you have that. It'll say GameTime::init at the bottom if you do have it.
wow i feel stupid now 🙁 thank you for helping me Vlue 😀
Cool... I created one like this on VX, but via a common event only, XD...

nice to see a full script for it on Ace... I would most probably use this once I start using ace which is after I finish the current project I have on VX...

Original thread: https://forums.rpgmakerweb.com/threads/basic-game-time-night-day.1079/