• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Realtime + Tint Screen

Blizzy

me = Scripter.new("Noob")
492
Posts
19
Years
  • i know this isn't a toturial,
    but i don't know where to post it else.

    paste this above main,
    and edit the tones / durations to whatever you want.

    Code:
    module Realtime
      #-------------------------------------------
      # * Object Initialization
      #-------------------------------------------
      def self.initialize
        # integers
        @time       = Time.now
        @second     = @time.sec
        @minute     = @time.min
        @hour       = @time.hour
        @day        = @time.day
        @week       = @time.strftime("%W").to_i
        @month      = @time.month
        @year       = @time.year
        # strings
        @dayame     = @time.strftime("%A")
        @monthname  = @time.strftime("%B")
        @timezone   = @time.strftime("%Z")
        @meridian   = @time.strftime("%p")
      end
      
      #-------------------------------------------
      # * Second ( 0...59 )
      #-------------------------------------------
      def self.second
        return @second
      end
      #-------------------------------------------
      # * Minute ( 0...59 )
      #-------------------------------------------
      def self.minute
        return @minute
      end
      #-------------------------------------------
      # * Hour ( 0...24 )
      #-------------------------------------------
      def self.hour
        return @hour
      end
      #-------------------------------------------
      # * Day ( 1...366 )
      #------------------------------------------
      def self.day
        return @day
      end
      #-------------------------------------------
      # * Week ( 0...53 )
      #-------------------------------------------
      def self.week
        return @week
      end
      #-------------------------------------------
      # * Month ( 1...12 )
      #-------------------------------------------
      def self.month
        return @month
      end
      #-------------------------------------------
      # * Year ( current year )
      #-------------------------------------------
      def self.year
        return @year 
      end
      
      #-------------------------------------------
      # * Day Name ( Monday...Sunday )
      #------------------------------------------
      def self.dayname
        return @dayname.capitalize!
      end
      #-------------------------------------------
      # * Month Name ( January...December )
      #-------------------------------------------
      def self.monthname
        return @monthname.capitalize!
      end
      #-------------------------------------------
      # * Timezone ( GTM / CST )
      #-------------------------------------------
      def self.timezone
        return @timezone
      end
      #-------------------------------------------
      # * Meridian ( AM / PM )
      #-------------------------------------------
      def self.meridian
        return @meridian
      end
      #-------------------------------------------
      # * Now
      #-------------------------------------------
      def self.now
        return @time
      end
      
      #-------------------------------------------
      # * Time Update
      #-------------------------------------------
      def self.update
        # integers
        @time       = Time.now
        @second     = @time.sec
        @minute     = @time.min
        @hour       = @time.hour
        @day        = @time.day
        @week       = @time.strftime("%W").to_i
        @month      = @time.month
        @year       = @time.year
        # strings
        @dayame     = @time.strftime("%A")
        @monthname  = @time.strftime("%B")
        @timezone   = @time.strftime("%Z")
        @meridian   = @time.strftime("%p")
        
        tint_screen
      end
      
      #-------------------------------------------
      # * Tint screen
      #-------------------------------------------
      def self.tint_screen
        if !$scene.is_a?(Scene_Map)
          @tone = $game_screen.tone
          return
        end
        if $scene.is_a?(Scene_Map)
          # added.
          # tint screen only works if map has '*' in the name
          if !$game_map.name.include?("*")
            @tone = Tone.new(0,0,0,0)
            @duration = 0
            $game_screen.start_tone_change(@tone, duration)
            return
          end
    
          # change tone and duration here depending on times
          # tone     : screen tone
          # duration : duration of tone change
          if @hour >= 0
            tone = Tone.new(-187, -119, -17, 68)
            duration = 600
          end
          if @hour >= 5
            tone = Tone.new(17, -51, -102, 0)
            duration = 600
          end
          if @hour >= 10
            tone = Tone.new(0, 0, 0, 0)
            duration = 600
          end
          if @hour >= 15
            tone = Tone.new(-68, -136, -34, 0)
            duration = 600
          end
          if @hour >= 20
            tone = Tone.new(-187, -119, -17, 68)
            duration = 600
          end
          @tone = tone
          $game_screen.start_tone_change(@tone, duration)
        end
      end
    end
    
    module Graphics
      class << self
        unless @reboot_fix == 1
          alias realtime_update update
          @reboot_fix = 1
        end
        
        def update
          Realtime.update if $game_screen != nil
          realtime_update
        end
      end
    end
    
    class Game_Map
      def name
        $map_infos = load_data("Data/MapInfos.rxdata")
        return $map_infos[@map_id].name
      end
    end
     
    Last edited:

    tdata

    Pokemon GX
    154
    Posts
    18
    Years
    • Seen Oct 2, 2009
    I would add a way to disable it while in a building.
     

    Blizzy

    me = Scripter.new("Noob")
    492
    Posts
    19
    Years
  • well, you can easy do that :O
    this makes it only appear in the maps with * in the name
    Code:
    if $game_map.name.include?("*")
    # code block
    end
     

    tdata

    Pokemon GX
    154
    Posts
    18
    Years
    • Seen Oct 2, 2009
    lol, undefined function. I'm using a switch.
     

    Blizzy

    me = Scripter.new("Noob")
    492
    Posts
    19
    Years
  • oh yeah, i forgot that.
    there should be a function on rmxp.net forums,
    but i can't find it at the moment.
     
    1,279
    Posts
    20
    Years
  • What about the windows of houses.. Is there some way to make them illuminate in darkness? (Assuming the window's background is transparent)
    Anyway great tutorial blizzy ;) Excellent work as always. I thought about trying this once, but it was just too long to script. Yours is nice, short and straight to the point :)
     
    1
    Posts
    18
    Years
    • Seen Apr 28, 2011
    Is there a way to make a realtime switch for area teleports? In the game I'm working on I just have different areas for night and day, because that way there's nothing effecting the inside, I can light up the windows, and the NPCs are different at night as they are in the day...I just need the switch to make them work...
     

    tdata

    Pokemon GX
    154
    Posts
    18
    Years
    • Seen Oct 2, 2009
    You can do that by calling using the time part of the script.
     
    1,279
    Posts
    20
    Years
  • Yeah you could add some code to the script to turn on a switch if it night-time..
    It has been so long since I used rgss, so this won't be right at all but it has to be something like this:
    In the *Time update part, it needs to do this.
    if @hour>=18
    if game_switch.[0] = false
    game_switch.[0] == true
    end
    end
    The game switch will result true if the time is past 6pm.. You would have to do the actual code yourself..
     

    tdata

    Pokemon GX
    154
    Posts
    18
    Years
    • Seen Oct 2, 2009
    ^_^ Still doesn't work with the * . it has a problem with [@map_id] It says that [] is undefined...
     
    433
    Posts
    18
    Years
    • Age 34
    • Seen Apr 11, 2009
    can someone tell me how can i use this script? (can i use it in pkmn sapphire?)
     

    Space Guard

    Part-Time Avenger
    492
    Posts
    18
    Years
  • Criptexa said:
    can someone tell me how can i use this script? (can i use it in pkmn sapphire?)
    No you can't use this script in your Pokémon Sapphire Game.
    This script will only work on a game making program called RMXP.

    Anyway about your scrpit
    Well Done! I might attempt to use it in my new game
    You are one of the best RMXP scripters I have seen around
    But I've never used RMXP before so I am a complete nOOb!

    Well Done!
    SG06
     

    Shaneypoo17

    Elite Hacker
    358
    Posts
    18
    Years
    • Seen Apr 7, 2016
    this is Great! although it changes abit too quickly but that can easily be fixed ^^
     

    rebellee1187

    Just another programmer..
    69
    Posts
    19
    Years
  • I'm having the same problems. Actually, I'm having a whole host of them...

    1. Where do I paste this?
    2. My tint screen command doesn't work AT ALL in my version of the starter kit.
    3. How would I edit it *is a RMXP n00b*



    Thanks in advance for any help I may get...
     
    Back
    Top