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.

Trickster's Time System Edit

Status
Not open for further replies.
I'd like an edit of his script to make it do real-time, as in if your computer's time was 1:00 AM, the time in the game would be 1:00 AM. Sorta like in Pokemon or Animal Crossing games.

I'd also like it to be compatible with Mr.Mo's ABS.

Thanks. :)
 

poccil

Sponsor

Ruby's built-in Time class has most of the functionality needed:

Time.now.mday - Gets the current day of the month
Time.now.hour - Gets the current hour

See "Time" in the RPG Maker XP documentation for more details on possible equivalents.

Here is the modification:

Code:
class Game_Time
  # Months in demo were misspelled
  Months = %W( January February March April May June July August September
  October November December )
  # Changes for real time
  def minutes
     return Time.now.min
  end
  def hours
     return Time.now.hour
  end
  def years
     return Time.now.year
  end
  def current_month
     return Months[Time.now.mon]
  end
  def current_day
     return Days[Time.now.wday]
  end
  def days
     return Time.now.mday
  end
  def months
     return Time.now.mon
  end
end
 

poccil

Sponsor

Oops... Apparently, Game_Time uses the word Time. This should solve it:

Code:
class Game_Time
  # Months in demo were misspelled
  Months = %W( January February March April May June July August September
  October November December )
  # Changes for real time
  def minutes
     return ::Time.now.min
  end
  def hours
     return ::Time.now.hour
  end
  def years
     return ::Time.now.year
  end
  def current_month
     return Months[::Time.now.mon]
  end
  def current_day
     return Days[::Time.now.wday]
  end
  def days
     return ::Time.now.mday
  end
  def months
     return ::Time.now.mon
  end
end
 
This topic has been resolved. If Itachi62 or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
Status
Not open for further replies.

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