Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
| module FUN | |
| module DAY_NIGHT | |
| # Set this to the variable ID that your day counter is set to. | |
| TIME = 20 | |
| # The list to iterate, one of these should be on. | |
| DAY_HASH = { | |
| #Symb <= [switch_id, "Displayed String"], | |
| :MORNING => [1997, "Morning"], | |
| :DAY => [1998, "Day"], | |
| :EVENING => [1999, "Evening"], | |
| :NIGHT => [2000, "Night"] | |
| } | |
| end | |
| end | |
| class Game_Map | |
| # Yanfly melody script snippet. | |
| def name | |
| data = load_data("Data/MapInfos.rvdata") | |
| text = data[@map_id].name.gsub(/\[.*\]/) { "" } | |
| return text | |
| end | |
| end | |
| class Window_MapTitle < Window_Base | |
| def initialize(x,y,width,height) | |
| super(x,y,width,height) | |
| self.contents.clear | |
| self.contents.draw_text(0, 0, width, WLH, $game_map.name) | |
| end | |
| end | |
| class Window_DayNight < Window_Base | |
| def initialize(x,y,width,height) | |
| super(x,y,width,height) | |
| @data = FUN::DAY_NIGHT::DAY_HASH | |
| @time = FUN::DAY_NIGHT::TIME | |
| set_time | |
| end | |
| def set_time | |
| self.contents.clear | |
| done = false | |
| # Iterates through the hash table of the list. | |
| @data.each_value do |node| | |
| # Checks the entire list to determine if any of the switches are on. | |
| # Triggers the first switch to display the text. | |
| if $game_switches[node[0]] | |
| # Adjust the location of the displayed text here. | |
| # Displayed text is located here in node location 1 of the current node. | |
| self.contents.draw_text(32, 0, width-32, WLH, node[1]) | |
| done = true | |
| break | |
| end | |
| end | |
| # If none of the switches are on, you can set a text here. | |
| self.contents.draw_text(32, 0, width-32, WLH, "Broken.") unless done | |
| # Displays the day number. | |
| self.contents.draw_text(0,0, width-16, WLH, $game_variables[@time].to_s) | |
| end | |
| end | |
| class Scene_Menu < Scene_Base | |
| #-------------------------------------------------------------------------- | |
| # * Start processing | |
| #-------------------------------------------------------------------------- | |
| alias funplayer_mod_start start unless $@ | |
| def start | |
| funplayer_mod_start | |
| @map_title_window = Window_MapTitle.new(0,360-(24+32), 160, 24 + 32) | |
| @day_night_window = Window_DayNight.new(0,360-((24+32)*2), 160, 24 + 32) | |
| end | |
| #-------------------------------------------------------------------------- | |
| # * Termination Processing | |
| #-------------------------------------------------------------------------- | |
| alias funplayer_mod_terminate terminate unless $@ | |
| def terminate | |
| funplayer_mod_terminate | |
| @map_title_window.dispose | |
| @day_night_window.dispose | |
| end | |
| #-------------------------------------------------------------------------- | |
| # * Frame Update | |
| #-------------------------------------------------------------------------- | |
| alias funplayer_mod_update update unless $@ | |
| def update | |
| funplayer_mod_update | |
| @map_title_window.update | |
| @day_night_window.update | |
| end | |
| end |