Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # http://thiagodd.blogspot.com.br
- # [TSDA] Super Menu
- # by thiago_d_d - por fazer o script
- #
- # -----------------------------------------------------------------------------
- # * Features
- # -----------------------------------------------------------------------------
- # + No options limits(you can add custom options, easily)
- # + Custom BGs.
- # + These options can be activated by switches.
- # + Changes the Equipments,Habilities,etc options by one option only.
- # + New status menu.
- #
- # -----------------------------------------------------------------------------
- # * Install
- # -----------------------------------------------------------------------------
- # Put this script in the aditional scripts section.
- #
- # -----------------------------------------------------------------------------
- # * Configuration
- # -----------------------------------------------------------------------------
- # ----To add new options
- # Add an line in this format to the end of this script
- # $game_menu.add_option(name,code,switch_id)
- # in the place of name put the option name
- # --
- # in the place of code put the code that will be executed when the option is
- # activated
- # --
- # in the place of switch_id put the switch id that will activate/deactivate
- # the option, or put nil if you don't want to use switches.
- #
- # ----Example
- # $game_menu.add_option("Monsters","$scene = Bestiary.new",nil)
- #
- # OBS: The commands order depends on the order you put these lines.
- #===============================================================================
- module TSDA
- #Background
- #This can be "Black", so there is no BG
- #This can be "Map", so the BG will be the map
- #This can be an image name, so the BG will be custom
- MENU_BACK = "Map"
- #Windows Opacity
- WINDOWH_OPACITY = 200
- end
- # Vocabulary
- module Vocab
- PlayTime = "Tempo de jogo"
- Steps = "Passos"
- Chars = "Heróis"
- Atrib = "Atributos"
- Exper = "Experiência"
- Equipm = "Equipamentos"
- end
- #-------------------------------------------------------------------------------
- class Game_Option
- attr_reader :name
- attr_reader :code
- attr_reader :switch
- #-----------------------------------------------------------------------------
- def initialize(option_name,option_code,switch_id)
- @name = option_name
- @code = option_code
- @switch = switch_id
- end
- end
- #-------------------------------------------------------------------------------
- class Game_Menu
- attr_reader :options
- attr_accessor :last_index
- #-----------------------------------------------------------------------------
- def initialize
- @options = []
- @last_index = 0
- end
- #-----------------------------------------------------------------------------
- def add_option(option_name,option_code,switch_id)
- option = Game_Option.new(option_name,option_code,switch_id)
- @options.push(option)
- end
- end
- $game_menu = Game_Menu.new
- #-------------------------------------------------------------------------------
- class Scene_Menu < Scene_Base
- def initialize(menu_index=nil)
- @menu_index = $game_menu.last_index
- $game_menu.last_index = 0
- end
- def create_menu_background
- if TSDA::MENU_BACK == "Map"
- @menuback_sprite = Spriteset_Map.new
- elsif TSDA::MENU_BACK != "Black"
- @menuback_sprite = Sprite.new
- @menuback_sprite.bitmap = RPG::Cache.picture(TSDA::MENU_BACK)
- end
- update_menu_background
- end
- def dispose_menu_background
- if @menuback_sprite != nil
- @menuback_sprite.dispose
- end
- end
- def update_menu_background
- if @menuback_sprite != nil
- @menuback_sprite.update
- end
- end
- #-----------------------------------------------------------------------------
- def start
- super
- create_menu_background
- @command_window = Window_MenuCommand.new
- @command_window.index = @menu_index
- @command_window.opacity = TSDA::WINDOWH_OPACITY
- @command_window.back_opacity = TSDA::WINDOWH_OPACITY
- @time_window = Window_PlayTime.new
- @time_window.opacity = TSDA::WINDOWH_OPACITY
- @time_window.back_opacity = TSDA::WINDOWH_OPACITY
- @steps_window = Window_Steps.new
- @steps_window.opacity = TSDA::WINDOWH_OPACITY
- @steps_window.back_opacity = TSDA::WINDOWH_OPACITY
- @gold_window = Window_Gold.new(0,184)
- @gold_window.opacity = TSDA::WINDOWH_OPACITY
- @gold_window.back_opacity = TSDA::WINDOWH_OPACITY
- @status_window = Window_MenuStatus.new(160, 0)
- @status_window.opacity = TSDA::WINDOWH_OPACITY
- @status_window.back_opacity = TSDA::WINDOWH_OPACITY
- end
- #-----------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @command_window.dispose
- @time_window.dispose
- @steps_window.dispose
- @gold_window.dispose
- @status_window.dispose
- end
- #-----------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @command_window.update
- @time_window.update
- @steps_window.update
- @gold_window.update
- @status_window.update
- if @command_window.active
- update_command_selection
- elsif @status_window.active
- update_actor_selection
- end
- end
- #-----------------------------------------------------------------------------
- def update_command_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::C)
- if $game_party.members.size == 0 and @command_window.index < 4
- Sound.play_buzzer
- return
- elsif $game_system.save_disabled and @command_window.index == 4
- Sound.play_buzzer
- return
- end
- case @command_window.index
- when 0
- Sound.play_decision
- $scene = Scene_Item.new
- $game_menu.last_index = 0
- return
- when 1
- Sound.play_decision
- start_actor_selection
- return
- when 2
- Sound.play_decision
- $scene = Scene_File.new(true, false, false)
- $game_menu.last_index = 2
- return
- end
- options_number = $game_menu.options.size
- if @command_window.index == 3 + options_number
- Sound.play_decision
- $scene = Scene_End.new
- $game_menu.last_index = 3 + options_number
- return
- end
- selected_index = 3 - @command_window.index
- option = $game_menu.options[selected_index]
- if option.switch != nil
- switch = $game_switches[option.switch]
- unless switch
- Sound.play_buzzer
- return
- end
- end
- Sound.play_decision
- $game_menu.last_index = @command_window.index
- eval(option.code)
- end
- end
- #-----------------------------------------------------------------------------
- def update_actor_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_actor_selection
- elsif Input.trigger?(Input::C)
- $game_party.last_actor_index = @status_window.index
- Sound.play_decision
- $game_menu.last_index = 1
- $scene = Scene_Chars.new(@status_window.index)
- end
- end
- end
- #-------------------------------------------------------------------------------
- class Window_Base
- def disabled_color
- return Color.new(normal_color.red,normal_color.green,normal_color.blue,128)
- end
- #-----------------------------------------------------------------------------
- def orange_color
- return Color.new(255,126,0)
- end
- end
- #-------------------------------------------------------------------------------
- class Window_MenuCommand < Window_Selectable
- def initialize
- super(0,240,160,176)
- @index = 0
- refresh
- end
- #-----------------------------------------------------------------------------
- def refresh
- s1 = Vocab::item
- s2 = Vocab::Chars
- s3 = Vocab::save
- ends = Vocab::game_end
- @item_max = 4 + $game_menu.options.size
- create_contents
- if $game_party.members.size == 0
- self.contents.font.color = disabled_color
- else
- self.contents.font.color = normal_color
- end
- self.contents.draw_text(item_rect(0),s1)
- self.contents.draw_text(item_rect(1),s2)
- if $game_system.save_disabled
- self.contents.font.color = disabled_color
- else
- self.contents.font.color = normal_color
- end
- self.contents.draw_text(item_rect(2),s3)
- item_count = 0
- for i in $game_menu.options
- if i.switch != nil
- if $game_switches[i.switch]
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- else
- self.contents.font.color = normal_color
- end
- self.contents.draw_text(item_rect(3 + item_count),i.name)
- item_count += 1
- end
- self.contents.font.color = normal_color
- self.contents.draw_text(item_rect(3 + item_count),ends)
- end
- end
- #-------------------------------------------------------------------------------
- class Game_Map
- alias hyper_menu_initialize initialize
- def initialize
- hyper_menu_initialize
- @map_infos = load_data("Data/MapInfos.rvdata")
- end
- #-----------------------------------------------------------------------------
- def map_name
- return @map_infos[@map_id].name
- end
- end
- #-------------------------------------------------------------------------------
- class Window_PlayTime < Window_Base
- def initialize
- super(0,0,160,104)
- refresh
- end
- #-----------------------------------------------------------------------------
- def update
- super
- if Graphics.frame_count / Graphics.frame_rate != @total_sec
- refresh
- end
- end
- #-----------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = orange_color
- self.contents.draw_text(0,0,128,WLH,$game_map.map_name,1)
- self.contents.font.color = system_color
- self.contents.draw_text(0, WLH, 128, WLH, Vocab::PlayTime,1)
- @total_sec = Graphics.frame_count / Graphics.frame_rate
- hour = @total_sec / 60 / 60
- min = @total_sec / 60 % 60
- sec = @total_sec % 60
- text = sprintf("%02d:%02d:%02d", hour, min, sec)
- self.contents.font.color = normal_color
- self.contents.draw_text(0, WLH * 2, 128, WLH, text, 1)
- end
- end
- #-------------------------------------------------------------------------------
- class Window_Steps < Window_Base
- def initialize
- super(0, 104, 160, 80)
- refresh
- end
- #-----------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(0, 0, 128, WLH, Vocab::Steps,1)
- self.contents.font.color = normal_color
- self.contents.draw_text(0, WLH, 128, WLH, $game_party.steps.to_s, 1)
- end
- end
- #-------------------------------------------------------------------------------
- class Scene_Chars < Scene_Base
- def initialize(actor_index = 0,menu_index = 0)
- @actor_index = actor_index
- @menu_index = menu_index
- end
- def create_menu_background
- if TSDA::MENU_BACK == "Map"
- @menuback_sprite = Spriteset_Map.new
- elsif TSDA::MENU_BACK != "Black"
- @menuback_sprite = Sprite.new
- @menuback_sprite.bitmap = RPG::Cache.picture(TSDA::MENU_BACK)
- end
- update_menu_background
- end
- def dispose_menu_background
- if @menuback_sprite != nil
- @menuback_sprite.dispose
- end
- end
- def update_menu_background
- if @menuback_sprite != nil
- @menuback_sprite.update
- end
- end
- #-----------------------------------------------------------------------------
- def start
- super
- create_menu_background
- actor = $game_party.members[@actor_index]
- @status_window = Window_StatusMenu.new(0,0,544,164,actor)
- @status_window.opacity = TSDA::WINDOWH_OPACITY
- @status_window.back_opacity = TSDA::WINDOWH_OPACITY
- @exp_window = Window_ExpStatus.new(0,244,212,172,actor)
- @exp_window.opacity = TSDA::WINDOWH_OPACITY
- @exp_window.back_opacity = TSDA::WINDOWH_OPACITY
- @equip_window = Window_EquipHab.new(212,164,332,252,actor)
- @equip_window.opacity = TSDA::WINDOWH_OPACITY
- @equip_window.back_opacity = TSDA::WINDOWH_OPACITY
- s1 = Vocab::skill
- s2 = Vocab::equip
- @command_window = Window_Command.new(212, [s1,s2])
- @command_window.y = 164
- @command_window.index = @menu_index
- @command_window.opacity = TSDA::WINDOWH_OPACITY
- @command_window.back_opacity = TSDA::WINDOWH_OPACITY
- end
- #-----------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @status_window.dispose
- @command_window.dispose
- @exp_window.dispose
- @equip_window.dispose
- end
- #-----------------------------------------------------------------------------
- def update
- update_menu_background
- @status_window.update
- @command_window.update
- @exp_window.update
- @equip_window.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- return_scene
- elsif Input.trigger?(Input::R)
- Sound.play_cursor
- next_actor
- elsif Input.trigger?(Input::L)
- Sound.play_cursor
- prev_actor
- elsif Input.trigger?(Input::C)
- if @command_window.index == 1
- Sound.play_decision
- $scene = Scene_Equip.new(@actor_index)
- else
- Sound.play_decision
- $scene = Scene_Skill.new(@actor_index)
- end
- end
- super
- end
- #-----------------------------------------------------------------------------
- def return_scene
- $scene = Scene_Menu.new(3)
- end
- #-----------------------------------------------------------------------------
- def next_actor
- @actor_index += 1
- @actor_index %= $game_party.members.size
- $scene = Scene_Chars.new(@actor_index)
- end
- #-----------------------------------------------------------------------------
- def prev_actor
- @actor_index += $game_party.members.size - 1
- @actor_index %= $game_party.members.size
- $scene = Scene_Chars.new(@actor_index)
- end
- end
- #-------------------------------------------------------------------------------
- class Scene_Skill
- def return_scene
- $scene = Scene_Chars.new(@actor_index,0)
- end
- end
- #-------------------------------------------------------------------------------
- class Scene_Equip
- def return_scene
- $scene = Scene_Chars.new(@actor_index,1)
- end
- end
- #-------------------------------------------------------------------------------
- class Window_MenuStatus_Base < Window_Base
- def initialize(x,y,width,height,actor)
- super(x,y,width,height)
- @actor = actor
- refresh
- end
- #-----------------------------------------------------------------------------
- def refresh
- self.contents.clear
- end
- #-----------------------------------------------------------------------------
- def draw_basic_info(x, y)
- draw_actor_level(@actor, x, y + WLH * 0)
- draw_actor_state(@actor, x, y + WLH * 1)
- draw_actor_hp(@actor, x, y + WLH * 2)
- draw_actor_mp(@actor, x, y + WLH * 3)
- end
- #-----------------------------------------------------------------------------
- def draw_parameters(x, y)
- draw_actor_parameter(@actor, x, y + WLH * 0, 0)
- draw_actor_parameter(@actor, x, y + WLH * 1, 1)
- draw_actor_parameter(@actor, x, y + WLH * 2, 2)
- draw_actor_parameter(@actor, x, y + WLH * 3, 3)
- end
- #-----------------------------------------------------------------------------
- def draw_exp_info(x, y)
- s1 = @actor.exp_s
- s2 = @actor.next_rest_exp_s
- s_next = sprintf(Vocab::ExpNext, Vocab::level)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)
- self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 2)
- self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 2)
- end
- #-----------------------------------------------------------------------------
- def draw_equipments(x, y)
- @data = []
- for item in @actor.equips do @data.push(item) end
- @item_max = @data.size
- self.contents.font.color = system_color
- if @actor.two_swords_style
- self.contents.draw_text(4, y, 92, WLH, Vocab::weapon1)
- self.contents.draw_text(4, y + WLH * 1, 92, WLH, Vocab::weapon2)
- else
- self.contents.draw_text(4, y, 92, WLH, Vocab::weapon)
- self.contents.draw_text(4, y + WLH * 1, 92, WLH, Vocab::armor1)
- end
- self.contents.draw_text(4, y + WLH * 2, 92, WLH, Vocab::armor2)
- self.contents.draw_text(4, y + WLH * 3, 92, WLH, Vocab::armor3)
- self.contents.draw_text(4, y + WLH * 4, 92, WLH, Vocab::armor4)
- draw_item_name(@data[0], 100, y)
- draw_item_name(@data[1], 100, y + WLH * 1)
- draw_item_name(@data[2], 100, y + WLH * 2)
- draw_item_name(@data[3], 100, y + WLH * 3)
- draw_item_name(@data[4], 100, y + WLH * 4)
- end
- end
- #-------------------------------------------------------------------------------
- class Window_StatusMenu < Window_MenuStatus_Base
- def refresh
- super
- draw_actor_name(@actor, 4, 0)
- draw_actor_class(@actor, 128, 0)
- draw_actor_face(@actor, 8, 32)
- draw_basic_info(128, 32)
- self.contents.font.color = orange_color
- self.contents.draw_text(280,0,128,WLH,Vocab::Atrib)
- draw_parameters(280,WLH)
- end
- end
- #-------------------------------------------------------------------------------
- class Window_ExpStatus < Window_MenuStatus_Base
- def refresh
- super
- self.contents.font.color = orange_color
- self.contents.draw_text(0,0,180,WLH,Vocab::Exper,1)
- draw_exp_info(0,WLH * 2)
- end
- end
- #-------------------------------------------------------------------------------
- class Window_EquipHab < Window_MenuStatus_Base
- def refresh
- super
- self.contents.font.color = orange_color
- self.contents.draw_text(0,0,300,WLH,Vocab::Equipm,1)
- draw_equipments(0,WLH * 2)
- end
- end
- #-------------------------------------------------------------------------------
- class Scene_Title
- alias hyper_menu_command_new_game command_new_game
- def command_new_game
- hyper_menu_command_new_game
- $game_menu.last_index = 0
- end
- end
- #-------------------------------------------------------------------------------
- class Scene_File
- alias hyper_menu_read_save_data read_save_data
- def read_save_data(file)
- hyper_menu_read_save_data(file)
- $game_menu.last_index = 0
- end
- end
- #===============================================================================
- # Add here your options
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment