Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[RMXP]Time System Help - Is there a way to do this?

I'm using the ATS by NearFantastica
http://www.creationasylum.net/forum/ind ... 44&hl=time
I can't seem to contact him for support, so I thought I'd ask here.
I just have one question: is there a way to set the clock to a specific set time?
I know how to check the time, day, week, months, etc .. and how to set periods of time forward or backwards, but there's a certain event in my game where I need to set a certain time because I have no control over what exact moment they decide to sleep. So instead of making a conditional variable for every possible outcome, it'd be easier to simply SET the time rather than ADD.
The script commands used are like:
$ats.sec(10) - will add 10 seconds to the current time
$ats.hours(-10) - will subtract 10 hours from the current time
He also includes other commands which I'm not sure are of any use but I tried toying around with them but couldn't quite get my desired effect.

The instructions were:
$ats.date
$ats.clock

Returns the date as a string
Returns the clock as a string

I really have no idea what to do with those commands, but I was thinking one of those would help. Could I use one of those commands to do something like,
$ats.clock(settime) ?

I understand my request is somewhat vague, but I'd REALLY appreciate any help.

Thank you very much.

Here is the script I'm using since the DL link seems to be down.

Code:
#===================================================

# ■ ATS - Advanced Time System

#===================================================

# Rewiten by Near Fantastica

# Date: 23.07.05

# Version: 1

#

# Written by Dubealex

# Date: 26.11.04

#

# Thanks to Satana_81 for the test tilesets

#===================================================

 

#===================================================

# ▼ CLASS Advanced_Time Begins

#===================================================

class Advanced_Time

  

    attr_reader :define_start_sec

    attr_reader :weather_type

    attr_reader :weather_strength

 

   def initialize

     @weather_pattern = []

     @cycle_period=[]

     @tint_period=[]

     @cycle_season=[]

     @name_period=[]

     @name_season=[]

     @name_month=[]

     @name_day=[]

     @start_clock=[]

     @start_date=[]

 

=begin -----------------------------------------------------------------------------------------------------

      ■ Advanced Time System Settings:

      ---------------------------------------------------------------------------------------------------------

      ▼ Day Night System Transitioning :

      

      The DNS is built in to the time system and therefore any map you want to have the DNS

      active on place a "*" in the name of the map.

      ---------------------------------------------------------------------------------------------------------

      ▼ Method of Season Transitioning :

       

      ●  Titleset Transitioning = The tileset its replaced

          When Titleset Transitioning is set the script will pull the tileset and autotiles used 

          set to the season ID. For exmaple "Plains 1" for tileset or "Water 1" for autotiles. 

          The script will then automaticly change the 1 to the season ID which will load the 

          new tileset. Maps that the developer wishes to have the tileset changing place 

          a "~" in the name. 

          

      ●  Map Transitioning = The Map is replaced

          When Map Transitioning is set the script changes the whole map. It will transport the

          player to the same x,y on a map with the same name and the matching season ID.

          For example "Town [1]". The script will then automaticaly change the 1 to the 

          season ID which will load the new map. Maps that the developer wishes to have 

          the map changing place "[Season ID]"  in the map name where Season ID is the ID 

          of the season of that map.

=end #----------------------------------------------------------------------------------------------------

 

=begin -----------------------------------------------------------------------------------------------------

      ■ Advanced Weather System Settings:

      ---------------------------------------------------------------------------------------------------------

      ▼ Weather Patterns :

      

      With the Advanced Weather System by Ccoa the Advanced Time System and keep track

      and change weather depending on season. The flag $aws must be set true if the weather

      script is to be used.

      

      1 - rain                    5 - rain with thunder and lightning

      2 - storm                 6 - falling leaves (autumn)

      3 - snow                  7 - blowing leaves (autumn)

      4 - hail                    8 - swirling leaves (autumn)

      

      The script randomly picks bettween having weather and no weather.

      Then the script randomly picks the weather if there is going to be weather.

      If the same weather is added more then once it will add to % chnage that weather 

      will be picked. If the same weather is picked again its power is inceased. The

      range of power is 10 - 40. @weather_cycle is the % of weather for the game.

      0 = very little and 10 = a lot of weather. @weather_period is the amount 

      of time in mintues till the next weather cycle range  = 1-59. @bgs_control is 

      a flag that tells the script to inculde BGS with Dynamic Weather 

=end #----------------------------------------------------------------------------------------------------

 

      @aws = false

      @bgs_control = false

      @active_weather = false

      @weather_type = 0

      @weather_strength = 0

      @weather_cycle = 5

      @weather_period = 30

      @weather_pattern[1] = [3]

      @weather_pattern[2] = [1,1,2,3]

      @weather_pattern[3] = [1,1,2,5]

      @weather_pattern[4] = [1,2,4,5]

      @weather_pattern[5] = [1,1,2,6]

      @weather_pattern[5] = [1,1,3,7,8]

 

=begin -----------------------------------------------------------------------------------------------------

      ■ ATS Settings Configuration:

      ---------------------------------------------------------------------------------------------------------

      ▼ LENGTH AND SPEED OF TIME:

       

      Those variables defines the speed and length of every aspect of the ATS.

      @time_speed define how fast a seconds last. Setting it to 0 makes a real time system.

      Below 0 is a slower time than normal, and higher than 0 will accelerate the time.

      The length value are used to customize the length of every component of the ATS.

      Remember that since it is the SPEED setting that defines how fast the time goes,

      you don't have to say that a minute last 30 sec to make it faster. You can leave it

      as real-time, and just accelerate the length of a second with @time_speed !

=end #----------------------------------------------------------------------------------------------------

      

      @ats_time_speed = 40             # 0 is a Real Time System

      @minutes_length = 60               # Seconds

      @hour_length = 60                    # Minutes

      @day_length = 24                     # Hours

      @week_length = 7                     # Days

      @month_length = 30                # Days

      @year_length = 12                   # Months

      @decade_length = 10                # Years

      @century_length = 100              # Years

      @millenium_length = 1000        # Years

      

=begin ----------------------------------------------------------------------------------------------------

       ▼ GAME DEFAULT START-UP VALUES:

      

       Here you can define the default start-up values for each components. The data

       you enter here will be taken into consideration at each new game started. So if you want

       your game to begin at 2:12 pm, you can adjust all that in here. You can also set some

       basic default options you have, like trigger the AM/PM time format ON/OFF.

       You don't have to set the start-up season and period, since it will be set automatically

       with the date and the clock.

=end #-----------------------------------------------------------------------------------------------------

      

    @clock_mode = 2               # 1= 24 hours format / 2= AM/PM flag format

     @start_clock   = [21,50,10]     # [hour, min, sec] -> Write in 24 hours format.

     @start_date    = [2,13,2011] # [month, day, year]  

      

      

=begin -----------------------------------------------------------------------------------------------------

       ▼ ATS PERIODS CYCLE SETTINGS:

      

      An ATS Period works just as my old NDS Period.

      Periods defines a 24 hours loop - Example: Morning>Day>Evening>Night

      Here you can defines what is the cycle (in hours) for each periods.

      You can have as much period as you desire, I created the 4 main one, as shown

      in the example above. To add period, simply copy a line and replace the ID of the

      period by the next in line. DO NOT skip numbers.

      Syntax: @cycle_period[ID] --> Don't use ID0. (You can name them later).

      Example: @cycle_period[1] = (5..11) Will make the period ID#1  begins at 5am

      and ends at 11am. Use the 24 hours clock format to defines the period length.

=end #-----------------------------------------------------------------------------------------------------

      

      @cycle_period[1] = (5..11)  #Defined as (start_hour..end_hour)

      @cycle_period[2] = (12..18)

      @cycle_period[3] = (19..22)

      @cycle_period[4] = (23..24)

      @cycle_period[5] = (0..4)

 

=begin ----------------------------------------------------------------------------------------------------

      ▼ ATS PERIODS COLOR TONE (TINT) SETTINGS:

      

      Here you can define what will be the color tone used for each periods.

      Use the same period ID defined above. Example: @tint_period[1] is the tint used

      with the @cycle_period[1] settings.

      Syntax: @tint_period[1] = [red, green, blue, gray, transition_time]  

      To know the number you want for your tint, simply opens a RPG Maker Project, and

      create an event, choose "Tint Screen" and test the values you want, then enter them

      in here.

=end #-----------------------------------------------------------------------------------------------------

      

      @tint_period[1] = [0, -40, -60, 50, 600]

      @tint_period[2] = [0, 0, 0, 0, 600]

      @tint_period[3] = [-68, -85, -34, 120, 600]

      @tint_period[4] = [-150, -100, -50, 180, 600]  

      @tint_period[5] = [-95, -78, -44, 180, 600]

      

=begin -----------------------------------------------------------------------------------------------------

      ▼ SEASONS CYCLE SETTINGS:

      

      Here you can define how much time last every season. This is an "optional" feature.

      You can just leave it alone if you aren't using it. This work as the periods, but seasons

      are defined using months instead of hours. To know how it works, read the periods comments.

      Example: @cycle_season[1] = (6..8) Will make the season ID#1  begins on the

      6th month of the year, and end on the last day of the 8th month of the year.

=end #-----------------------------------------------------------------------------------------------------

       

      @cycle_season[1] = (1..2) #Defined as (start_month..end_month)

      @cycle_season[2] = (3..4)

      @cycle_season[3] = (5..6)

      @cycle_season[4] = (7..8)

      @cycle_season[5] = (9..10)

      @cycle_season[6] = (11..12)

      

      

=begin ----------------------------------------------------------------------------------------------------

      ▼ ATS COMPONENT'S NAMES SETTINGS:

      

      Here you can choose the name tagged to every relevant component of the ATS.

      The words you defined here will be used in window and menus in your game.

      It make it easy to configure and customize that way. You can also refer to those variables

      names if you need to access any component's names. That way, if you make a mistake or 

      want to change something in the middle of your development, you can easily do it.

      If you added/deleted periods/seasons, just adjust this section too. So if you created a season

      ID#6, you can copy a line from here and add the 6 where it belongs. (Between [ ])

      This is also were you define all your Months and Days name. It work the same way.

      @name_month[1] will refer to the first month of your year. By default, it's January.

=end #----------------------------------------------------------------------------------------------------

      

      @name_period[1] = "Morning"

      @name_period[2] = "Day"

      @name_period[3] = "Evening"

      @name_period[4] = "Night"

      @name_period[5] = "Night"

      

      @name_season[1] = "Winter"

      @name_season[2] = "Spring"

      @name_season[3] = "Summer"

      @name_season[4] = "Summer"

      @name_season[5] = "Autumn"

      @name_season[6] = "Autumn"

      

      @name_month[1]  = "January"

      @name_month[2]  = "February"

      @name_month[3]  = "March"

      @name_month[4]  = "April"

      @name_month[5]  = "May"

      @name_month[6]  = "June"

      @name_month[7]  = "July"

      @name_month[8]  = "August"

      @name_month[9]  = "September"

      @name_month[10]= "October"

      @name_month[11]= "November"

      @name_month[12]= "December"

      

      @name_day[1] = "Monday"

      @name_day[2] = "Tuesday"

      @name_day[3] = "Wednesday"

      @name_day[4] = "Thursday"

      @name_day[5] = "Friday"

      @name_day[6] = "Saturday"

      @name_day[7] = "Sunday"      

      

#--- ■ END OF SETTINGS (No Need To Edit Further)-------------------------------------------

           

      @speed_restore = 0

      if @ats_time_speed >= Graphics.frame_rate

         @ats_time_speed=Graphics.frame_rate-1

       end

      @year_length+=1 

      @month_length+=1

      if @start_clock[0] >= 12 : @am=false else @am=true end

      define_start_sec_in_hours= @start_clock[0] * @minutes_length * @hour_length

      define_start_sec_in_min= @start_clock[1] * @minutes_length

      @define_start_sec= define_start_sec_in_hours+define_start_sec_in_min+@start_clock[2] 

   end

 

# ■ WRITE ATTRIBUTE (Modify ATS Data) (No Need To Edit)----------------------------------  

  def sec(sec=0)

    @define_start_sec+=sec

  end

 

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

  def min(min=0)

    @define_start_sec+=min*@minutes_length

  end

 

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

  def hours(hours=0)

    @define_start_sec+=hours*@minutes_length*@hour_length

  end  

  

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

  def days(days=0)

    if days<0 : @rewind=true end

    @define_start_sec+=days*@minutes_length*@hour_length*@day_length

  end  

  

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

  def months(months=0)

     if months<0 : @rewind=true end

    @define_start_sec+=months*@minutes_length*@hour_length*@day_length*@month_length

  end 

  

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

  def speed(speed=0)

    @speed_restore = @ats_time_speed

    @ats_time_speed = speed

  end

 

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

  def speed_restore

    @ats_time_speed = @speed_restore

  end 

    

# ■ READ ATTRIBUTE (Fetch ATS Data) (No Need To Edit)-------------------------------------  

  def full_date

    day_name=@name_day[week_day_is]

    month_name=@name_month[months_is] 

    month_day=month_day_is

    year= total_years_is

    full_date= day_name + ", " + month_name + " " + month_day.to_s  + " " +  year.to_s

    return full_date

  end

 

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

  def speed_is

    return @ats_time_speed

  end 

  

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

   def total_sec_is

     ats_total_sec = (Graphics.frame_count / (Graphics.frame_rate-@ats_time_speed))+@define_start_sec

     return ats_total_sec

   end 

 

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

   def total_years_is

      total_years=(total_months_is / @year_length) + @start_date[2] 

     return total_years

   end 

 

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

   def total_months_is

     total_months=(total_days_is / @month_length) + @start_date[0] 

     return total_months

   end 

 

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

   def total_decades_is

     total_decades=total_years_is / @decade_length

     return total_decades

   end 

 

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

   def total_centuries_is

     total_centuries=total_years_is / @century_length

     return total_centuries

   end 

 

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

   def total_millenium_is

      total_millenium=total_years_is/@millenium_length

     return total_millenium

   end 

      

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

   def total_weeks_is

     total_weeks= total_days_is / @week_length

     return total_weeks

   end 

        

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

   def total_hours_is

     total_hours= total_sec_is / @minutes_length / @hour_length

     return total_hours

   end 

   

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

   def total_min_is

     total_min = total_sec_is / @minutes_length

     return total_min

   end   

   

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

   def date

     month=months_is

     month_day=month_day_is

     year=total_years_is

     date=sprintf("%02d/%02d/%04d", month, month_day, year)

     return date

   end 

 

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

   def clock

     

     hour=hours_is

     min=min_is

     sec=secs_is

     

     if @clock_mode == 1

        clock=sprintf("%02d:%02d:%02d", hour, min, sec)

        return clock

      else

        if @am==true : am_pm="AM" else am_pm="PM" end

        clock=sprintf("%02d:%02d:%02d %s", hour, min, sec, am_pm)

        return clock

    end

   end

    

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

   def hours_is

     hour=real_hour=real_hours

      if @clock_mode == 2

        if @am==false and real_hour !=12 : hour-=(@day_length/2) end

        hour %= (@day_length/2)+1

        if real_hour < (@day_length/2) : @am=true else @am=false end

         if hour==0 : hour=1 end

         if real_hour==0 : hour=12 end

         end   

     return hour

   end

   

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

   def real_hours

     real_hour = total_sec_is / @minutes_length / @hour_length % @day_length

     return real_hour

   end 

   

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

   def secs_is

     sec = total_sec_is % @minutes_length

     return sec

   end 

 

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

   def min_is

     mins = total_sec_is / @minutes_length % @hour_length

     return mins

   end 

 

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

   def total_days_is

     total_days = (total_sec_is / @minutes_length / @hour_length / @day_length) + @start_date[1] 

     return total_days

   end 

    

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

   def week_day_is

     week_day= total_days_is % @week_length 

     if week_day==0 : week_day=@week_length end

     return week_day

   end 

 

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

   def week_name

     return @name_day[week_day_is]

   end 

    

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

   def month_name

     return @name_month[months_is] 

   end 

 

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

    def months_is

       month=total_months_is % @year_length

       if @rewind==true

        if month==0 : months(-1) end

          @rewind=false  

      else

        if month==0 : months(1) end

      end    

      return month

    end 

 

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

   def month_day_is

     month_day=total_days_is % @month_length

     if @rewind==true

       if month_day==0 : days(-1) end

         @rewind=false  

     else

       if month_day==0 : days(1) end

     end    

     return month_day

   end 

       

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

   def period_id

     for i in 1...@cycle_period.size

       if @cycle_period[i] === $ats.real_hours

        return i

        break

       end  

     end  

   end 

   

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

   def period

     for i in 1...@cycle_period.size

       if @cycle_period[i] === real_hours

        if i==0 : i=1 end

        return @name_period[i]

        break

       end  

     end  

   end 

 

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

def period_tint

     for i in 1...@cycle_period.size

       if @cycle_period[i] === real_hours

        return [-50, -50, -50, 50, 100] if i == 2 and $game_screen.weather_type != 0

        return @tint_period[i]

        break

       end  

     end  

   end 

 

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

   def season

     for i in 1...@cycle_season.size

       if @cycle_season[i] === months_is

        return @name_season[i]

        break

       end  

     end  

   end 

 

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

   def season_id

     for i in 1...@cycle_season.size

       if @cycle_season[i] === months_is

        if i==0 : i=1 end

        return i

        break

       end  

     end  

   end 

 

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

   def start_seconds

     return @define_start_sec

   end

   

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

  def weather_active(flag)

    @aws = flag

  end

  

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

  def weather_bgs(flag)

    @bgs_control = flag

  end

 

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

  def stop_weather

    $game_screen.weather(0, 0, 0)

    set_weather_bgs(0)

  end

  

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

  def weather_is

    case $game_screen.weather_type

    when 0

      return "Clear"

    when 1

      return "Rain"

    when 2

      return "Storm"

    when 3

      return "Snow"

    when 4..5

      return "Gale"

    when 6..8

      return "Windy"

    end

  end

  

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

  def set_weather_bgs(type)

    return if @bgs_control == false

    bgs = BGS.new

    bgs.volume = 80

    bgs.pitch = 100

    case type

    when 0

      $game_system.bgs_fade(10)

    when 1

      bgs.name = "005-Rain01"

      $game_system.bgs_play(bgs)

    when 2

      bgs.name = "006-Rain02"

      $game_system.bgs_play(bgs)

    when 3

      $game_system.bgs_fade(10)

    when 4..5

      bgs.name = "007-Rain03"

      $game_system.bgs_play(bgs)

    when 6

      bgs.name = "001-Wind01"

      $game_system.bgs_play(bgs)

    when 7

      bgs.name = "002-Wind02"

      $game_system.bgs_play(bgs)

    when 8

      bgs.name = "003-Wind03"

      $game_system.bgs_play(bgs)

    end

  end

  

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

  def weather

    return if @aws == false

    return if $game_map.weather_active == false

    if min_is % @weather_period == 0 and @active_weather == false

      @active_weather = true

      if rand(10).between?(0, @weather_cycle)

        pattern = @weather_pattern[season_id]

        size = pattern.size - 1

        type = pattern[rand(size).to_i]

        if @weather_type == type

          if @weather_strength.between?(0, 40)

            @weather_strength += 10 

            else

            @weather_strength = 40

          end

        else

          @weather_strength = 10

        end

        @weather_type = type

        $game_screen.weather(@weather_type, @weather_strength, 0)

        set_weather_bgs(@weather_type)

      else

        @active_weather = true

        @weather_strength = 0

        $game_screen.weather(0, 0, 0)

        set_weather_bgs(0)

      end

    else

      @active_weather = false if min_is % @weather_period != 0

    end

  end

   

end

#===================================================

# ▲ CLASS Advanced_Time Ends

#===================================================

 

 

#===================================================

# ▼ CLASS Scene_Map Additional Code Begins

#===================================================

class Scene_Map

 

alias ats_scene_map_main main

alias ats_scene_map_update update

   

   def main

     if $game_map.dns_active

       tone = $ats.period_tint

       $game_screen.start_tone_change(Tone.new(tone[0],tone[1],tone[2],tone[3]),0)

     end

     #@alex_ats_window = ATS_TimeTest_Window.new

     ats_scene_map_main

     #@alex_ats_window.dispose

   end

   

   def update

     ats_scene_map_update

     #@alex_ats_window.update

     $ats.weather

     if $game_map.dns_active

       tone = $ats.period_tint

       $game_screen.start_tone_change(Tone.new(tone[0],tone[1],tone[2],tone[3]),tone[4])

     end

   end  

   

end

#===================================================

# ▲ CLASS Scene_Map Additional Code Ends

#===================================================

 

 

#===================================================

# ▼ CLASS ATS_TimeTest_Window Begins

#===================================================

class ATS_TimeTest_Window < Window_Base

  

  def initialize

    super(0,0,250,400)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Kartika"

    self.contents.font.size = 22

    self.opacity = 100

    update   

  end  

  

  def refresh

  #def update #testing and debugging window

    return if Graphics.frame_count % 10 != 0

    self.contents.clear

    self.contents.font.color = text_color(0) 

    self.contents.draw_text(0, 0, 400, 32, "Current Full Clock: " +$ats.clock)

    self.contents.draw_text(0, 16, 400, 32, "Small Date: " +$ats.date)

    self.contents.draw_text(0, 32, 400, 32, "Full Date: " +$ats.full_date)

    self.contents.draw_text(0, 60, 400, 32, "Week ID#: " + $ats.week_day_is.to_s)

 

    self.contents.draw_text(0, 80, 400, 32, "Period: " + $ats.period)

    self.contents.draw_text(0, 100, 400, 32, "Season: " + $ats.season)

    self.contents.draw_text(0, 120, 400, 32, "Month ID#: " + $ats.months_is.to_s)

    self.contents.draw_text(0, 140, 400, 32, "Map Name#: " + $game_map.map_name)

    self.contents.draw_text(0, 160, 400, 32, "Weather: " + $ats.weather_is)

  end

end 

#===================================================

# ▲ CLASS ATS_TimeTest_Window Ends

#===================================================

 

#===================================================

# ▼ CLASS Scene_Title Additional Code Begins

#===================================================

class Scene_Title

  $ats=Advanced_Time.new

end  

#===================================================

# ▲ CLASS Scene_Title Additional Code Ends

#===================================================

 

 

#===================================================

# ▼ CLASS Game_Map Additional Code Begins

#===================================================

class Game_Map

 

  attr_accessor :tileset_refresh

  attr_accessor :tileset_transition

  attr_accessor :map_transition

  attr_accessor :dns_active

  attr_accessor :weather_active

  attr_accessor :lights_refresh

  attr_accessor :shadows_refresh

  attr_accessor :shadows_redraw

 

  alias ats_game_map_update update

  alias ats_game_map_setup setup

  alias ats_game_map_initialize initialize

 

  def initialize

    ats_game_map_initialize

    @tileset_refresh = false

    @season = $ats.season_id

    @tileset_transition = false

    @map_transition = false

    @dns_active = false

    @weather_active = false

    @lights_refresh = false

    @shadows_refresh = false

    @shadows_redraw = false

    @map_transition_id = 0

  end

 

  def setup(map_id)

    ats_game_map_setup(map_id)

    # Setup

    @dns_active = false

    @weather_active = false

    @tileset_transition = false

    @map_transition = false

    

    map_infos = load_data("Data/MapInfos.rxdata")

    # DNS

    if map_infos[map_id].name.include?("*")

      map_infos[map_id].name.delete!("*")

      @dns_active = true

      tone = $ats.period_tint

      $game_screen.start_tone_change(Tone.new(tone[0],tone[1],tone[2],tone[3]),0)

    else

      $game_screen.start_tone_change(Tone.new(0,0,0,0),0)

    end

    # Dynamic Weather

    if map_infos[map_id].name.include?("^")

      map_infos[map_id].name.delete!("^")

      @weather_active = true

      $game_screen.weather($ats.weather_type, $ats.weather_strength, 0)

      $ats.set_weather_bgs($ats.weather_type)

    else

      $game_screen.weather(0, 0, 0)

      $ats.set_weather_bgs(0)

    end

    # Tileset Transition

    if map_infos[map_id].name.include?("&")

      map_infos[map_id].name.delete!("&")

      @tileset_transition = true

    end

    # Map Transition

    if map_infos[map_id].name.include?("[") and map_infos[map_id].name.include?("]")

      index = map_infos[map_id].name.index("[")

      temp = map_infos[map_id].name[index+1].chr

      map_infos[map_id].name.delete!(temp)

      map_infos[map_id].name.delete!("[")

      map_infos[map_id].name.delete!("]")

      @map_transition = true

    end

    @map_name = map_infos[map_id].name

    # Tileset Transition

    if @tileset_transition

      name = $game_map.tileset_name.split

      @tileset_name = name[0] + " " + $ats.season_id.to_s

      for i in 0..6

        autotile_name = @autotile_names[i].split

        next if autotile_name[0] == nil

        if autotile_name[1] == nil

          @autotile_names[i] = autotile_name[0]

        else

          @autotile_names[i] = autotile_name[0] + " " + $ats.season_id.to_s

        end

      end

    end

  end

 

  def map_name

    return @map_name

  end

 

  def update

    # Map Transition

    if @map_transition

      transition_id = "["+$ats.season_id.to_s+"]"

      map_infos = load_data("Data/MapInfos.rxdata")

      for key in map_infos.keys

        if map_infos[key].name.include?(@map_name) and map_infos[key].name.include?(transition_id)

          next if key == @map_id

          setup(key)

          @tileset_refresh = true

          return

        end

      end

    end

    # Tileset Transition

    if @tileset_transition

      if @season != $ats.season_id

        @tileset_refresh = true

        @season = $ats.season_id

        tileset_name = $game_map.tileset_name.split

        @tileset_name = tileset_name[0] + " " + $ats.season_id.to_s

        for i in 0..6

          autotile_name = $game_map.autotile_names[i].split

          next if autotile_name[0] == nil

          if autotile_name[1] == nil

            @autotile_names[i] = autotile_name[0]

          else

            @autotile_names[i] = autotile_name[0] + " " + $ats.season_id.to_s

          end

        end

      end

    end

    $game_map.need_refresh = true

    ats_game_map_update

  end

  

end

#===================================================

# ▲ CLASS Game_Map Additional Code Ends

#===================================================

 

 

#===================================================

# ▼ CLASS Spriteset_Map Additional Code Begins

#===================================================

class Spriteset_Map

 

  alias ats_spriteset_map_update update

 

  def update

    if $game_map.tileset_refresh

      $game_map.tileset_refresh = false

      Graphics.freeze

      dispose

      initialize

      Graphics.transition(20)

    end

    ats_spriteset_map_update

  end

  

end

#===================================================

# ▲ CLASS Spriteset_Map Additional Code Ends

#===================================================

 

 

#===================================================

# ▼ CLASS BGS Additional Code Begins

#===================================================

 

class BGS

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

  attr_accessor :name

  attr_accessor :volume

  attr_accessor :pitch

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

  def initialize

    @name = ""

    @volume = 80

    @pitch = 100

  end

end

#===================================================

# ▲ CLASS BGS Additional Code Ends

#===================================================
 

Seto

Member

Ok, Well I am only trying to help. So anyone else who sees how I have done this, don't boowho me too much ok? I couldn't think of a better way to do it and its nice and easy for the user like this.

Ok I edited the script a little, for what you wanted to do. Now all you have to do is put this $clock = [hours, mins, secs] and it will set the clock over to that time. Make sure that you enter a value for all of them though to even if you only want it to be 7 exactly put $clock = [7, 0, 0] and if you put in a time like [23, 30, 29] it will automatically change it to 12 hour time with pm. If your not on 12 hour time it will leave it as is.

Try that and tell me if you get any weird results. It doesn't reset the month, day or anything else like that. It just changes the time for that day. Is that alright? If you need that changed just say. Sorry if it's not what you wanted or there are bugs in it. I didn't test the script very well after adding the changes. Give it a go! :D

Code:
 

#===================================================

# ■ ATS - Advanced Time System

#===================================================

# Rewiten by Near Fantastica

# Date: 23.07.05

# Version: 1

#

# Written by Dubealex

# Date: 26.11.04

#

# Thanks to Satana_81 for the test tilesets

#===================================================

 

#===================================================

# ▼ CLASS Advanced_Time Begins

#===================================================

class Advanced_Time

 

    attr_reader :define_start_sec

    attr_reader :weather_type

    attr_reader :weather_strength

 

   def initialize

     @weather_pattern = []

     @cycle_period=[]

     @tint_period=[]

     @cycle_season=[]

     @name_period=[]

     @name_season=[]

     @name_month=[]

     @name_day=[]

     @start_clock=[]

     @start_date=[]

 

=begin -----------------------------------------------------------------------------------------------------

      ■ Advanced Time System Settings:

      ---------------------------------------------------------------------------------------------------------

      ▼ Day Night System Transitioning :

     

      The DNS is built in to the time system and therefore any map you want to have the DNS

      active on place a "*" in the name of the map.

      ---------------------------------------------------------------------------------------------------------

      ▼ Method of Season Transitioning :

       

      ●  Titleset Transitioning = The tileset its replaced

          When Titleset Transitioning is set the script will pull the tileset and autotiles used

          set to the season ID. For exmaple "Plains 1" for tileset or "Water 1" for autotiles.

          The script will then automaticly change the 1 to the season ID which will load the

          new tileset. Maps that the developer wishes to have the tileset changing place

          a "~" in the name.

         

      ●  Map Transitioning = The Map is replaced

          When Map Transitioning is set the script changes the whole map. It will transport the

          player to the same x,y on a map with the same name and the matching season ID.

          For example "Town [1]". The script will then automaticaly change the 1 to the

          season ID which will load the new map. Maps that the developer wishes to have

          the map changing place "[Season ID]"  in the map name where Season ID is the ID

          of the season of that map.

=end #----------------------------------------------------------------------------------------------------

 

=begin -----------------------------------------------------------------------------------------------------

      ■ Advanced Weather System Settings:

      ---------------------------------------------------------------------------------------------------------

      ▼ Weather Patterns :

     

      With the Advanced Weather System by Ccoa the Advanced Time System and keep track

      and change weather depending on season. The flag $aws must be set true if the weather

      script is to be used.

     

      1 - rain                    5 - rain with thunder and lightning

      2 - storm                 6 - falling leaves (autumn)

      3 - snow                  7 - blowing leaves (autumn)

      4 - hail                    8 - swirling leaves (autumn)

     

      The script randomly picks bettween having weather and no weather.

      Then the script randomly picks the weather if there is going to be weather.

      If the same weather is added more then once it will add to % chnage that weather

      will be picked. If the same weather is picked again its power is inceased. The

      range of power is 10 - 40. @weather_cycle is the % of weather for the game.

      0 = very little and 10 = a lot of weather. @weather_period is the amount

      of time in mintues till the next weather cycle range  = 1-59. @bgs_control is

      a flag that tells the script to inculde BGS with Dynamic Weather

=end #----------------------------------------------------------------------------------------------------

 

      @aws = false

      @bgs_control = false

      @active_weather = false

      @weather_type = 0

      @weather_strength = 0

      @weather_cycle = 5

      @weather_period = 30

      @weather_pattern[1] = [3]

      @weather_pattern[2] = [1,1,2,3]

      @weather_pattern[3] = [1,1,2,5]

      @weather_pattern[4] = [1,2,4,5]

      @weather_pattern[5] = [1,1,2,6]

      @weather_pattern[5] = [1,1,3,7,8]

 

=begin -----------------------------------------------------------------------------------------------------

      ■ ATS Settings Configuration:

      ---------------------------------------------------------------------------------------------------------

      ▼ LENGTH AND SPEED OF TIME:

       

      Those variables defines the speed and length of every aspect of the ATS.

      @time_speed define how fast a seconds last. Setting it to 0 makes a real time system.

      Below 0 is a slower time than normal, and higher than 0 will accelerate the time.

      The length value are used to customize the length of every component of the ATS.

      Remember that since it is the SPEED setting that defines how fast the time goes,

      you don't have to say that a minute last 30 sec to make it faster. You can leave it

      as real-time, and just accelerate the length of a second with @time_speed !

=end #----------------------------------------------------------------------------------------------------

     

      @ats_time_speed = 40             # 0 is a Real Time System

      @minutes_length = 60               # Seconds

      @hour_length = 60                    # Minutes

      @day_length = 24                     # Hours

      @week_length = 7                     # Days

      @month_length = 30                # Days

      @year_length = 12                   # Months

      @decade_length = 10                # Years

      @century_length = 100              # Years

      @millenium_length = 1000        # Years

     

=begin ----------------------------------------------------------------------------------------------------

       ▼ GAME DEFAULT START-UP VALUES:

     

       Here you can define the default start-up values for each components. The data

       you enter here will be taken into consideration at each new game started. So if you want

       your game to begin at 2:12 pm, you can adjust all that in here. You can also set some

       basic default options you have, like trigger the AM/PM time format ON/OFF.

       You don't have to set the start-up season and period, since it will be set automatically

       with the date and the clock.

=end #-----------------------------------------------------------------------------------------------------

     

    @clock_mode = 2               # 1= 24 hours format / 2= AM/PM flag format

     @start_clock   = [21,50,10]     # [hour, min, sec] -> Write in 24 hours format.

     @start_date    = [2,13,2011] # [month, day, year]  

     

     

=begin -----------------------------------------------------------------------------------------------------

       ▼ ATS PERIODS CYCLE SETTINGS:

     

      An ATS Period works just as my old NDS Period.

      Periods defines a 24 hours loop - Example: Morning>Day>Evening>Night

      Here you can defines what is the cycle (in hours) for each periods.

      You can have as much period as you desire, I created the 4 main one, as shown

      in the example above. To add period, simply copy a line and replace the ID of the

      period by the next in line. DO NOT skip numbers.

      Syntax: @cycle_period[ID] --> Don't use ID0. (You can name them later).

      Example: @cycle_period[1] = (5..11) Will make the period ID#1  begins at 5am

      and ends at 11am. Use the 24 hours clock format to defines the period length.

=end #-----------------------------------------------------------------------------------------------------

     

      @cycle_period[1] = (5..11)  #Defined as (start_hour..end_hour)

      @cycle_period[2] = (12..18)

      @cycle_period[3] = (19..22)

      @cycle_period[4] = (23..24)

      @cycle_period[5] = (0..4)

 

=begin ----------------------------------------------------------------------------------------------------

      ▼ ATS PERIODS COLOR TONE (TINT) SETTINGS:

     

      Here you can define what will be the color tone used for each periods.

      Use the same period ID defined above. Example: @tint_period[1] is the tint used

      with the @cycle_period[1] settings.

      Syntax: @tint_period[1] = [red, green, blue, gray, transition_time]  

      To know the number you want for your tint, simply opens a RPG Maker Project, and

      create an event, choose "Tint Screen" and test the values you want, then enter them

      in here.

=end #-----------------------------------------------------------------------------------------------------

     

      @tint_period[1] = [0, -40, -60, 50, 600]

      @tint_period[2] = [0, 0, 0, 0, 600]

      @tint_period[3] = [-68, -85, -34, 120, 600]

      @tint_period[4] = [-150, -100, -50, 180, 600]  

      @tint_period[5] = [-95, -78, -44, 180, 600]

     

=begin -----------------------------------------------------------------------------------------------------

      ▼ SEASONS CYCLE SETTINGS:

     

      Here you can define how much time last every season. This is an "optional" feature.

      You can just leave it alone if you aren't using it. This work as the periods, but seasons

      are defined using months instead of hours. To know how it works, read the periods comments.

      Example: @cycle_season[1] = (6..8) Will make the season ID#1  begins on the

      6th month of the year, and end on the last day of the 8th month of the year.

=end #-----------------------------------------------------------------------------------------------------

       

      @cycle_season[1] = (1..2) #Defined as (start_month..end_month)

      @cycle_season[2] = (3..4)

      @cycle_season[3] = (5..6)

      @cycle_season[4] = (7..8)

      @cycle_season[5] = (9..10)

      @cycle_season[6] = (11..12)

     

     

=begin ----------------------------------------------------------------------------------------------------

      ▼ ATS COMPONENT'S NAMES SETTINGS:

     

      Here you can choose the name tagged to every relevant component of the ATS.

      The words you defined here will be used in window and menus in your game.

      It make it easy to configure and customize that way. You can also refer to those variables

      names if you need to access any component's names. That way, if you make a mistake or

      want to change something in the middle of your development, you can easily do it.

      If you added/deleted periods/seasons, just adjust this section too. So if you created a season

      ID#6, you can copy a line from here and add the 6 where it belongs. (Between [ ])

      This is also were you define all your Months and Days name. It work the same way.

      @name_month[1] will refer to the first month of your year. By default, it's January.

=end #----------------------------------------------------------------------------------------------------

     

      @name_period[1] = "Morning"

      @name_period[2] = "Day"

      @name_period[3] = "Evening"

      @name_period[4] = "Night"

      @name_period[5] = "Night"

     

      @name_season[1] = "Winter"

      @name_season[2] = "Spring"

      @name_season[3] = "Summer"

      @name_season[4] = "Summer"

      @name_season[5] = "Autumn"

      @name_season[6] = "Autumn"

     

      @name_month[1]  = "January"

      @name_month[2]  = "February"

      @name_month[3]  = "March"

      @name_month[4]  = "April"

      @name_month[5]  = "May"

      @name_month[6]  = "June"

      @name_month[7]  = "July"

      @name_month[8]  = "August"

      @name_month[9]  = "September"

      @name_month[10]= "October"

      @name_month[11]= "November"

      @name_month[12]= "December"

     

      @name_day[1] = "Monday"

      @name_day[2] = "Tuesday"

      @name_day[3] = "Wednesday"

      @name_day[4] = "Thursday"

      @name_day[5] = "Friday"

      @name_day[6] = "Saturday"

      @name_day[7] = "Sunday"      

     

#--- ■ END OF SETTINGS (No Need To Edit Further)-------------------------------------------

           

      @speed_restore = 0

      if @ats_time_speed >= Graphics.frame_rate

         @ats_time_speed=Graphics.frame_rate-1

       end

      @year_length+=1

      @month_length+=1

      if @start_clock[0] >= 12 : @am=false else @am=true end

      define_start_sec_in_hours= @start_clock[0] * @minutes_length * @hour_length

      define_start_sec_in_min= @start_clock[1] * @minutes_length

      @define_start_sec= define_start_sec_in_hours+define_start_sec_in_min+@start_clock[2]

   end

 

# ■ WRITE ATTRIBUTE (Modify ATS Data) (No Need To Edit)----------------------------------  

  def sec(sec=0)

    @define_start_sec+=sec

  end

 

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

  def min(min=0)

    @define_start_sec+=min*@minutes_length

  end

 

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

  def hours(hours=0)

    @define_start_sec+=hours*@minutes_length*@hour_length

  end  

 

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

  def days(days=0)

    if days<0 : @rewind=true end

    @define_start_sec+=days*@minutes_length*@hour_length*@day_length

  end  

 

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

  def months(months=0)

     if months<0 : @rewind=true end

    @define_start_sec+=months*@minutes_length*@hour_length*@day_length*@month_length

  end

 

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

  def speed(speed=0)

    @speed_restore = @ats_time_speed

    @ats_time_speed = speed

  end

 

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

  def speed_restore

    @ats_time_speed = @speed_restore

  end

   

# ■ READ ATTRIBUTE (Fetch ATS Data) (No Need To Edit)-------------------------------------  

  def full_date

    day_name=@name_day[week_day_is]

    month_name=@name_month[months_is]

    month_day=month_day_is

    year= total_years_is

    full_date= day_name + ", " + month_name + " " + month_day.to_s  + " " +  year.to_s

    return full_date

  end

 

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

  def speed_is

    return @ats_time_speed

  end

 

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

   def total_sec_is

     ats_total_sec = (Graphics.frame_count / (Graphics.frame_rate-@ats_time_speed))+@define_start_sec

     return ats_total_sec

   end

 

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

   def total_years_is

      total_years=(total_months_is / @year_length) + @start_date[2]

     return total_years

   end

 

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

   def total_months_is

     total_months=(total_days_is / @month_length) + @start_date[0]

     return total_months

   end

 

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

   def total_decades_is

     total_decades=total_years_is / @decade_length

     return total_decades

   end

 

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

   def total_centuries_is

     total_centuries=total_years_is / @century_length

     return total_centuries

   end

 

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

   def total_millenium_is

      total_millenium=total_years_is/@millenium_length

     return total_millenium

   end

     

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

   def total_weeks_is

     total_weeks= total_days_is / @week_length

     return total_weeks

   end

       

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

   def total_hours_is

     total_hours= total_sec_is / @minutes_length / @hour_length

     return total_hours

   end

   

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

   def total_min_is

     total_min = total_sec_is / @minutes_length

     return total_min

   end  

   

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

   def date

     month=months_is

     month_day=month_day_is

     year=total_years_is

     date=sprintf("%02d/%02d/%04d", month, month_day, year)

     return date

   end

 

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

 

#Sets up the $clock variable

$clock = []  

def clock

     

     hour=hours_is

     min=min_is

     sec=secs_is

     $clock = []

       

     if @clock_mode == 1

        clock=sprintf("%02d:%02d:%02d", hour, min, sec)

        return clock

      else

        if @am==true : am_pm="AM" else am_pm="PM" end

        clock=sprintf("%02d:%02d:%02d %s", hour, min, sec, am_pm)

        return clock

    end

  end

   

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

   def hours_is

     if $clock[0] != nil

       hour = $clock[0]

       if @clock_mode == 2

         if hour > 12

           hour = hour - 12

           @am = false

         end

       end

       return hour

      else

     hour=real_hour=real_hours

      if @clock_mode == 2

        if @am==false and real_hour !=12 : hour-=(@day_length/2) end

        hour %= (@day_length/2)+1

        if real_hour < (@day_length/2) : @am=true else @am=false end

         if hour==0 : hour=1 end

         if real_hour==0 : hour=12 end

         end  

     return hour

     end

   end

   

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

   def real_hours

     real_hour = total_sec_is / @minutes_length / @hour_length % @day_length

     return real_hour

   end

   

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

   def secs_is

     if $clock[2] != nil

       sec = $clock[2]

       return sec

       else

     sec = total_sec_is % @minutes_length

     return sec

   end

 end

 

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

   def min_is

     if $clock[1] != nil

       mins = $clock[1]

       return mins

     else

     mins = total_sec_is / @minutes_length % @hour_length

     return mins

     end

   end

 

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

   def total_days_is

     total_days = (total_sec_is / @minutes_length / @hour_length / @day_length) + @start_date[1]

     return total_days

   end

   

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

   def week_day_is

     week_day= total_days_is % @week_length

     if week_day==0 : week_day=@week_length end

     return week_day

   end

 

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

   def week_name

     return @name_day[week_day_is]

   end

   

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

   def month_name

     return @name_month[months_is]

   end

 

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

    def months_is

       month=total_months_is % @year_length

       if @rewind==true

        if month==0 : months(-1) end

          @rewind=false  

      else

        if month==0 : months(1) end

      end    

      return month

    end

 

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

   def month_day_is

     month_day=total_days_is % @month_length

     if @rewind==true

       if month_day==0 : days(-1) end

         @rewind=false  

     else

       if month_day==0 : days(1) end

     end    

     return month_day

   end

       

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

   def period_id

     for i in 1...@cycle_period.size

       if @cycle_period[i] === $ats.real_hours

        return i

        break

       end  

     end  

   end

   

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

   def period

     for i in 1...@cycle_period.size

       if @cycle_period[i] === real_hours

        if i==0 : i=1 end

        return @name_period[i]

        break

       end  

     end  

   end

 

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

def period_tint

     for i in 1...@cycle_period.size

       if @cycle_period[i] === real_hours

        return [-50, -50, -50, 50, 100] if i == 2 and $game_screen.weather_type != 0

        return @tint_period[i]

        break

       end  

     end  

   end

 

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

   def season

     for i in 1...@cycle_season.size

       if @cycle_season[i] === months_is

        return @name_season[i]

        break

       end  

     end  

   end

 

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

   def season_id

     for i in 1...@cycle_season.size

       if @cycle_season[i] === months_is

        if i==0 : i=1 end

        return i

        break

       end  

     end  

   end

 

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

   def start_seconds

     return @define_start_sec

   end

   

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

  def weather_active(flag)

    @aws = flag

  end

 

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

  def weather_bgs(flag)

    @bgs_control = flag

  end

 

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

  def stop_weather

    $game_screen.weather(0, 0, 0)

    set_weather_bgs(0)

  end

 

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

  def weather_is

    case $game_screen.weather_type

    when 0

      return "Clear"

    when 1

      return "Rain"

    when 2

      return "Storm"

    when 3

      return "Snow"

    when 4..5

      return "Gale"

    when 6..8

      return "Windy"

    end

  end

 

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

  def set_weather_bgs(type)

    return if @bgs_control == false

    bgs = BGS.new

    bgs.volume = 80

    bgs.pitch = 100

    case type

    when 0

      $game_system.bgs_fade(10)

    when 1

      bgs.name = "005-Rain01"

      $game_system.bgs_play(bgs)

    when 2

      bgs.name = "006-Rain02"

      $game_system.bgs_play(bgs)

    when 3

      $game_system.bgs_fade(10)

    when 4..5

      bgs.name = "007-Rain03"

      $game_system.bgs_play(bgs)

    when 6

      bgs.name = "001-Wind01"

      $game_system.bgs_play(bgs)

    when 7

      bgs.name = "002-Wind02"

      $game_system.bgs_play(bgs)

    when 8

      bgs.name = "003-Wind03"

      $game_system.bgs_play(bgs)

    end

  end

 

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

  def weather

    return if @aws == false

    return if $game_map.weather_active == false

    if min_is % @weather_period == 0 and @active_weather == false

      @active_weather = true

      if rand(10).between?(0, @weather_cycle)

        pattern = @weather_pattern[season_id]

        size = pattern.size - 1

        type = pattern[rand(size).to_i]

        if @weather_type == type

          if @weather_strength.between?(0, 40)

            @weather_strength += 10

            else

            @weather_strength = 40

          end

        else

          @weather_strength = 10

        end

        @weather_type = type

        $game_screen.weather(@weather_type, @weather_strength, 0)

        set_weather_bgs(@weather_type)

      else

        @active_weather = true

        @weather_strength = 0

        $game_screen.weather(0, 0, 0)

        set_weather_bgs(0)

      end

    else

      @active_weather = false if min_is % @weather_period != 0

    end

  end

   

end

#===================================================

# ▲ CLASS Advanced_Time Ends

#===================================================

 

 

#===================================================

# ▼ CLASS Scene_Map Additional Code Begins

#===================================================

class Scene_Map

 

alias ats_scene_map_main main

alias ats_scene_map_update update

   

   def main

     if $game_map.dns_active

       tone = $ats.period_tint

       $game_screen.start_tone_change(Tone.new(tone[0],tone[1],tone[2],tone[3]),0)

     end

     #@alex_ats_window = ATS_TimeTest_Window.new

     ats_scene_map_main

     #@alex_ats_window.dispose

   end

   

   def update

     ats_scene_map_update

     #@alex_ats_window.update

     $ats.weather

     if $game_map.dns_active

       tone = $ats.period_tint

       $game_screen.start_tone_change(Tone.new(tone[0],tone[1],tone[2],tone[3]),tone[4])

     end

   end  

   

end

#===================================================

# ▲ CLASS Scene_Map Additional Code Ends

#===================================================

 

 

#===================================================

# ▼ CLASS ATS_TimeTest_Window Begins

#===================================================

class ATS_TimeTest_Window < Window_Base

 

  def initialize

    super(0,0,250,400)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Kartika"

    self.contents.font.size = 22

    self.opacity = 100

    update  

  end  

 

  def refresh

  #def update #testing and debugging window

    return if Graphics.frame_count % 10 != 0

    self.contents.clear

    self.contents.font.color = text_color(0)

    self.contents.draw_text(0, 0, 400, 32, "Current Full Clock: " +$ats.clock)

    self.contents.draw_text(0, 16, 400, 32, "Small Date: " +$ats.date)

    self.contents.draw_text(0, 32, 400, 32, "Full Date: " +$ats.full_date)

    self.contents.draw_text(0, 60, 400, 32, "Week ID#: " + $ats.week_day_is.to_s)

 

    self.contents.draw_text(0, 80, 400, 32, "Period: " + $ats.period)

    self.contents.draw_text(0, 100, 400, 32, "Season: " + $ats.season)

    self.contents.draw_text(0, 120, 400, 32, "Month ID#: " + $ats.months_is.to_s)

    self.contents.draw_text(0, 140, 400, 32, "Map Name#: " + $game_map.map_name)

    self.contents.draw_text(0, 160, 400, 32, "Weather: " + $ats.weather_is)

  end

end

#===================================================

# ▲ CLASS ATS_TimeTest_Window Ends

#===================================================

 

#===================================================

# ▼ CLASS Scene_Title Additional Code Begins

#===================================================

class Scene_Title

  $ats=Advanced_Time.new

end  

#===================================================

# ▲ CLASS Scene_Title Additional Code Ends

#===================================================

 

 

#===================================================

# ▼ CLASS Game_Map Additional Code Begins

#===================================================

class Game_Map

 

  attr_accessor :tileset_refresh

  attr_accessor :tileset_transition

  attr_accessor :map_transition

  attr_accessor :dns_active

  attr_accessor :weather_active

  attr_accessor :lights_refresh

  attr_accessor :shadows_refresh

  attr_accessor :shadows_redraw

 

  alias ats_game_map_update update

  alias ats_game_map_setup setup

  alias ats_game_map_initialize initialize

 

  def initialize

    ats_game_map_initialize

    @tileset_refresh = false

    @season = $ats.season_id

    @tileset_transition = false

    @map_transition = false

    @dns_active = false

    @weather_active = false

    @lights_refresh = false

    @shadows_refresh = false

    @shadows_redraw = false

    @map_transition_id = 0

  end

 

  def setup(map_id)

    ats_game_map_setup(map_id)

    # Setup

    @dns_active = false

    @weather_active = false

    @tileset_transition = false

    @map_transition = false

   

    map_infos = load_data("Data/MapInfos.rxdata")

    # DNS

    if map_infos[map_id].name.include?("*")

      map_infos[map_id].name.delete!("*")

      @dns_active = true

      tone = $ats.period_tint

      $game_screen.start_tone_change(Tone.new(tone[0],tone[1],tone[2],tone[3]),0)

    else

      $game_screen.start_tone_change(Tone.new(0,0,0,0),0)

    end

    # Dynamic Weather

    if map_infos[map_id].name.include?("^")

      map_infos[map_id].name.delete!("^")

      @weather_active = true

      $game_screen.weather($ats.weather_type, $ats.weather_strength, 0)

      $ats.set_weather_bgs($ats.weather_type)

    else

      $game_screen.weather(0, 0, 0)

      $ats.set_weather_bgs(0)

    end

    # Tileset Transition

    if map_infos[map_id].name.include?("&")

      map_infos[map_id].name.delete!("&")

      @tileset_transition = true

    end

    # Map Transition

    if map_infos[map_id].name.include?("[") and map_infos[map_id].name.include?("]")

      index = map_infos[map_id].name.index("[")

      temp = map_infos[map_id].name[index+1].chr

      map_infos[map_id].name.delete!(temp)

      map_infos[map_id].name.delete!("[")

      map_infos[map_id].name.delete!("]")

      @map_transition = true

    end

    @map_name = map_infos[map_id].name

    # Tileset Transition

    if @tileset_transition

      name = $game_map.tileset_name.split

      @tileset_name = name[0] + " " + $ats.season_id.to_s

      for i in 0..6

        autotile_name = @autotile_names[i].split

        next if autotile_name[0] == nil

        if autotile_name[1] == nil

          @autotile_names[i] = autotile_name[0]

        else

          @autotile_names[i] = autotile_name[0] + " " + $ats.season_id.to_s

        end

      end

    end

  end

 

  def map_name

    return @map_name

  end

 

  def update

    # Map Transition

    if @map_transition

      transition_id = "["+$ats.season_id.to_s+"]"

      map_infos = load_data("Data/MapInfos.rxdata")

      for key in map_infos.keys

        if map_infos[key].name.include?(@map_name) and map_infos[key].name.include?(transition_id)

          next if key == @map_id

          setup(key)

          @tileset_refresh = true

          return

        end

      end

    end

    # Tileset Transition

    if @tileset_transition

      if @season != $ats.season_id

        @tileset_refresh = true

        @season = $ats.season_id

        tileset_name = $game_map.tileset_name.split

        @tileset_name = tileset_name[0] + " " + $ats.season_id.to_s

        for i in 0..6

          autotile_name = $game_map.autotile_names[i].split

          next if autotile_name[0] == nil

          if autotile_name[1] == nil

            @autotile_names[i] = autotile_name[0]

          else

            @autotile_names[i] = autotile_name[0] + " " + $ats.season_id.to_s

          end

        end

      end

    end

    $game_map.need_refresh = true

    ats_game_map_update

  end

 

end

#===================================================

# ▲ CLASS Game_Map Additional Code Ends

#===================================================

 

 

#===================================================

# ▼ CLASS Spriteset_Map Additional Code Begins

#===================================================

class Spriteset_Map

 

  alias ats_spriteset_map_update update

 

  def update

    if $game_map.tileset_refresh

      $game_map.tileset_refresh = false

      Graphics.freeze

      dispose

      initialize

      Graphics.transition(20)

    end

    ats_spriteset_map_update

  end

 

end

#===================================================

# ▲ CLASS Spriteset_Map Additional Code Ends

#===================================================

 

 

#===================================================

# ▼ CLASS BGS Additional Code Begins

#===================================================

 

class BGS

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

  attr_accessor :name

  attr_accessor :volume

  attr_accessor :pitch

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

  def initialize

    @name = ""

    @volume = 80

    @pitch = 100

  end

end

#===================================================

# ▲ CLASS BGS Additional Code Ends

#===================================================

 
 
Hello!
I apologize for the late reply, I went on a short vacation shortly after posting, but I am very grateful for your help.


There seems to be a little problem which may be another script compatibility issue. I am using MOG's Menu scripts which I edited to show what time it is via looking at the menu. I replaced the worthless windows for playtime and steps to show time of day and date. Here is the script:
Code:
#_______________________________________________________________________________

# MOG Scene Menu Itigo V1.2

#_______________________________________________________________________________

# By Moghunter

# [url=http://www.atelier-rgss.com]http://www.atelier-rgss.com[/url]

#_______________________________________________________________________________

module MOG

#Transition Time.

MNTT = 20

#Transition Type (Name)

MNTP = "006-Stripe02"

end

$mogscript = {} if $mogscript == nil

$mogscript["menu_itigo"] = true

##############

# Game_Actor #

##############

class Game_Actor < Game_Battler

def now_exp

return @exp - @exp_list[@level]

end

def next_exp

return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0

end

end

###############

# Window_Base #

###############

class Window_Base < Window

def nada

face = RPG::Cache.picture("")

end

def drw_face(actor,x,y)

face = RPG::Cache.picture(actor.name + "_fc") rescue nada

cw = face.width

ch = face.height

src_rect = Rect.new(0, 0, cw, ch)

self.contents.blt(x , y - ch, face, src_rect)

end

def draw_maphp3(actor, x, y)

back = RPG::Cache.picture("BAR0")

cw = back.width

ch = back.height

src_rect = Rect.new(0, 0, cw, ch)

self.contents.blt(x + 65, y - ch + 30, back, src_rect)

meter = RPG::Cache.picture("HP_Bar")

cw = meter.width * actor.hp / actor.maxhp

ch = meter.height

src_rect = Rect.new(0, 0, cw, ch)

self.contents.blt(x + 65, y - ch + 30, meter, src_rect)

text = RPG::Cache.picture("HP_Tx")

cw = text.width

ch = text.height

src_rect = Rect.new(0, 0, cw, ch)

self.contents.blt(x + 35, y - ch + 30, text, src_rect)

self.contents.font.color = Color.new(0,0,0,255)

self.contents.draw_text(x + 81, y - 1, 48, 32, actor.hp.to_s, 2)

self.contents.font.color = Color.new(255,255,255,255)

self.contents.draw_text(x + 80, y - 2, 48, 32, actor.hp.to_s, 2)

end

def draw_mapsp3(actor, x, y)

back = RPG::Cache.picture("BAR0")

cw = back.width

ch = back.height

src_rect = Rect.new(0, 0, cw, ch)

self.contents.blt(x + 65, y - ch + 30, back, src_rect)

meter = RPG::Cache.picture("SP_Bar")

cw = meter.width * actor.sp / actor.maxsp

ch = meter.height

src_rect = Rect.new(0, 0, cw, ch)

self.contents.blt(x + 65, y - ch + 30, meter, src_rect)

text = RPG::Cache.picture("SP_Tx")

cw = text.width

ch = text.height

src_rect = Rect.new(0, 0, cw, ch)

self.contents.blt(x + 35, y - ch + 30, text, src_rect)

self.contents.font.color = Color.new(0,0,0,255)

self.contents.draw_text(x + 81, y - 1, 48, 32, actor.sp.to_s, 2)

self.contents.font.color = Color.new(255,255,255,255)

self.contents.draw_text(x + 80, y - 2, 48, 32, actor.sp.to_s, 2)

end

def draw_mexp2(actor, x, y)

bitmap2 = RPG::Cache.picture("Exp_Back")

cw = bitmap2.width

ch = bitmap2.height

src_rect = Rect.new(0, 0, cw, ch)

self.contents.blt(x + 60 , y - ch + 30, bitmap2, src_rect)

if actor.next_exp != 0

rate = actor.now_exp.to_f / actor.next_exp

else

rate = 1

end

bitmap = RPG::Cache.picture("Exp_Meter")

if actor.level < 99

cw = bitmap.width * rate

else

cw = bitmap.width

end

ch = bitmap.height

src_rect = Rect.new(0, 0, cw, ch)

self.contents.blt(x + 60 , y - ch + 30, bitmap, src_rect)

exp_tx = RPG::Cache.picture("Exp_tx")

cw = exp_tx.width

ch = exp_tx.height

src_rect = Rect.new(0, 0, cw, ch)

self.contents.blt(x + 55 , y - ch + 30, exp_tx, src_rect)

lv_tx = RPG::Cache.picture("LV_tx")

cw = lv_tx.width

ch = lv_tx.height

src_rect = Rect.new(0, 0, cw, ch)

self.contents.blt(x + 125 , y - ch + 35, lv_tx, src_rect)

self.contents.font.color = Color.new(0,0,0,255)

self.contents.draw_text(x + 161, y + 7, 24, 32, actor.level.to_s, 1)

self.contents.font.color = Color.new(255,255,255,255)

self.contents.draw_text(x + 160, y + 6, 24, 32, actor.level.to_s, 1)

end

def draw_actor_state2(actor, x, y, width = 80)

text = make_battler_state_text(actor, width, true)

self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color

self.contents.draw_text(x, y, width, 32, text,2)

end

end

######################

# Window_MenuStatus2 #

######################

class Window_MenuStatus2 < Window_Selectable

def initialize

super(0, 0, 415, 280)

self.contents = Bitmap.new(width - 32, height - 32)

refresh

self.active = false

self.opacity = 0

self.index = -1

end

def refresh

self.contents.clear

@item_max = $game_party.actors.size

for i in 0...$game_party.actors.size

x = 20

y = i * 62

actor = $game_party.actors[i]

self.contents.font.name = "Kartika"

if $mogscript["TP_System"] == true

draw_actor_tp(actor ,x + 285, y - 5,4)

draw_actor_state2(actor ,x + 190, y - 5)

else

draw_actor_state2(actor ,x + 220, y - 5)

end

drw_face(actor,x,y + 50)

draw_maphp3(actor,x + 40, y - 5)

draw_mapsp3(actor,x + 40, y + 20 )

draw_mexp2(actor,x + 140, y + 15 )

end

end

def update_cursor_rect

if @index < 0

self.cursor_rect.empty

else

self.cursor_rect.set(5, @index * 62, self.width - 32, 50)

end

end

end

################

# Window_Gold2 #

################

class Window_Gold2 < Window_Base

def initialize

super(0, 0, 160, 64)

self.contents = Bitmap.new(width - 32, height - 32)

refresh

end

def refresh

cx = contents.text_size($data_system.words.gold).width

    self.contents.clear

    self.contents.font.color = text_color(0)

    self.contents.draw_text(4, 0, 120-cx-2, 32, "" + $game_map.map_name)

end

end

####################

# Window_PlayTime2 #

####################

class Window_PlayTime2 < Window_Base

def initialize

super(0, 0, 160, 96)

self.contents = Bitmap.new(width - 32, height - 32)

refresh

end

def refresh

    self.contents.clear

    self.contents.font.color = text_color(0)

    self.contents.draw_text(40, 32, 140, 32, "" +$ats.clock)

end

def update

super

if Graphics.frame_count / Graphics.frame_rate != @total_sec

refresh

end

end

end

#################

# Window_Steps2 #

#################

class Window_Steps2 < Window_Base

def initialize

super(0, 0, 160, 96)

self.contents = Bitmap.new(width - 32, height - 32)

refresh

end

def refresh

    self.contents.clear

    self.contents.font.color = text_color(0)

    self.contents.draw_text(40, 32, 140, 32, "" +$ats.date)

end

end

##############

# Scene_Menu #

##############

class Scene_Menu

def initialize(menu_index = 0)

@menu_index = menu_index

end

def main

s1 = ""

s2 = ""

s3 = ""

s4 = ""

s5 = ""

s6 = ""

@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])

@command_window.index = @menu_index

if $game_party.actors.size == 0

@command_window.disable_item(0)

@command_window.disable_item(1)

@command_window.disable_item(2)

@command_window.disable_item(3)

end

@command_window.visible = false

@command_window.x = -640

@mnlay = Sprite.new

@mnlay.bitmap = RPG::Cache.picture("Mn_lay")

@mnlay.z = 10

@mnback = Plane.new

@mnback.bitmap = RPG::Cache.picture("Mn_back")

@mnback.blend_type = 0

@mnback.z = 5

@mnback2 = Plane.new

@mnback2.bitmap = RPG::Cache.picture("Mn_back")

@mnback2.blend_type = 0

@mnback2.z = 5

@mnback2.opacity = 60

@mnsel = Sprite.new

@mnsel.bitmap = RPG::Cache.picture("Mn_Sel")

@mnsel.z = 20

@mnsel.x = 0

@mnsel.y = 110

@mnop = 150

if $game_system.save_disabled

@command_window.disable_item(4)

end

@playtime_window = Window_PlayTime2.new

@playtime_window.x = 30

@playtime_window.y = 375

@playtime_window.opacity = 0

@playtime_window.z = 15

@steps_window = Window_Steps2.new

@steps_window.x = 230

@steps_window.y = 375

@steps_window.opacity = 0

@steps_window.z = 15

@gold_window = Window_Gold2.new

@gold_window.x = 455

@gold_window.y = 405

@gold_window.opacity = 0

@gold_window.z = 15

@status_window = Window_MenuStatus2.new

@status_window.x = 195

@status_window.y = 110

@status_window.opacity = 0

@status_window.z = 15

Graphics.transition(MOG::MNTT, "Graphics/Transitions/" + MOG::MNTP)

loop do

Graphics.update

Input.update

update

if $scene != self

break

end

end

Graphics.freeze

@command_window.dispose

@playtime_window.dispose

@steps_window.dispose

@gold_window.dispose

@status_window.dispose

@mnlay.dispose

@mnback.dispose

@mnback2.dispose

@mnsel.dispose

Graphics.update

end

def update

@command_window.update

@playtime_window.update

@steps_window.update

@gold_window.update

@status_window.update

@mnback.oy += 1

@mnback.ox += 1

@mnback2.oy += 1

@mnback2.ox -= 1

@mnop += 5

if @command_window.active == true

@mnsel.bitmap = RPG::Cache.picture("Mn_Sel")

else

@mnsel.bitmap = RPG::Cache.picture("Mn_Sel_off")

@mnsel.zoom_x = 1

@mnsel.opacity = 255

end

if @mnop >= 255

@mnop = 120

end

if @command_window.active

update_command

return

end

if @status_window.active

update_status

return

end

end

def update_command

if @mnsel.zoom_x <= 1.6

@mnsel.zoom_x += 0.03

@mnsel.opacity -= 10

elsif @mnsel.zoom_x > 1.6

@mnsel.zoom_x = 1.0

@mnsel.opacity = 255

end

case @command_window.index

when 0

@mnsel.x = 0

@mnsel.y = 110

when 1

@mnsel.x = 25

@mnsel.y = 155

when 2

@mnsel.x = 40

@mnsel.y = 197

when 3

@mnsel.x = 45

@mnsel.y = 242

when 4

@mnsel.x = 25

@mnsel.y = 285

when 5

@mnsel.x = 0

@mnsel.y = 325

end

if Input.trigger?(Input::B)

$game_system.se_play($data_system.cancel_se)

$scene = Scene_Map.new

return

end

if Input.trigger?(Input::C)

if $game_party.actors.size == 0 and @command_window.index < 4

$game_system.se_play($data_system.buzzer_se)

return

end

case @command_window.index

when 0

$game_system.se_play($data_system.decision_se)

$scene = Scene_Item.new

when 1

$game_system.se_play($data_system.decision_se)

@command_window.active = false

@status_window.active = true

@status_window.index = 0

when 2

$game_system.se_play($data_system.decision_se)

@command_window.active = false

@status_window.active = true

@status_window.index = 0

when 3

$game_system.se_play($data_system.decision_se)

@command_window.active = false

@status_window.active = true

@status_window.index = 0

when 4

if $game_system.save_disabled

$game_system.se_play($data_system.buzzer_se)

return

end

$game_system.se_play($data_system.decision_se)

$scene = Scene_Questdiary.new

when 5

$game_system.se_play($data_system.decision_se)

$scene = Scene_End.new

end

return

end

end

def update_status

if Input.trigger?(Input::B)

$game_system.se_play($data_system.cancel_se)

@command_window.active = true

@status_window.active = false

@status_window.index = -1

return

end

if Input.trigger?(Input::C)

case @command_window.index

when 1

if $game_party.actors[@status_window.index].restriction >= 2

$game_system.se_play($data_system.buzzer_se)

return

end

$game_system.se_play($data_system.decision_se)

$scene = Scene_Skill.new(@status_window.index)

when 2

$game_system.se_play($data_system.decision_se)

$scene = Scene_Equip.new(@status_window.index)

when 3

$game_system.se_play($data_system.decision_se)

$scene = Scene_Status.new(@status_window.index)

end

return

end

end

end

Now to explain the problem.
The changing of the current map to the specified time seems to work smoothly without a problem. But as soon as I press the menu button to check to see if the time did change to the time I wanted to set it to, it changed right back to the time before the call script.
Also, the AM/PM doesn't seem to be changing whether I try 15 or 3 o'clock.
I really appreciate your work thus far! I hope you could help me out with this little issue if at all possible, even though I have no idea how much work it might be. :p
But ... if you can figure out that issue and it's not too much trouble, could you add month and day resets as well?
It's very unlikely they'll spend a years+ worth of time on the game, so that's not really necessary, but if you could add those last two things, I'd really appreciate it.
I hope I'm not asking for too much!

Thanks again!
 

Seto

Member

Sorry I had forgot to check back again after the first few days. I will have a look and see what I can do. I didn't spend very long on it before and that's when things like this happen :eek:uch: Sorry about that. I will look into it tomorrow if I have time. If anyone else wants to look into this before me, go ahead :P lol.

Looking over it, it's harder to do than I though. All the data is keep and created in separate little methods. I will continue looking into it and give you an update when I have something.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top