Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #═╦═════════════════════════════════════════════════════════════════════════════
- # ║ § SES - Time: Wait (v1.1) by Solistra [License: CC BY-SA 3.0]
- # ║ <RMVX Ace>
- #═╬═════════════════════════════════════════════════════════════════════════════
- # ║ § Change Log
- #─╫─────────────────────────────────────────────────────────────────────────────
- # ║ v1.1 (January 4th, 2013) - Compatibility fix to work with Dynamic Time v1.3.
- # ║ v1.0 (December 4th, 2012) - Initial release
- # ║
- #═╬═════════════════════════════════════════════════════════════════════════════
- # ║ § Summary
- #─╫─────────────────────────────────────────────────────────────────────────────
- # ║ This is a simple extension to the SES Dynamic Time script which allows the
- # ║ player to call a "wait" scene that will allow them to wait for an amount of
- # ║ time on the map.
- # ║
- #═╬═════════════════════════════════════════════════════════════════════════════
- # ║ § Required Scripts
- #─╫─────────────────────────────────────────────────────────────────────────────
- # ║ The SES Dynamic Time script (version 1.3 or higher) is required in order to
- # ║ use this script.
- # ║
- #═╬═════════════════════════════════════════════════════════════════════════════
- # ║ § Known Incompatibilities
- #─╫─────────────────────────────────────────────────────────────────────────────
- # ║ See the SES Dynamic Time script for known incompatibilities.
- # ║
- #═╬═════════════════════════════════════════════════════════════════════════════
- # ║ § Installation
- #─╫─────────────────────────────────────────────────────────────────────────────
- # ║ Place this script below the SES Dynamic Time script, above any other custom
- # ║ scripts, and above Main.
- # ║
- #═╬═════════════════════════════════════════════════════════════════════════════
- # ║ § Configuration
- #─╫─────────────────────────────────────────────────────────────────────────────
- # ║ This is a relatively simple scene. In the configuration area, simply set
- # ║ which unit of time you want the scene to use, the name of this unit as it
- # ║ will appear in the scene, the input key that players will use to call the
- # ║ scene from the map, and the maximum amount of time that the player is
- # ║ allowed to wait.
- # ║
- # ║ For those of you who are completely insane (or just like customizing things
- # ║ far too much for your own good), you can also change the x, y, width, and
- # ║ height values for the two windows used in the scene.
- # ║
- #═╬═════════════════════════════════════════════════════════════════════════════
- # ║ § Tags
- #─╫─────────────────────────────────────────────────────────────────────────────
- # ║ ● Map
- # ║ <time no_wait>
- # ║ Suppresses waiting on this map only.
- # ║
- #═╬═════════════════════════════════════════════════════════════════════════════
- # ║ § Aliased Methods
- #─╫─────────────────────────────────────────────────────────────────────────────
- # ║ ● Scene_Map
- # ║ update
- # ║
- #═╬═════════════════════════════════════════════════════════════════════════════
- # ║ § New Methods
- #─╫─────────────────────────────────────────────────────────────────────────────
- # ║ ● Game_Map
- # ║ no_wait?
- # ║ ● Scene_Map
- # ║ update_call_wait
- # ║ call_wait
- # ║
- #═╬═════════════════════════════════════════════════════════════════════════════
- # ║ ▼ module SES::Time::Wait
- #═╩═════════════════════════════════════════════════════════════════════════════
- module SES module Time module Wait
- #═╦═══════════════════════════════════════════════════════════════════════════
- # ║ α BEGIN CONFIGURATION
- #═╩═══════════════════════════════════════════════════════════════════════════
- # The unit of time (and its name) to use for waiting.
- UNIT = :hour
- UNIT_NAME = "hour"
- # The input key used to call the wait scene on the map.
- KEY = :R
- # The maximum amount of time that the player may wait.
- MAX = 24
- # The x, y, width, and height of the wait window and command window for the
- # scene. (Note: the command window's height cannot be changed this way.)
- WIN_ARGS = [Graphics.width / 2 - 100, Graphics.height / 2 - 48, 200, 48]
- CMD_ARGS = [Graphics.width / 2 - 100, Graphics.height / 2, 200]
- #═╦═══════════════════════════════════════════════════════════════════════════
- # ║ Ω END CONFIGURATION
- #─╫───────────────────────────────────────────────────────────────────────────
- # ║ ▼ class Window_Wait
- #═╩═══════════════════════════════════════════════════════════════════════════
- class Window_Wait < Window_Base
- attr_accessor :amount
- def initialize() @amount = 1; super(*WIN_ARGS); refresh end
- def refresh
- self.contents.clear
- text = "Wait #{@amount} " << (@amount > 1 ? "#{UNIT_NAME}s" : UNIT_NAME)
- text << "?"
- draw_text(self.contents.rect, text, 1)
- end
- end
- #═╦═══════════════════════════════════════════════════════════════════════════
- # ║ ▲ class Window_Wait
- #─╫───────────────────────────────────────────────────────────────────────────
- # ║ ▼ class Window_WaitCommand
- #═╩═══════════════════════════════════════════════════════════════════════════
- class Window_WaitCommand < Window_Command
- def initialize() super(*CMD_ARGS[0..1]) end
- def window_width() CMD_ARGS.last end
- def make_command_list
- add_command("OK", :ok)
- add_command(Vocab::cancel, :cancel)
- end
- end
- #═╦═══════════════════════════════════════════════════════════════════════════
- # ║ ▲ class Window_Wait
- #─╫───────────────────────────────────────────────────────────────────────────
- # ║ ▼ class Scene
- #═╩═══════════════════════════════════════════════════════════════════════════
- class Scene < Scene_MenuBase
- def start() super; create_wait_windows end
- def create_wait_windows
- @wait_window = Wait::Window_Wait.new
- @command_window = Wait::Window_WaitCommand.new
- @command_window.set_handler(:ok, method(:process_ok))
- @command_window.set_handler(:cancel, method(:return_scene))
- end
- def update
- super
- update_amount if Input.repeat?(:LEFT) || Input.repeat?(:RIGHT)
- end
- def process_ok
- $game_system.time.traverse(UNIT, @wait_window.amount)
- return_scene
- end
- def update_amount
- return if @wait_window.amount <= 1 && Input.repeat?(:LEFT)
- return if @wait_window.amount >= MAX && Input.repeat?(:RIGHT)
- Sound.play_cursor
- @wait_window.amount -= 1 if Input.repeat?(:LEFT)
- @wait_window.amount += 1 if Input.repeat?(:RIGHT)
- @wait_window.refresh
- end
- end
- #═╦═══════════════════════════════════════════════════════════════════════════
- # ║ ▲ class Scene
- #═╩═══════════════════════════════════════════════════════════════════════════
- end end end
- #═╦═════════════════════════════════════════════════════════════════════════════
- # ║ ▲ module SES::Time::Wait
- #═╩═════════════════════════════════════════════════════════════════════════════
- ($imported ||= {})["SES - Time: Wait"] = 1.1
- if $imported["SES - Time"].nil? || $imported["SES - Time"] < 1.3
- raise("SES Wait requires SES Time v1.3 or greater.")
- end
- #═╦═════════════════════════════════════════════════════════════════════════════
- # ║ ▼ class Game_Map
- #═╩═════════════════════════════════════════════════════════════════════════════
- class Game_Map
- def no_wait?(map = @map)
- (map.note =~ /\<time no\_wait\>/ ? true : false) unless map.nil?
- end
- end
- #═╦═════════════════════════════════════════════════════════════════════════════
- # ║ ▲ class Game_Map
- #─╫─────────────────────────────────────────────────────────────────────────────
- # ║ ▼ class Scene_Map
- #═╩═════════════════════════════════════════════════════════════════════════════
- class Scene_Map < Scene_Base
- alias :ses_time_wait_map_upd :update
- def update(*args, &block)
- ses_time_wait_map_upd(*args, &block)
- update_call_wait unless $game_map.no_wait?
- end
- def update_call_wait() call_wait if Input.trigger?(SES::Time::Wait::KEY) end
- def call_wait() Sound.play_ok; SceneManager.call(SES::Time::Wait::Scene) end
- end
- #═╦═════════════════════════════════════════════════════════════════════════════
- # ║ ▲ class Scene_Map
- #═╩═════════════════════════════════════════════════════════════════════════════
Advertisement
Add Comment
Please, Sign In to add comment