Basic Game Time + Night/Day

Hi there,

I'm having a slight problem with your script (namely the little addon for use with KHAS Lighting) that I was hoping you could help me with.

If I start with my character indoors and it's night time, the indoor colouring is normal (which is good), but if I start outside, or move outside, then go back indoors, the colouring stays as it was outside (i.e. dark).

I've set the maps I want to stop being tinted: NOTINTMAPS = [2, 4, 5] - But it doesn't seem to work.

When I take out the code for use with the KHAS Lighting Script it works fine, any ideas?

Cheers.
Hi there,

I'm having a slight problem with your script (namely the little addon for use with KHAS Lighting) that I was hoping you could help me with.

If I start with my character indoors and it's night time, the indoor colouring is normal (which is good), but if I start outside, or move outside, then go back indoors, the colouring stays as it was outside (i.e. dark).

I've set the maps I want to stop being tinted: NOTINTMAPS = [2, 4, 5] - But it doesn't seem to work.

When I take out the code for use with the KHAS Lighting Script it works fine, any ideas?

Cheers.
Indeed, that is the case! Kinda weird...

This should work, use this blurb instead:

Spoiler
Code:
module GameTime
  def self.init
    $game_time = 0
    $game_time_surface = $game_map.effect_surface
    $game_time_pause_time = false
  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(tint,0,0,0,0)
        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
That works great!

Thanks for such a quick response.
Curious, can you script call to turn the time instantly to night? Example, player does X amount of sidequests, then at the end, time becomes night(eventing)? Then of course a script call being possible to make it instantly day?
Curious, can you script call to turn the time instantly to night? Example, player does X amount of sidequests, then at the end, time becomes night(eventing)? Then of course a script call being possible to make it instantly day?
Yup! Can use GameTime:😛ause_time(true) to stop time if need be, and GameTime::set(#) to set the time by the minute (night would be 0 and day would be about 720)
Thanks Vlue. One more, I know this may seem silly and I could probably just use a tint for this, but I feel i'd need it later in the game so why not. I was thinking I could use this first the first hour of play, then pause it for many many hours. Would there be any significant downside to this / would it remain paused throughout other maps?
No downside that comes to mind. It remains paused throughout other maps, until you unpause it.
Thanks, great work on the script. 🙂
Hey again,

I've noticed that if I try to tint my screen (say for a Dungeon map) it doesn't work. Could this be due to your Script and if it is, is there any work around?

Cheers.
Indeedily it would be!

For no other reason then world domination it takes complete control over tinting.

Nix that last part.

GameTime:😛ause_tint(true/false) pauses/unpauses the tint process and lets you tint as you will.
could you make the 1440 min/day into a customizable variable?
Not without a bit of work! It's a planned feature.
Hey Vlue I love the script but i'm having one problem. My game starts the player off in an interior map and the day/night affects that, which is fine, But when I go outside the home to an exterior map the tinting stops. It seems like the tinting works on every other map type. Is there a way to make it so the tinting works on all map types? Or maybe only on select map types? (Like it make it work on exterior and overworld but not interior for example)
Hey Vlue I love the script but i'm having one problem. My game starts the player off in an interior map and the day/night affects that, which is fine, But when I go outside the home to an exterior map the tinting stops. It seems like the tinting works on every other map type. Is there a way to make it so the tinting works on all map types? Or maybe only on select map types? (Like it make it work on exterior and overworld but not interior for example)
There's a constant variable marked NOTINTMAPS = []

You can put the id's of maps that are unaffected by the tint.

If that's what you're looking for.
There's a constant variable marked NOTINTMAPS = []

You can put the id's of maps that are unaffected by the tint.

If that's what you're looking for.
Wow, nevermind man lol. Yeah I didn't notice that in your script (before customized) NOTINTMAPS=[2]. It works perfect now thanks! and again awesome script! =D
Hello, thanks for the great script but i am having an issue with it not tinting my full screen.

I use #Basic Window Resizer v1.1, and i have it set to 840x620 and the far right side + ottom does not get tinted.

can i edit it to make the tinted area larger?

Also i included my indoor map, NOTINTMAPS = [003,006,007] and it still gets tinted, am i missing something?

Thanks for your time, im still learning it all.
Hello, thanks for the great script but i am having an issue with it not tinting my full screen.

I use #Basic Window Resizer v1.1, and i have it set to 840x620 and the far right side + ottom does not get tinted.

can i edit it to make the tinted area larger?

Also i included my indoor map, NOTINTMAPS = [003,006,007] and it still gets tinted, am i missing something?

Thanks for your time, im still learning it all.
Are you using Khas's lighting effects? Also have you used Graphics.resize_screen anywhere?

As for the NOTINTMAPS part, drop the 0's, it'd just be [3,6,7]
Are you using Khas's lighting effects? Also have you used Graphics.resize_screen anywhere?

As for the NOTINTMAPS part, drop the 0's, it'd just be [3,6,7]
Ok, i thought i had to include the 0's since it was in the map id, No i don't think i have "Khas's lighting effects".

As for the do i "Graphics.resize_screen anywhere?" i have it placed in # ** SceneManager

#-------------------------------------------------------------------------- # * Execute

#--------------------------------------------------------------------------

def self.run

DataManager.init

Audio.setup_midi if use_midi?

Graphics.resize_screen(840, 560)

Window_Resize.r(840, 560)

@scene = first_scene_class.new

@scene.main while @scene

end
And all i have running for scripts is:

  1. #Basic Window Resizer v1.1
  2. #Advanced Game Time + Night/Day
  3. # Shop Taxes V1.6 (VXA version)
  4. # XS - Popup Item
  5. # ** Ring Menu
  6. # GameOver with choices
  7. # ▼ Mithran Picture Bug Fix
  8. # ** Window_MapNamePlus
  9. # ** ItemColor
  10. # ¥ Yami Engine Ace - Overlay Mapping
  11. # +++ MOG - Animated Title A (v2.1) +++

# ¦ ReinoRPG HUD v0.6 - but i have to remove it, every time i pickup gold, it throws an error...

Update, hanks for the tip on removing the 0's it works now, just still not tinting my whole screen.

I think i messed it up because before i had on old day/night script in there. I will start a new project and see.
Hmm, hopefully that works. This script uses the built in tinting system, so it shouldn't not cover the entire screen, and Basic Window Resizer just stretches the graphics so it shouldn't cause any problems either. Graphics.resize_screen however does not, and also has a max of 640*480.
I fixed it, it was because i had Graphics.resize_screen(840, 560) in there, once i removed and just

used the Window_Resize.r(840, 560) only it started working fine thanks.

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