RMParadise

It seems you either have yet to login or are not a member of RMP. If you are not yet a member, please feel free to sign up so that you can unlock every feature our forums have to offer. If you have yet to login, please do so soon.

Join the forum, it's quick and easy

RMParadise

It seems you either have yet to login or are not a member of RMP. If you are not yet a member, please feel free to sign up so that you can unlock every feature our forums have to offer. If you have yet to login, please do so soon.

RMParadise

Would you like to react to this message? Create an account in a few clicks or log in to continue.

A Paradise for RPGMakers.

Welcome everyone to RMP, your very own RPGMaker Paradise.
If you are reading this, that means that you are one of the select few who have been invited to experience our site as a Beta User.
Being a Beta User only requires that you report any bugs and/or problems upon finding them.
You get the chance to have free roam over the boards before they are public and are further up in line for promotions (which will be happening very soon, so stay on your best behavior).
Check out the thread for the RMP Beta Contest. Lets get some new content rolling.
Chat
Back to Top

3 posters

    Basic Game Time + Night/Day

    Vlue
    Vlue
    I'm a new member :)
    I'm a new member :)


    Registered on Registered on : 2012-05-28
    Posts Posts : 30
    Rep. Points Rep. Points : 13

    Basic Game Time + Night/Day Empty Basic Game Time + Night/Day

    Post by Vlue Mon May 28, 2012 10:35 pm

    Basic Game Time + Night/Day v1.5
    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
    Basic Game Time + Night/Day GameTime

    How to Use
    Plug and play and customize if needed

    Script:
    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 = :SHIFT

    module GameTime
      #---Game Time Details---#
      #Number of frames in a game minute, 60 frames = 1 second
      TIME_COUNT  = 6
      #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 SceneManager::scene_is?(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 SceneManager::scene_is?(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 SceneManager::scene_is?(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)
    SceneManager.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

    module DataManager
      class << self
      alias gametime_msc make_save_contents
      alias gametime_esc extract_save_contents
      end
      def self.make_save_contents
    contents = gametime_msc
    contents[:gametime] = $game_time
    contents
      end
      def self.extract_save_contents(contents)
    gametime_esc(contents)
    $game_time = contents[:gametime]
      end
    end


    class Scene_Map < Scene_Base
      alias gametime_post_transfer post_transfer
      alias gametime_create_all_windows create_all_windows
      alias gametime_update_map update
      def post_transfer
    GameTime::tint(0)
    gametime_post_transfer
      end
      def create_all_windows
    gametime_create_all_windows
    @gametimeclock = GameTime::Window_Clock.new if USE_CLOCK
      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

    Pastebin link: To come when I can post links

    FAQ
    There was some.. I forgot though.

    Credit and Thanks
    - By V.M.
    - Free to use in any project with credit given

    Author's Notes
    Hopefully nothing explodes
    Woot, spoilers with titles
    Testing posting of scripts with this one

    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
    DawningStar
    DawningStar
    I'm a new member :)
    I'm a new member :)


    Registered on Registered on : 2012-05-29
    Posts Posts : 65
    Rep. Points Rep. Points : 9

    Basic Game Time + Night/Day Empty Re: Basic Game Time + Night/Day

    Post by DawningStar Tue May 29, 2012 1:47 pm

    Quick question! It looks great but I does it work with RPG maker VX Ace as well?

    * I have no idea wether or not those scripts are compatible with each other! >.< *
    Vlue
    Vlue
    I'm a new member :)
    I'm a new member :)


    Registered on Registered on : 2012-05-28
    Posts Posts : 30
    Rep. Points Rep. Points : 13

    Basic Game Time + Night/Day Empty Re: Basic Game Time + Night/Day

    Post by Vlue Tue May 29, 2012 5:59 pm

    DawningStar wrote:Quick question! It looks great but I does it work with RPG maker VX Ace as well?

    * I have no idea wether or not those scripts are compatible with each other! >.< *

    This one is for Ace!
    As a general rule, RGSS3 is Ace, RGSS2 is VX, and RGSS is XP
    DawningStar
    DawningStar
    I'm a new member :)
    I'm a new member :)


    Registered on Registered on : 2012-05-29
    Posts Posts : 65
    Rep. Points Rep. Points : 9

    Basic Game Time + Night/Day Empty Re: Basic Game Time + Night/Day

    Post by DawningStar Tue May 29, 2012 6:19 pm

    Ahh, Thank you... I had wondered that for a little bit now!

    I do like ace much more than VX anyways!

    Added it to my script folder!
    Hyde
    Hyde
    Administrator
    Administrator


    Registered on Registered on : 2012-05-18
    Posts Posts : 101
    Rep. Points Rep. Points : 6

    Basic Game Time + Night/Day Empty Re: Basic Game Time + Night/Day

    Post by Hyde Tue May 29, 2012 6:20 pm

    Oh, well... I guess I should have had a notice on what RGSS versions went with what. I will fix that so everyone knows.

    Anyways, great script. I have always been a huge fan of RGSS time scripts and this one just works so well. Im not sure if you are accepting any ideas/suggestions for this though, but I have some ideas floating around if you may want to take a look at them.

    Either way, thank you for such a great contribution to our site.
    Vlue
    Vlue
    I'm a new member :)
    I'm a new member :)


    Registered on Registered on : 2012-05-28
    Posts Posts : 30
    Rep. Points Rep. Points : 13

    Basic Game Time + Night/Day Empty Re: Basic Game Time + Night/Day

    Post by Vlue Tue May 29, 2012 7:25 pm

    Anytime, I'm sure I'll post my other ones eventually...

    I'll always listen to ideas and suggestions, no harm in throwing them out there.

    Sponsored content


    Basic Game Time + Night/Day Empty Re: Basic Game Time + Night/Day

    Post by Sponsored content


      Current date/time is Wed May 15, 2024 11:17 pm