Advertisement
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
- #
- # -----------------------------------------------------------------------------
- # * 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
- HMENU_OPACITY = 200
- #Use faces?
- USEH_FACES = false
- #If you want to use faces, where they should be?
- #OBS: Faces must have same name as the characters graphics, for example
- #001-Fighter01
- FACESH_PATH = "Faces" #in this case, the faces must be in Graphics\Faces
- #Vocabulary
- 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
- def initialize(menu_index=nil)
- @menu_index = $game_menu.last_index
- $game_menu.last_index = 0
- end
- def main
- start
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- terminate
- 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
- create_menu_background
- @command_window = Window_MenuCommand.new
- @command_window.index = @menu_index
- @command_window.opacity = TSDA::HMENU_OPACITY
- @command_window.back_opacity = TSDA::HMENU_OPACITY
- @time_window = Window_PlayTime.new
- @time_window.opacity = TSDA::HMENU_OPACITY
- @time_window.back_opacity = TSDA::HMENU_OPACITY
- @steps_window = Window_Steps.new
- @steps_window.opacity = TSDA::HMENU_OPACITY
- @steps_window.back_opacity = TSDA::HMENU_OPACITY
- @gold_window = Window_Gold.new
- @gold_window.x = 32
- @gold_window.y = 216
- @gold_window.opacity = TSDA::HMENU_OPACITY
- @gold_window.back_opacity = TSDA::HMENU_OPACITY
- @status_window = Window_MenuStatus.new
- @status_window.x = 192
- @status_window.y = 32
- @status_window.opacity = TSDA::HMENU_OPACITY
- @status_window.back_opacity = TSDA::HMENU_OPACITY
- end
- #-----------------------------------------------------------------------------
- def terminate
- dispose_menu_background
- @command_window.dispose
- @time_window.dispose
- @steps_window.dispose
- @gold_window.dispose
- @status_window.dispose
- end
- #-----------------------------------------------------------------------------
- def update
- 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)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::C)
- if $game_party.actors.size == 0 and @command_window.index < 4
- $game_system.se_play($data_system.buzzer_se)
- return
- elsif $game_system.save_disabled 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
- $game_menu.last_index = 0
- return
- when 1
- $game_system.se_play($data_system.decision_se)
- start_actor_selection
- return
- when 2
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Save.new
- $game_menu.last_index = 2
- return
- end
- options_number = $game_menu.options.size
- if @command_window.index == 3 + options_number
- $game_system.se_play($data_system.decision_se)
- $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
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- end
- $game_system.se_play($data_system.decision_se)
- $game_menu.last_index = @command_window.index
- eval(option.code)
- end
- end
- def start_actor_selection
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- end
- #-----------------------------------------------------------------------------
- def update_actor_selection
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- end_actor_selection
- elsif Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- $game_menu.last_index = 1
- $scene = Scene_Chars.new(@status_window.index)
- end
- end
- def end_actor_selection
- @command_window.active = true
- @status_window.active = false
- @status_window.index = -1
- 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
- def draw_actor_face(actor, x, y, size = 96)
- bitmap = RPG::Cache.load_bitmap("Graphics/" + TSDA::FACESH_PATH + "/",
- actor.character_name)
- rect = Rect.new(0, 0, 0, 0)
- rect.width = size
- rect.height = size
- self.contents.blt(x, y, bitmap, rect)
- bitmap.dispose
- end
- end
- #-------------------------------------------------------------------------------
- class Window_MenuCommand < Window_Selectable
- def initialize
- super(32,272,160,176)
- @index = 0
- refresh
- end
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- else
- row = @index / @column_max
- if row < top_row
- self.top_row = row
- end
- if row > bottom_row
- self.bottom_row = row
- end
- rect = item_rect(@index)
- rect.y -= self.oy
- self.cursor_rect = rect
- end
- end
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.width = (self.contents.width) / @column_max
- rect.height = 24
- rect.x = index % @column_max * (rect.width)
- rect.y = index / @column_max * 24
- return rect
- end
- def row_max
- return (@item_max + @column_max - 1) / @column_max
- end
- def top_row
- return self.oy / 24
- end
- def top_row=(row)
- row = 0 if row < 0
- row = row_max - 1 if row > row_max - 1
- self.oy = row * 24
- end
- def page_row_max
- return (self.height - 32) / 24
- end
- def page_item_max
- return page_row_max * @column_max
- end
- def bottom_row
- return top_row + page_row_max - 1
- end
- def bottom_row=(row)
- self.top_row = row - (page_row_max - 1)
- end
- #-----------------------------------------------------------------------------
- def refresh
- s1 = $data_system.words.item
- s2 = TSDA::Chars
- s3 = "Salvar"
- ends = "Sair"
- @item_max = 4 + $game_menu.options.size
- self.contents = Bitmap.new(width - 32,height - 32 + (@item_max - 6) * 24)
- if $game_party.actors.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.rxdata")
- end
- #-----------------------------------------------------------------------------
- def map_name
- return @map_infos[@map_id].name
- end
- end
- #-------------------------------------------------------------------------------
- class Window_PlayTime < Window_Base
- def initialize
- super(32,32,160,104)
- self.contents = Bitmap.new(width - 32,height - 32)
- 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,24,$game_map.map_name,1)
- self.contents.font.color = system_color
- self.contents.draw_text(0, 24, 128, 24, TSDA::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, 24 * 2, 128, 24, text, 1)
- end
- end
- class Window_Gold < Window_Base
- def initialize
- super(32, 32, 160, 56)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- refresh
- end
- def refresh
- self.contents.clear
- cx = contents.text_size($data_system.words.gold).width
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 120-cx-2, 24, $game_party.gold.to_s, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(124-cx, 0, cx, 24, $data_system.words.gold, 2)
- end
- end
- #-------------------------------------------------------------------------------
- class Window_Steps < Window_Base
- def initialize
- super(32, 136, 160, 80)
- self.contents = Bitmap.new(width - 32,height - 32)
- refresh
- end
- #-----------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(0, 0, 128, 24, TSDA::Steps,1)
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 24, 128, 24, $game_party.steps.to_s, 1)
- end
- end
- #-------------------------------------------------------------------------------
- class Scene_Chars
- def initialize(actor_index = 0,menu_index = 0)
- @actor_index = actor_index
- @menu_index = menu_index
- end
- def main
- start
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- terminate
- 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
- create_menu_background
- actor = $game_party.actors[@actor_index]
- @status_window = Window_StatusMenu.new(48,32,544,164,actor)
- @status_window.opacity = TSDA::HMENU_OPACITY
- @status_window.back_opacity = TSDA::HMENU_OPACITY
- @exp_window = Window_ExpStatus.new(48,276,212,172,actor)
- @exp_window.opacity = TSDA::HMENU_OPACITY
- @exp_window.back_opacity = TSDA::HMENU_OPACITY
- @equip_window = Window_EquipHab.new(260,196,332,252,actor)
- @equip_window.opacity = TSDA::HMENU_OPACITY
- @equip_window.back_opacity = TSDA::HMENU_OPACITY
- s1 = "Habilidades"
- s2 = "Equipamento"
- @command_window = Window_Command_Special.new(212, [s1,s2])
- @command_window.x = 48
- @command_window.y = 196
- @command_window.index = @menu_index
- @command_window.opacity = TSDA::HMENU_OPACITY
- @command_window.back_opacity = TSDA::HMENU_OPACITY
- end
- #-----------------------------------------------------------------------------
- def terminate
- 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)
- $game_system.se_play($data_system.cancel_se)
- return_scene
- elsif Input.trigger?(Input::R)
- $game_system.se_play($data_system.cursor_se)
- next_actor
- elsif Input.trigger?(Input::L)
- $game_system.se_play($data_system.cursor_se)
- prev_actor
- elsif Input.trigger?(Input::C)
- if @command_window.index == 1
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Equip.new(@actor_index)
- else
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Skill.new(@actor_index)
- end
- end
- end
- #-----------------------------------------------------------------------------
- def return_scene
- $scene = Scene_Menu.new(3)
- end
- #-----------------------------------------------------------------------------
- def next_actor
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- $scene = Scene_Chars.new(@actor_index)
- end
- #-----------------------------------------------------------------------------
- def prev_actor
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- $scene = Scene_Chars.new(@actor_index)
- end
- end
- class Window_Command_Special < Window_Selectable
- attr_reader :commands
- def initialize(width, commands)
- super(0, 0, width, 48 + 32)
- self.contents = Bitmap.new(width - 32,height - 32)
- @commands = commands
- @item_max = commands.size
- refresh
- self.index = 0
- end
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- else
- rect = item_rect(@index)
- rect.y -= self.oy
- self.cursor_rect = rect
- end
- end
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.width = (self.contents.width) / @column_max
- rect.height = 24
- rect.x = index % @column_max * (rect.width)
- rect.y = index / @column_max * 24
- return rect
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- def draw_item(index, enabled = true)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(rect, @commands[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)
- self.contents = Bitmap.new(width - 32,height - 32)
- @actor = actor
- refresh
- end
- #-----------------------------------------------------------------------------
- def refresh
- self.contents.clear
- end
- #-----------------------------------------------------------------------------
- def draw_basic_info(x, y)
- draw_actor_level(@actor, x, y)
- draw_actor_state(@actor, x, y + 24)
- draw_actor_hp(@actor, x, y + 48)
- draw_actor_sp(@actor, x, y + 72)
- end
- #-----------------------------------------------------------------------------
- def draw_parameters(x, y)
- draw_actor_parameter(@actor, x, y, 3)
- draw_actor_parameter(@actor, x, y + 24, 4)
- draw_actor_parameter(@actor, x, y + 48, 5)
- draw_actor_parameter(@actor, x, y + 72, 6)
- end
- #-----------------------------------------------------------------------------
- def draw_exp_info(x, y)
- s1 = @actor.exp_s
- s2 = @actor.next_rest_exp_s
- s_next = sprintf("Próximo %s", "Nível")
- self.contents.font.color = system_color
- self.contents.draw_text(x, y + 10, 180, 24, "Experiência Total")
- self.contents.draw_text(x, y + 58, 180, 24, s_next)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y + 34, 180, 24, s1, 2)
- self.contents.draw_text(x, y + 82, 180, 24, s2, 2)
- end
- #-----------------------------------------------------------------------------
- def draw_equipments(x, y)
- @data = []
- @data.push($data_weapons[@actor.weapon_id])
- @data.push($data_armors[@actor.armor1_id])
- @data.push($data_armors[@actor.armor2_id])
- @data.push($data_armors[@actor.armor3_id])
- @data.push($data_armors[@actor.armor4_id])
- @item_max = @data.size
- self.contents.font.color = system_color
- self.contents.draw_text(4, y, 92, 24, $data_system.words.weapon)
- self.contents.draw_text(4, y + 24 * 1, 92, 24, $data_system.words.armor1)
- self.contents.draw_text(4, y + 24 * 2, 92, 24, $data_system.words.armor2)
- self.contents.draw_text(4, y + 24 * 3, 92, 24, $data_system.words.armor3)
- self.contents.draw_text(4, y + 24 * 4, 92, 24, $data_system.words.armor4)
- draw_item_name(@data[0], 100, y)
- draw_item_name(@data[1], 100, y + 24 * 1)
- draw_item_name(@data[2], 100, y + 24 * 2)
- draw_item_name(@data[3], 100, y + 24 * 3)
- draw_item_name(@data[4], 100, y + 24 * 4)
- end
- end
- #-------------------------------------------------------------------------------
- class Window_StatusMenu < Window_MenuStatus_Base
- def refresh
- super
- draw_actor_name(@actor, 4, 0)
- draw_actor_class(@actor, 128, 0)
- if TSDA::USEH_FACES
- draw_actor_face(@actor,0,32)
- else
- draw_actor_graphic(@actor, 16, 96)
- end
- draw_basic_info(128, 24)
- self.contents.font.color = orange_color
- self.contents.draw_text(280,0,128,32,TSDA::Atrib)
- draw_parameters(310,24)
- end
- end
- #-------------------------------------------------------------------------------
- class Window_ExpStatus < Window_MenuStatus_Base
- def refresh
- super
- self.contents.font.color = orange_color
- self.contents.draw_text(0,0,180,32,TSDA::Exper,1)
- draw_exp_info(0,24)
- end
- end
- #-------------------------------------------------------------------------------
- class Window_EquipHab < Window_MenuStatus_Base
- def refresh
- super
- self.contents.font.color = orange_color
- self.contents.draw_text(0,0,300,24,TSDA::Equipm,1)
- draw_equipments(0,24)
- end
- end
- class Window_MenuStatus < Window_Selectable
- def initialize
- super(192, 32, 416, 416)
- self.contents = Bitmap.new(width - 32,height - 32)
- refresh
- self.active = false
- self.index = -1
- end
- def refresh
- self.contents.clear
- @item_max = $game_party.actors.size
- for actor in $game_party.actors
- if TSDA::USEH_FACES
- draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
- else
- draw_actor_graphic(actor, 18, actor.index * 96 + 64)
- end
- x = 104
- y = actor.index * 96 + 24 / 2
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x + 120, y)
- draw_actor_level(actor, x, y + 24 * 1)
- draw_actor_state(actor, x, y + 24 * 2)
- draw_actor_hp(actor, x + 120, y + 24 * 1)
- draw_actor_sp(actor, x + 120, y + 24 * 2)
- end
- end
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- elsif @index < @item_max
- self.cursor_rect.set(0, @index * 96, contents.width, 96)
- elsif @index >= 100
- self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
- else
- self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
- end
- 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_Load
- 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
- #===============================================================================
- # ADICIONE AQUI SUAS OPÇÕES!!!!!
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement