Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================#
- # Script by: Tigurus Fay #
- #==============================================================================#
- # Script: One-Player Menu Script #
- # Version: v1.1.2 (ACE) #
- # Install: Press F11 and place the Script directly above [Main]. #
- # Description: This script allows a menu optimized for 1 player only. #
- #==============================================================================#
- #==============================================================================#
- # ** Support #
- #------------------------------------------------------------------------------#
- # If you require support because there is an error with this script or would #
- # be incompatible with another script, please contact the creator at the #
- # following websites: #
- # - RPGMaker.org - http://www.rpgmaker.org/resources/view.asp?id=57 #
- # #
- #==============================================================================#
- # ** Compatibility #
- #------------------------------------------------------------------------------#
- # This script may be incompatible with the following scripts: #
- # - HUD Scripts #
- # - Untested with other scripts #
- #==============================================================================#
- # ** Terms & Conditions #
- #------------------------------------------------------------------------------#
- # - You may use this script for your game
- # - You may modify this script
- # - You may distribute this script
- # (Though I would like you to redirect to one of the links located in the script)
- # - You may not use this script for commercial games unless discussed with the creator
- # - Credit is always necessary!
- #==============================================================================#
- # ** Config #
- #------------------------------------------------------------------------------#
- # Here you can configurate several external options. #
- #==============================================================================#
- module TOPSVOCAB
- # Here you can change the names of certain items in the Menu.
- # Change Icon:
- # !!! NOTE !!! Don't forget to create a folder named "Icons" for the images below!
- # Location Icon
- LOCATION = "Location" # Best result: 24x24 max
- # Change Names of:
- # Party Menu
- EXP = "EXP"
- Equipped = "Equipped Gear"
- Wequipped = "No Weapon Equipped"
- Hequipped = "No Helmet Equipped"
- ARequipped = "No Armor Equipped"
- Sequipped = "No Shield Equipped"
- ACequipped = "No Accessory Equipped"
- # End Game
- TOTITLE = "To Title"
- EXIT = "Exit Game"
- CANCEL = "Cancel"
- end
- #==============================================================================
- # ** Window_Base
- #------------------------------------------------------------------------------
- # This is a super class of all windows within the game.
- #==============================================================================
- class Window_Base
- def exp_gauge_color1; text_color(7); end; # EXP gauge added lower half
- def exp_gauge_color2; text_color(8); end; # EXP gauge added upper half
- def exp_gauge_back_color; text_color(19); end; # EXP Gauge background
- # draws the EXP bar on the Menu
- def draw_expgauge(x, y, width, rate, color1, color2)
- fill_w = (width * rate).to_i
- gauge_y = y + line_height - 8
- contents.fill_rect(x, gauge_y, width, 6, exp_gauge_back_color)
- contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2)
- end
- def draw_exp(actor, x, y, width = 124)
- s1 = actor.max_level? ? "---------" : actor.exp
- s2 = actor.max_level? ? "0" : actor.next_level_exp - actor.exp
- if actor.max_level? ?
- draw_expgauge(x, y, width, 1, exp_gauge_color1, exp_gauge_color2) :
- draw_gauge(x, y,width,((((actor.exp - actor.current_level_exp).to_f/100) / ((actor.next_level_exp.to_f - actor.current_level_exp.to_f)/100))),
- exp_gauge_color1, exp_gauge_color2)
- end
- change_color(system_color)
- draw_text(x, y, 30, line_height, TOPSVOCAB::EXP)
- change_color(normal_color)
- if actor.max_level? ?
- draw_text(x + width - 72, y, 72, line_height, "------------", 2) :
- draw_text(x + width - 72, y, 72, line_height, actor.next_level_exp.to_i - actor.exp.to_i, 2)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Class
- #--------------------------------------------------------------------------
- def draw_actor_class_opm(actor, x, y, width = 200)
- change_color(normal_color)
- draw_text(x, y, width, line_height, actor.class.name)
- end
- end
- #==============================================================================
- # ** Window_Location
- #------------------------------------------------------------------------------
- # This window displays the party's location
- #==============================================================================
- class Window_Location < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, Graphics.width - 340, window_height)
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Window Height
- #--------------------------------------------------------------------------
- def window_height
- return 80
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_location_opm
- end
- def draw_location_opm
- bitmap = Bitmap.new("Graphics/Icons/" + TOPSVOCAB::LOCATION + ".png")
- src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- ret_rect = Rect.new(contents.width - 25, 28, bitmap.width, bitmap.height)
- contents.stretch_blt(ret_rect, bitmap, src_rect)
- draw_text(contents.width - 232, 25, 204, line_height, $game_map.display_name, 2)
- end
- #--------------------------------------------------------------------------
- # * Open Window
- #--------------------------------------------------------------------------
- def open
- refresh
- super
- end
- end
- #==============================================================================
- # ** Window_Gold
- #------------------------------------------------------------------------------
- # This window displays the party's gold.
- #==============================================================================
- class Window_Gold < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, Graphics.width - 340, fitting_height(1))
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
- end
- #--------------------------------------------------------------------------
- # * Get Party Gold
- #--------------------------------------------------------------------------
- def value
- $game_party.gold
- end
- #--------------------------------------------------------------------------
- # Get Currency Unit
- #--------------------------------------------------------------------------
- def currency_unit
- Vocab::currency_unit
- end
- #--------------------------------------------------------------------------
- # * Open Window
- #--------------------------------------------------------------------------
- def open
- refresh
- super
- end
- end
- #==============================================================================
- # ** Window_MenuCommand
- #------------------------------------------------------------------------------
- # This command window appears on the menu screen.
- #==============================================================================
- class Window_MenuCommand < Window_Command
- #--------------------------------------------------------------------------
- # * Initialize Command Selection Position (Class Method)
- #--------------------------------------------------------------------------
- def self.init_command_position
- @@last_command_symbol = nil
- end
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0)
- select_last
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- return 340
- end
- def window_height
- return 128
- end
- def col_max
- return 2
- end
- #--------------------------------------------------------------------------
- # * Get Number of Lines to Show
- #--------------------------------------------------------------------------
- def visible_line_number
- item_max
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- add_main_commands
- add_original_commands
- add_save_command
- add_game_end_command
- end
- #--------------------------------------------------------------------------
- # * Add Main Commands to List
- #--------------------------------------------------------------------------
- def add_main_commands
- add_command(Vocab::item, :item, main_commands_enabled)
- add_command(Vocab::skill, :skill, main_commands_enabled)
- add_command(Vocab::equip, :equip, main_commands_enabled)
- add_command(Vocab::status, :status, main_commands_enabled)
- end
- #--------------------------------------------------------------------------
- # * For Adding Original Commands
- #--------------------------------------------------------------------------
- def add_original_commands
- end
- #--------------------------------------------------------------------------
- # * Add Save to Command List
- #--------------------------------------------------------------------------
- def add_save_command
- add_command(Vocab::save, :save, save_enabled)
- end
- #--------------------------------------------------------------------------
- # * Add Exit Game to Command List
- #--------------------------------------------------------------------------
- def add_game_end_command
- add_command(TOPSVOCAB::TOTITLE, :to_title)
- add_command(TOPSVOCAB::EXIT, :shutdown)
- add_command(TOPSVOCAB::CANCEL, :cancel)
- end
- #--------------------------------------------------------------------------
- # * Get Activation State of Main Commands
- #--------------------------------------------------------------------------
- def main_commands_enabled
- $game_party.exists
- end
- #--------------------------------------------------------------------------
- # * Get Activation State of Formation
- #--------------------------------------------------------------------------
- def formation_enabled
- $game_party.members.size >= 2 && !$game_system.formation_disabled
- end
- #--------------------------------------------------------------------------
- # * Get Activation State of Save
- #--------------------------------------------------------------------------
- def save_enabled
- !$game_system.save_disabled
- end
- #--------------------------------------------------------------------------
- # * Processing When OK Button Is Pressed
- #--------------------------------------------------------------------------
- def process_ok
- @@last_command_symbol = current_symbol
- super
- end
- #--------------------------------------------------------------------------
- # * Restore Previous Selection Position
- #--------------------------------------------------------------------------
- def select_last
- select_symbol(@@last_command_symbol)
- end
- end
- #==============================================================================
- # ** Window_MenuStatus_Opm
- #------------------------------------------------------------------------------
- # This window displays full status specs on the menu screen.
- #==============================================================================
- class Window_MenuStatus_Opm < Window_Selectable
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y, actor)
- super(0, 128, Graphics.width, Graphics.height - 128)
- @actor = $game_party.members[0]
- refresh
- end
- #--------------------------------------------------------------------------
- # * Set Actor
- #--------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_geninfo (line_height * 0)
- draw_basicinfo (line_height * 2)
- draw_parablock (line_height * 1)
- draw_horz_line(line_height * 7)
- draw_equipblock (line_height * 8)
- end
- #--------------------------------------------------------------------------
- # * Draw general info
- #--------------------------------------------------------------------------
- def draw_geninfo(y)
- draw_actor_face(@actor, 8, y)
- draw_actor_fullname(120, y)
- draw_actor_level(@actor, 120, y + line_height * 1)
- draw_actor_class_opm(@actor, 120, y + line_height * 2)
- draw_actor_icons(@actor, 120, y + line_height * 3)
- end
- #--------------------------------------------------------------------------
- # * Draw basic info
- #--------------------------------------------------------------------------
- def draw_basicinfo(y)
- draw_basic_info(8, y)
- end
- #--------------------------------------------------------------------------
- # * Draw parablock
- #--------------------------------------------------------------------------
- def draw_parablock(y)
- draw_parameters(330, y)
- end
- #--------------------------------------------------------------------------
- # * Draw equipblock
- #--------------------------------------------------------------------------
- def draw_equipblock(y)
- draw_equipments(8, y)
- end
- #--------------------------------------------------------------------------
- # * Draw Horizontal Line
- #--------------------------------------------------------------------------
- def draw_horz_line(y)
- line_y = y + line_height / 2 - 1
- contents.fill_rect(0, line_y, contents_width, 2, line_color)
- end
- #--------------------------------------------------------------------------
- # * Get Color of Horizontal Line
- #--------------------------------------------------------------------------
- def line_color
- color = normal_color
- color.alpha = 48
- color
- end
- #--------------------------------------------------------------------------
- # * Draw Basic Information
- #--------------------------------------------------------------------------
- def draw_basic_info(x, y)
- draw_actor_hp(@actor, x, y + line_height * 2)
- draw_actor_mp(@actor, x, y + line_height * 3)
- draw_exp(@actor, x, y + line_height * 4)
- end
- #--------------------------------------------------------------------------
- # * Draw Parameters
- #--------------------------------------------------------------------------
- def draw_parameters(x, y)
- 6.times {|i| draw_actor_param(@actor, x, y + line_height * i, i + 2) }
- end
- #--------------------------------------------------------------------------
- # * Draw Experience Information
- #--------------------------------------------------------------------------
- def draw_exp_info(x, y)
- s1 = @actor.max_level? ? "-------" : @actor.exp
- s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp
- s_next = sprintf(Vocab::ExpNext, Vocab::level)
- change_color(system_color)
- draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal)
- draw_text(x, y + line_height * 2, 180, line_height, s_next)
- change_color(normal_color)
- draw_text(x, y + line_height * 1, 180, line_height, s1, 2)
- draw_text(x, y + line_height * 3, 180, line_height, s2, 2)
- end
- #--------------------------------------------------------------------------
- # * Draw Equipment
- #--------------------------------------------------------------------------
- def draw_equipments(x, y)
- change_color(system_color)
- draw_text(x, y, 180, line_height, TOPSVOCAB::Equipped, 0)
- change_color(normal_color)
- weapon = @actor.equips[0]
- shield = @actor.equips[1]
- helmet = @actor.equips[2]
- armor = @actor.equips[3]
- acces = @actor.equips[4]
- if weapon == nil
- change_color(knockout_color)
- draw_text(x, y + line_height + 10, 170, line_height, TOPSVOCAB::Wequipped)
- change_color(normal_color)
- else
- draw_item_name(weapon, x, y + line_height + 10)
- end
- if shield == nil
- draw_text(x + 350, y + line_height + 10, 170, line_height, TOPSVOCAB::Sequipped)
- else
- draw_item_name(shield, x + 350, y + line_height + 10)
- end
- if helmet == nil
- draw_text(x + 170, y, 170, line_height, TOPSVOCAB::Hequipped)
- else
- draw_item_name(helmet, x + 170, y)
- end
- if armor == nil
- draw_text(x + 170, y + line_height + 10, 180, line_height, TOPSVOCAB::ARequipped)
- else
- draw_item_name(armor, x + 170, y + line_height + 10, 0)
- end
- if acces == nil
- draw_text(x + 350, y, 180, line_height, TOPSVOCAB::ACequipped)
- else
- draw_item_name(acces, x + 350, y)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Description
- #--------------------------------------------------------------------------
- def draw_description(x, y)
- draw_text_ex(x, y, @actor.description)
- end
- #--------------------------------------------------------------------------
- # * Draw name + nickname
- #--------------------------------------------------------------------------
- def draw_actor_fullname(x, y)
- draw_text(x, y + line_height * 0, 180, line_height, @actor.name + " " + @actor.nickname)
- end
- end
- #==============================================================================
- # ** Scene_Skill
- #------------------------------------------------------------------------------
- # This class performs skill screen processing. Skills are handled as items for
- # the sake of process sharing.
- #==============================================================================
- class Scene_Skill
- def on_item_ok
- if $game_party.members.size == 1
- use_item
- activate_item_window
- else
- @actor.last_skill.object = item
- determine_item
- end
- end
- end
- #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs the menu screen processing.
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_command_window
- create_status_window
- create_location_window
- create_gold_window
- end
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_MenuCommand.new
- @command_window.set_handler(:status, method(:command_op_status))
- @command_window.set_handler(:item, method(:command_item))
- @command_window.set_handler(:equip, method(:command_op_equip))
- @command_window.set_handler(:skill, method(:command_op_skill))
- @command_window.set_handler(:save, method(:command_save))
- @command_window.set_handler(:to_title, method(:command_game_to_titleTOPS))
- @command_window.set_handler(:shutdown, method(:command_game_to_exitTOPS))
- @command_window.set_handler(:cancel, method(:return_scene))
- # Makes it possible to change actors in the menu.
- @command_window.set_handler(:pagedown, method(:next_actor))
- @command_window.set_handler(:pageup, method(:prev_actor))
- end
- #--------------------------------------------------------------------------
- # * Create Location Window
- #--------------------------------------------------------------------------
- def create_location_window
- @location_window = Window_Location.new
- @location_window.x = 340
- @location_window.y = 0
- end
- #--------------------------------------------------------------------------
- # * Create Gold Window
- #--------------------------------------------------------------------------
- def create_gold_window
- @gold_window = Window_Gold.new
- @gold_window.x = 340
- @gold_window.y = 80
- end
- #--------------------------------------------------------------------------
- # * Create Status Window
- #--------------------------------------------------------------------------
- def create_status_window
- @status_window = Window_MenuStatus_Opm.new(0, 128, @actor)
- end
- #--------------------------------------------------------------------------
- # * [Item] Command
- #--------------------------------------------------------------------------
- def command_item
- SceneManager.call(Scene_Item)
- end
- #--------------------------------------------------------------------------
- # * [Skill] Commands
- #--------------------------------------------------------------------------
- def command_op_skill
- @status_window.activate
- SceneManager.call(Scene_Skill)
- end
- #--------------------------------------------------------------------------
- # * [Equipment] Commands
- #--------------------------------------------------------------------------
- def command_op_equip
- @status_window.activate
- SceneManager.call(Scene_Equip)
- end
- #--------------------------------------------------------------------------
- # * [Status] Commands
- #--------------------------------------------------------------------------
- def command_op_status
- @status_window.activate
- SceneManager.call(Scene_Status)
- end
- #--------------------------------------------------------------------------
- # * [Save] Command
- #--------------------------------------------------------------------------
- def command_save
- SceneManager.call(Scene_Save)
- end
- #--------------------------------------------------------------------------
- # * [To Title] Command
- #--------------------------------------------------------------------------
- def command_game_to_titleTOPS
- fadeout_all
- SceneManager.goto(Scene_Title)
- end
- #--------------------------------------------------------------------------
- # * [Exit Command
- #--------------------------------------------------------------------------
- def command_game_to_exitTOPS
- fadeout_all
- SceneManager.exit
- end
- #--------------------------------------------------------------------------
- # * [Cancel] Personal Command
- #--------------------------------------------------------------------------
- def on_personal_cancel
- @status_window.unselect
- @command_window.activate
- end
- def on_actor_change
- @status_window.actor = @actor
- @command_window.activate
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment