The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX Ace => VXA Scripts Database => Topic started by: SoulPour777 on September 09, 2014, 12:39:05 PM

Title: 3 Actors Menu Theme
Post by: SoulPour777 on September 09, 2014, 12:39:05 PM
3 Actors Menu Theme
Version: 1.0
Author: Soulpour777
Date: September 9, 2014

Description


This is a simple menu theme that allows you to use Slanted Bars, Battlers and fixed 3 Actors Menu Theme with a Help Bar to indicate which part of the Menu you are browsing.

Features


Screenshots

(https://rmrk.net/proxy.php?request=http%3A%2F%2Finfinitytears.files.wordpress.com%2F2014%2F09%2F3actors.jpg%3Fw%3D625&hash=9fa25b2bd22092561dccf048f570017664e63a89)

Instructions

Place the script below Materials, above Main. Make sure you have the pictures on the Pictures folder.

Script


Code: [Select]
#==============================================================================
# ** 3 Actors Menu Theme
# Author: Soulpour777
# Script Date: September 9, 2014
# Web URL: infinitytears.wordpress.com
# Special Thanks: SephirothSpawn - for my reference for the bars
#------------------------------------------------------------------------------
# Description:
# This is a simple menu theme that allows you to use Slanted Bars, Battlers
# and fixed 3 Actors Menu Theme with a Help Bar to indicate which part of
# the Menu you are browsing.
#------------------------------------------------------------------------------
# Terms of Use:
# Each script (without the label being free to use commercially)
# are protected under Attribution-NonCommercial-ShareAlike 3.0
# Philippines (CC BY-NC-SA 3.0 PH)
#------------------------------------------------------------------------------
# Attribution — You must give appropriate credit, provide a
# link to the license, and indicate if changes were made. You may do
# so in any reasonable manner, but not in any way that suggests the
# licensor endorses you or your use.
# NonCommercial — You may not use the material for commercial purposes.
# ShareAlike — If you remix, transform, or build upon the material,
# you must distribute your contributions under the same license as the original.
#==============================================================================

module Soulpour
  module Daiki_MenuTheme
    Counter_Variable = 1 #Counter Variable for Menu Details [Game Variables ID]
    Command_Width = Graphics.width # Width of the Command Window on the Left Side
    Menu_Names = {
    1 => "Items",                     # Items
    2 => "Equip",                     # Equip
    3 => "Skills",                    # Skills
    4 => "Status",                    # Status
    5 => "Formation",                 # Formation
    6 => "Save",                      # Save
    7 => "End"                        # End
    }
   
    # Height of the Menu Status for Showing the Characters
    MenuStatus_Height = 290
    # Menu Status Y Position
    MenuStatus_Y = 0
    # How many characters can the menu status show?
    MenuStatus_ItemMax = 3 # Max Item of Characters to Display on the Menu
   
    Character_Spacing = 120 # Spaces of the Characters shown in the Menu
   
    Command_Colums = 4 # Number of Menu Columns Available Set for Menu Commands
   
    Menu_Command_Height = 80 # Height of Your Menu Command
   
  end
 
  #--------------------------------------------------------------------------
  # * CMS Actors Configuration (For Portrait)
  #-------------------------------------------------------------------------- 
  module CMS_Actor
    Actor_Portrait = {
      1 => "Eric",
      2 => "Natalie",
      3 => "Terence",
      4 => "Ernest",
      5 => "Ryoma",
      6 => "Brenda",
      7 => "Rick",
      8 => "Alice",
      9 => "Isabelle",
      10 => "Noah"
    }
  end 
 
  #--------------------------------------------------------------------------
  # Help Indicator Vocabularies
  # this is where you place all the help words whenever we display the menu
  # commands.
  #--------------------------------------------------------------------------
  module Help_Vocabs
    Menu = [
    "The present items in your inventory.",
    "Change your equipments.",
    "Your skills present to use.",
    "View your current status",
    "Change your party formation",
    "Save your current progress.",
    "Quit or restart game."
    ]
  end   
 
  module Slanted_Bars
    DEFAULT_HP_BAR_COLOR = Color.new(0,150,0,255)   # Beginning color of HP bar
    DEFAULT_HP_END_COLOR = Color.new(51,150,0,255) # Ending color of HP bar
   
    DEFAULT_MP_BAR_COLOR = Color.new(0,0,150,255)   # Begenning color of MP bar
    DEFAULT_MP_END_COLOR = Color.new(0,51,150,255) # Ending color of MP bar
  end   
 
end


class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #-------------------------------------------------------------------------- 
  attr_accessor :counter_variable
  #--------------------------------------------------------------------------
  # * Alias Listings
  #-------------------------------------------------------------------------- 
  alias :soulpour_rgss3_aimine_daiki_theme_game_system_initialize :initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #-------------------------------------------------------------------------- 
  def initialize
    soulpour_rgss3_aimine_daiki_theme_game_system_initialize
    @counter_variable = 0
  end
end

class Window_HeaderI < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, Graphics.width, 48)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_text(4, 0, Graphics.width, line_height, Soulpour::Help_Vocabs::Menu[$game_system.counter_variable])
  end
  #--------------------------------------------------------------------------
  # * Open Window
  #--------------------------------------------------------------------------
  def open
    refresh
    super
  end
end

class Window_MenuCommand < Window_Command
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 47)
    select_last
  end
  #--------------------------------------------------------------------------
  # * Move Cursor Down
  #--------------------------------------------------------------------------
  def cursor_down(wrap = false)
    if index < item_max - col_max || (wrap && col_max == 1)
      select((index + col_max) % item_max)
      if $game_system.counter_variable <= 7
        if $game_system.counter_variable != 7
          if $game_system.counter_variable > 7
            $game_system.counter_variable = 1
          else
            $game_system.counter_variable += 1
          end
        else
          $game_system.counter_variable = 1
        end
      else
        $game_system.counter_variable = 1
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Move Cursor Up
  #--------------------------------------------------------------------------
  def cursor_up(wrap = false)
    if index >= col_max || (wrap && col_max == 1)
      select((index - col_max + item_max) % item_max)
      if $game_system.counter_variable > 1
         $game_system.counter_variable -= 1     
      else
        $game_system.counter_variable = 7
      end
    end
  end
  def update_help
    @help_window.set_rgss3spvii_help(@index)
  end 
end

class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    create_command_window
    create_status_window
  end
end

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw Actor Simple Status (Rewrite)
  #-------------------------------------------------------------------------- 
  def draw_actor_simple_status(actor, x, y)
    draw_actor_name(actor, x - 97, y - 14)
    draw_actor_icons(actor, x, y + line_height * 2)
    draw_actor_hp(actor, x - 105, y - 20 + line_height * 1 + 185)
    draw_actor_mp(actor, x - 105, y - 20 + line_height * 2 + 185)
  end
end


class Window
  #--------------------------------------------------------------------------
  # * Set Mirai Help
  #-------------------------------------------------------------------------- 
  def set_rgss3spvii_help(index)
    return if @index == index # To prevent excessive redrawing
    @index = index
    $game_system.counter_variable = index
    refresh
  end
end

class Window_MenuCommand < Window_Command
  #--------------------------------------------------------------------------
  # * Number of Command Columns
  #-------------------------------------------------------------------------- 
  def col_max
    # Changed the column max for the given set of commands
    return Soulpour::Daiki_MenuTheme::Command_Colums
  end
  #--------------------------------------------------------------------------
  # * Get Window Width (Completely Modified)
  #--------------------------------------------------------------------------
  def window_width
    #this returns the change of width to the Menu Command's Width
    return Soulpour::Daiki_MenuTheme::Command_Width
  end
  #--------------------------------------------------------------------------
  # * Get Window Height
  #--------------------------------------------------------------------------
  def window_height
    #this returns the change of width to the Menu Command's Height
    return Soulpour::Daiki_MenuTheme::Menu_Command_Height
  end
  #--------------------------------------------------------------------------
  # * Add Main Commands to List (Completely Modified)
  #--------------------------------------------------------------------------
  def add_main_commands
    add_command(Soulpour::Daiki_MenuTheme::Menu_Names.values[0],   :item,   main_commands_enabled)
    add_command(Soulpour::Daiki_MenuTheme::Menu_Names.values[1],  :equip,  main_commands_enabled)
    add_command(Soulpour::Daiki_MenuTheme::Menu_Names.values[2],  :skills,  main_commands_enabled)
    add_command(Soulpour::Daiki_MenuTheme::Menu_Names.values[3], :status, main_commands_enabled)
  end 
end

class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # * Alias Listings
  #-------------------------------------------------------------------------- 
  alias :soulpour_scene_menu_start_processing_rgss3spvii               :start
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    soulpour_scene_menu_start_processing_rgss3spvii
    @header_one = Window_HeaderI.new
    @command_window.help_window = @header_one
    @header_one.x = 0
    @header_one.y = Graphics.height - @header_one.height
  end   
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_MenuCommand.new
    @command_window.y = 290
    @command_window.set_handler(:item,      method(:command_item))
    @command_window.set_handler(:equip,     method(:command_personal))
    @command_window.set_handler(:skills,    method(:command_personal))
    @command_window.set_handler(:status,    method(:command_personal))
    @command_window.set_handler(:formation, method(:command_formation))
    @command_window.set_handler(:save,      method(:command_save))
    @command_window.set_handler(:game_end,  method(:command_game_end))
    @command_window.set_handler(:cancel,    method(:return_scene))
  end
  #--------------------------------------------------------------------------
  # * Formation [OK]
  #--------------------------------------------------------------------------
  def on_formation_ok
    if @status_window.pending_index >= 0
      $game_party.swap_order(@status_window.index,
                             @status_window.pending_index)
      @status_window.pending_index = -1
      @status_window.redraw_item(@status_window.index)
    else
      @status_window.pending_index = @status_window.index
    end
    @status_window.refresh
    @status_window.activate
  end
  #--------------------------------------------------------------------------
  # * Formation [Cancel]
  #--------------------------------------------------------------------------
  def on_formation_cancel
    if @status_window.pending_index >= 0
      @status_window.pending_index = -1
      @status_window.refresh
      @status_window.activate
    else
      @status_window.unselect
      @command_window.activate
    end
  end 
 
  #--------------------------------------------------------------------------
  # * [Skill], [Equipment] and [Status] Commands
  #--------------------------------------------------------------------------
  def command_personal
    @status_window.select_last
    @status_window.activate
    @status_window.set_handler(:ok,     method(:on_personal_ok))
    @status_window.set_handler(:cancel, method(:on_personal_cancel))
  end
 
  #--------------------------------------------------------------------------
  # * [OK] Personal Command
  #--------------------------------------------------------------------------
  def on_personal_ok
    case @command_window.current_symbol
    when :skills
      SceneManager.call(Scene_Skill)
    when :equip
      SceneManager.call(Scene_Equip)
    when :status
      SceneManager.call(Scene_Status)
    end
  end 
 
end

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, window_width, window_height)
    @pending_index = -1
    refresh
  end 
  #--------------------------------------------------------------------------
  # * Get Window Height
  #--------------------------------------------------------------------------
  def window_height
    Soulpour::Daiki_MenuTheme::MenuStatus_Height
  end
  #--------------------------------------------------------------------------
  # * Get Rectangle for Drawing Items
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new
    rect.width = item_width + 50
    rect.height = item_height + 190
    rect.x = index % col_max * (item_width + spacing)
    rect.y = index / col_max * item_height
    rect
  end 
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It is used within the Game_Actors class
# ($game_actors) and is also referenced from the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables (To Show Portrait)
  #-------------------------------------------------------------------------- 
  attr_reader :actor_id
end

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, 47, window_width, window_height)
    @pending_index = -1
    refresh
    self.x = 0
    self.y = Soulpour::Daiki_MenuTheme::MenuStatus_Y
  end 
  #--------------------------------------------------------------------------
  # * Get Number of Items
  # Changed to 1 to only show 1 party member.
  #--------------------------------------------------------------------------
  def item_max
    Soulpour::Daiki_MenuTheme::MenuStatus_ItemMax
  end   
 
  #--------------------------------------------------------------------------
  # * Get Spacing for Items Arranged Side by Side
  #--------------------------------------------------------------------------
  def spacing
    return Soulpour::Daiki_MenuTheme::Character_Spacing
  end 
 
  #--------------------------------------------------------------------------
  # * Get Window Width
  #-------------------------------------------------------------------------- 
  def window_width
    return Graphics.width
  end
 
  #--------------------------------------------------------------------------
  # * Get Columns
  #--------------------------------------------------------------------------   
  def col_max
    return 4
  end
 
  #--------------------------------------------------------------------------
  # * Get Rectangle for Drawing Items
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new
    rect.width = item_width + 110
    rect.height = item_height + 190
    rect.x = index % col_max * (item_width + spacing)
    rect.y = index / col_max * item_height
    rect
  end
 
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    actor = $game_party.members[index]
    enabled = $game_party.battle_members.include?(actor)
    rect = item_rect(index)
    draw_item_background(index)
    draw_actor_portrait(actor, rect.x - 20, 10, enabled = true)
    draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
  end 
  #--------------------------------------------------------------------------
  # * Draw Actor Portrait
  #-------------------------------------------------------------------------- 
  def draw_actor_portrait(actor, x, y, enabled = true)
   bitmap = Cache.picture(Soulpour::CMS_Actor::Actor_Portrait[actor.actor_id])
   rect = Rect.new(0,0, 220, Graphics.height)
   contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
   bitmap.dispose
  end 
end

class Window_Base < Window
  include Soulpour::Slanted_Bars
  #--------------------------------------------------------------------------
  # * Draw Slant Bar
  #--------------------------------------------------------------------------
  def draw_slant_bar(x, y, min, max, width = 152, height = 6,
    bar_color = Color.new(150, 0, 0, 255),
    end_color = Color.new(255, 255, 60, 255))
    #--------------------------------------------------------------------------
    # * Draws the Border
    #--------------------------------------------------------------------------
    for i in 0..height
      self.contents.fill_rect(x + i, y + height - i, width + 1, 1,
        Color.new(50, 50, 50, 255))
    end
    #--------------------------------------------------------------------------
    # * Draws the Background
    #--------------------------------------------------------------------------
    for i in 1..(height - 1)
      r = 100 * (height - i) / height + 0 * i / height
      g = 100 * (height - i) / height + 0 * i / height
      b = 100 * (height - i) / height + 0 * i / height
      a = 255 * (height - i) / height + 255 * i / height
      self.contents.fill_rect(x + i, y + height - i, width, 1,
        Color.new(r, b, g, a))
    end
    #--------------------------------------------------------------------------
    # * Draws the Bar
    #--------------------------------------------------------------------------
    for i in 1..( (min / max.to_f) * width - 1)
      for j in 1..(height - 1)
        r = bar_color.red * (width - i) / width + end_color.red * i / width
        g = bar_color.green * (width - i) / width + end_color.green * i / width
        b = bar_color.blue * (width - i) / width + end_color.blue * i / width
        a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
        self.contents.fill_rect(x + i + j, y + height - j, 1, 1,
          Color.new(r, g, b, a))
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw HP
  #--------------------------------------------------------------------------
  def draw_actor_hp(actor, x, y, width = 124)
    draw_slant_bar(x-3,y+13,actor.hp,actor.mhp,width,8,
        DEFAULT_HP_BAR_COLOR, DEFAULT_HP_END_COLOR)
    change_color(system_color)
    draw_text(x, y, 30, line_height, Vocab::hp_a)
    draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
      hp_color(actor), normal_color)       
  end
  #--------------------------------------------------------------------------
  # * Draw MP
  #--------------------------------------------------------------------------
  def draw_actor_mp(actor, x, y, width = 124)
    draw_slant_bar(x-3,y+13,actor.mp,actor.mmp,width,8,
        DEFAULT_MP_BAR_COLOR, DEFAULT_MP_END_COLOR)     
    change_color(system_color)
    draw_text(x, y, 30, line_height, Vocab::mp_a)
    draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
      mp_color(actor), normal_color)     
  end 
end

class Window_SkillStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Draw Status Graphics
  #--------------------------------------------------------------------------
  def draw_status_graphics(actor, x, y)
    draw_actor_name(actor, x, y)
    draw_actor_level(actor, x, y + line_height * 1)
    draw_actor_icons(actor, x, y + line_height * 2)
    draw_actor_class(actor, x + 120, y)
    draw_actor_hp(actor, x + 120, y + line_height * 1)
    draw_actor_mp(actor, x + 120, y + line_height * 2)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    return unless @actor
    draw_actor_face(@actor, 0, 0)
    draw_status_graphics(@actor, 108, line_height / 2)
  end
end

Credit



Support


Please comment below or PM me on this forum for support.

Known Compatibility Issues

Any Window related script that uses draw_actor_simple_status should redo or recreate the method. draw_actor_simple_status has been modified.

Demo


Please download the demo on my website: http://infinitytears.wordpress.com/2014/09/09/rgss3-3-actors-menu-theme/

Terms of Use


Each script (without the label being free to use commercially)  are protected under Attribution-NonCommercial-ShareAlike 3.0 Philippines (CC BY-NC-SA 3.0 PH)
Title: Re: 3 Actors Menu Theme
Post by: yuyu! on September 09, 2014, 10:02:28 PM
Ah-ha! Finally, I get to see more menus with the commands lined up along the top or bottom of the screen! ;___; I always have trouble finding those. Also, having the battlers show up looks pretty cool. :yuyu:
Title: Re: 3 Actors Menu Theme
Post by: &&&&&&&&&&&&& on September 09, 2014, 10:41:26 PM
cool menu :)
Title: Re: 3 Actors Menu Theme
Post by: modern algebra on September 09, 2014, 11:50:22 PM
Yeah, looks good Soulpour777. Thanks for sharing!
Title: Re: 3 Actors Menu Theme
Post by: SoulPour777 on September 10, 2014, 12:03:31 PM
Thank you everyone. It's always nice to contribute to such a wonderful community. Cheers :D