Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Old Menu Script needs rewrite[resolved]

Constance made a very nice menu system in December of '05 that provided probably one of the first examples of a menu designed for two characters. In his(?) credits he lists Acedent Prone, Diego, Dubealex, and SephirothSpawn as inspiration and aid, and it shows. Functionally, it works almost perfectly. Under the hood, however?

Damn, man.

This script is a mess. It has a separate class for each of the two characters' versions of the windows displaying their stats--both of them--as well as "Dummy" windows that show their character sprites and such below or around the text. It contains entire rewrites of the equip and skill menus for no reason that I was able to parse. It has well over 100 instances of "self.contents" after editing. The result is a very attractive menu system, but the process getting there is not.

There also appear to be a few minor bugs with the menu. I had to translate the text back to English from French, and the little "choose a character" text when you go for equipment or skills is neither centered or left-justified, and the selection box for the characters doesn't seem to line up with them at all, especially with long names (for ease-of-use purposes I've been using the names "player" and "mercenary" while in development).

I would like to see this script edited down to be a bit more optimized. To help in the process, I formatted the lines (they were all on the left edge of the line when I found it) and changed around the things I personally wanted changed, including removing the "time played" window to make room for a longer Location box and replaced the "load" option on the menu with a Quest screen.

EDIT: I changed most of the things I wanted myself, after spending a bit more time with it. I also changed the bars for the status to be those used by Paradog's ATB, which my project uses. For the code, I included the def draw_meter thing so that it won't, or shouldn't give errors. Code has been updated to reflect the changes. Still hoping for some help.

I would greatly appreciate it if anyone was willing to do this for me. The code follows:
Code:
#============================================================

# Custom Menu System

# created by: Constance

# created on: Dec. 26, 2005

# version: 2.1

# credits: Acedent Prone, Diego, Dubealex

# special thanks credits goes to: SephirothSpawn, couldn't have done it without you

# RMXP - Underground - The Underground Gaming Zone

#============================================================

class Window_Base < Window

 

  def draw_actor_battler(actor, x, y)

    bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)

    cw = bitmap.width

    ch = bitmap.height

    src_rect = Rect.new(0, 0, cw, ch)

    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)

  end

 

  def draw_sprite(x, y, name, hue)

    bitmap = RPG::Cache.character(name, hue)

    cw = bitmap.width / 4

    ch = bitmap.height / 4

    src_rect = Rect.new(0, 0, cw, ch)

    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)

  end

 

  def draw_actor_hp(actor, x, y, width = 144)

    self.contents.font.name = "Verdana"

    self.contents.font.size = 20

    self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)

      if width - 32 >= 108

        hp_x = x + width - 108

        flag = true

      elsif width - 32 >= 48

        hp_x = x + width - 48

        flag = false

      end

    self.contents.font.color = actor.hp == 0 ? knockout_color :

    actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color

    self.contents.draw_text(hp_x + 30, y, 48, 32, actor.hp.to_s, 2)

      if flag

        self.contents.font.color = normal_color

        self.contents.draw_text(hp_x + 30 + 48, y, 12, 32, "/", 1)

        self.contents.draw_text(hp_x + 30 + 60, y, 48, 32, actor.maxhp.to_s)

      end

  end

 

  def draw_actor_sp(actor, x, y, width = 144)

    self.contents.font.name = "Verdana"

    self.contents.font.size = 20

    self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)

    self.contents.font.color = Color.new(74, 230, 51, 225)

      if width - 32 >= 108

        sp_x = x + width - 108

        flag = true

      elsif width - 32 >= 48

        sp_x = x + width - 48

        flag = false

      end

    self.contents.font.color = actor.sp == 0 ? knockout_color :

    actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color

    self.contents.draw_text(sp_x + 30, y, 48, 32, actor.sp.to_s, 2)

      if flag

        self.contents.font.color = normal_color

        self.contents.draw_text(sp_x + 30 + 48, y, 12, 32, "/", 1)

        self.contents.draw_text(sp_x + 30 + 60, y, 48, 32, actor.maxsp.to_s)

      end

  end

 

  def draw_actor_level3(actor, x, y)

    self.contents.font.color = system_color

    self.contents.draw_text(x, y, 32, 32, "Lv")

    self.contents.font.color = normal_color

    self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)

  end

 

  def draw_actor_hp2(actor, x, y, width = 144)

    self.contents.font.color = system_color

    self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)

      if width - 32 >= 108

        hp_x = x + width - 108

        flag = true

      elsif width - 32 >= 48

        hp_x = x + width - 48

        flag = false

      end

    self.contents.font.color = actor.hp == 0 ? knockout_color :

    actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color

    self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)

      if flag

        self.contents.font.color = normal_color

        self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)

        self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)

      end

  end

 

  def draw_actor_sp2(actor, x, y, width = 144)

    self.contents.font.color = system_color

    self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)

      if width - 32 >= 108

        sp_x = x + width - 108

        flag = true

      elsif width - 32 >= 48

        sp_x = x + width - 48

        flag = false

      end

    self.contents.font.color = actor.sp == 0 ? knockout_color :

    actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color

    self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)

      if flag

        self.contents.font.color = normal_color

        self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)

        self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)

      end

  end

 

  def draw_actor_name(actor, x, y)

    self.contents.font.color = normal_color

    self.contents.draw_text(x, y, 144, 32, actor.name)

  end

 

  def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color )

    self.contents.fill_rect(x, y, width, height, Color.new(192, 192, 192, 255))

    self.contents.fill_rect(x+1, y+1, width-2, height-2, Color.new(128, 128, 128, 128))

    now = now > max ? max : now

    percentage = max != 0 ? (width-2) * now / max.to_f : 0

    if start_color == end_color

      self.contents.fill_rect(x+1, y+1, percentage, height-2, start_color)

    else

      for i in 1..percentage

        r = start_color.red + (end_color.red - start_color.red) / percentage * i

        g = start_color.green + (end_color.green - start_color.green) / percentage * i

        b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i

        a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i

        self.contents.fill_rect(x+i, y+1, 1, height-2, Color.new(r, g, b, a))

      end

    end

  end

end

 

 

end

 

 

class Window_Selectable2 < Window_Base

 

  attr_reader :index

  attr_reader :help_window

 

  def initialize(x, y, width, height)

    super(x, y, width, height)

    @item_max = 1

    @column_max = 1

    @index = -1

  end

 

  def index=(index)

    @index = index

      if self.active and @help_window != nil

        update_help

      end

    update_cursor_rect

  end

 

  def row_max

    return (@item_max + @column_max - 1) / @column_max

  end

 

  def top_row

    return self.oy / 32

  end

 

  def top_row=(row)

      if row < 0

        row = 0

      end

      if row > row_max - 1

        row = row_max - 1

      end

    self.oy = row * 32

  end

 

  def page_row_max

    return (self.height - 32) / 32

  end

  

  def page_item_max

    return page_row_max * @column_max

  end

 

  def help_window=(help_window)

    @help_window = help_window

      if self.active and @help_window != nil

        update_help

      end

  end

 

  def update_cursor_rect

      if @index < 0

        self.cursor_rect.empty

        return

      end

    row = @index / @column_max

      if row < self.top_row

        self.top_row = row

      end

      if row > self.top_row + (self.page_row_max - 1)

        self.top_row = row - (self.page_row_max - 1)

      end

    cursor_width = self.width / @column_max - 32

    x = @index % @column_max * (cursor_width + 32)

    y = @index / @column_max * 32 - self.oy

    self.cursor_rect.set(x, y, 65, 32)

  end

 

  def update

    super

      if self.active and @item_max > 0 and @index >= 0

          if Input.repeat?(Input::DOWN)

              if (@column_max == 1 and Input.trigger?(Input::DOWN)) or

                @index < @item_max - @column_max

                $game_system.se_play($data_system.cursor_se)

                @index = (@index + @column_max) % @item_max

              end

          end

          if Input.repeat?(Input::UP)

              if (@column_max == 1 and Input.trigger?(Input::UP)) or

                @index >= @column_max

                $game_system.se_play($data_system.cursor_se)

                @index = (@index - @column_max + @item_max) % @item_max

              end

          end

          if Input.repeat?(Input::RIGHT)

              if @column_max >= 2 and @index < @item_max - 1

                $game_system.se_play($data_system.cursor_se)

                @index += 1

              end

          end

          if Input.repeat?(Input::LEFT)

              if @column_max >= 2 and @index > 0

                $game_system.se_play($data_system.cursor_se)

                @index -= 1

              end

          end

          if Input.repeat?(Input::R)

              if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)

                $game_system.se_play($data_system.cursor_se)

                @index = [@index + self.page_item_max, @item_max - 1].min

                self.top_row += self.page_row_max

              end

          end

          if Input.repeat?(Input::L)

              if self.top_row > 0

                $game_system.se_play($data_system.cursor_se)

                @index = [@index - self.page_item_max, 0].max

                self.top_row -= self.page_row_max

              end

          end

      end

      if self.active and @help_window != nil

        update_help

      end

    update_cursor_rect

  end

end

 

 

class Window_Command2 < Window_Selectable2

 

  attr_accessor :commands

 

  def initialize(commands)

    super(0, 0, 270, 101)

    self.contents = Bitmap.new(width - 32, height - 32)

    @commands = commands

    @width = width

    @item_max = 6

    @column_max = 3

    @commands = commands

    self.index = 0

  end

 

end

 

 

class Dummy_Window_Command < Window_Base

 

  def initialize

    super(0, 0, 270, 101)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Verdana"

    self.contents.font.size = 22

    refresh

  end

 

  def refresh

    self.contents.clear

    self.contents.draw_text(-35, 0, 124, 32, $data_system.words.item, 1)

    self.contents.draw_text(50, 0, 124, 32, $data_system.words.skill, 1)

    self.contents.draw_text(145, 0, 124, 32, $data_system.words.equip, 1)

    self.contents.draw_text(-35, 35, 124, 32, "Quest", 1)

    self.contents.draw_text(50, 35, 124, 32, "Save", 1)

    self.contents.draw_text(140, 35, 124, 32, "Quit", 1)

  end

 

end

 

 

class Dummy_Window_Command2 < Window_Base

 

  def initialize

    super(0, 0, 270, 101)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Verdana"

    self.contents.font.size = 22

    refresh

  end

 

  def refresh

    self.contents.clear

    bitmap = RPG::Cache.icon("034-Item03")

    self.contents.blt(35, 4, bitmap, Rect.new(0, 0, 24, 24))

    bitmap = RPG::Cache.icon("050-Skill07")

    self.contents.blt(115, 4, bitmap, Rect.new(0, 0, 24, 24))

    bitmap = RPG::Cache.icon("013-Body01")

    self.contents.blt(205, 4, bitmap, Rect.new(0, 0, 24, 24))

    bitmap = RPG::Cache.icon("033-Item02")

    self.contents.blt(35, 39, bitmap, Rect.new(0, 0, 24, 24))

    bitmap = RPG::Cache.icon("037-Item06")

    self.contents.blt(115, 39, bitmap, Rect.new(0, 0, 24, 24))

    bitmap = RPG::Cache.icon("039-Item08")

    self.contents.blt(205, 39, bitmap, Rect.new(0, 0, 24, 24))

  end

 

end

 

 

class Scene_Title

    $map_infos = load_data("Data/MapInfos.rxdata")

      for key in $map_infos.keys

        $map_infos[key] = $map_infos[key].name

      end

end

 

 

class Game_Actor < Game_Battler

 

  def now_exp

    return @exp - @exp_list[@level]

  end

 

  def next_exp

    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0

  end

 

end

 

 

class Game_Map

 

  def name

    $map_infos[@map_id]

  end

 

end

 

 

class Window_Location < Window_Base

 

  def initialize

    super(0, 0, 370,101)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Verdana"

    self.contents.font.size = 22

    refresh

  end

 

  def refresh

    bitmap = RPG::Cache.icon("032-Item01")

    self.contents.blt(315, y + 40, bitmap, Rect.new(0, 0, 24, 24))

    cx = contents.text_size($data_system.words.gold).width

    self.contents.font.color = normal_color

    self.contents.font.size = 20

    self.contents.draw_text(224, 40, 120-cx-2, 32, $game_party.gold.to_s, 2)

    self.contents.font.color = system_color

    self.contents.draw_text(224-cx, 40, cx, 32, $data_system.words.gold, 2)

    lx = contents.text_size("Location:").width

    self.contents.draw_text(4, -55, lx, 144, "Location:", 1)

    self.contents.font.color = normal_color

    self.contents.font.size = 20

    self.contents.draw_text(10 + lx, 1, lx + 40, 32, $game_map.name.to_s, 1)

  end

 

end

 

 

class Window_GraphicCharacter1 < Window_Base

 

  def initialize

    super(0, 0, 200,180)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Verdana"

    self.contents.font.size = 22

    refresh

  end

 

  def refresh

    self.contents.clear

    actor = $game_party.actors[0]

    draw_sprite(25, 55, actor.character_name, actor.character_hue)

  end

 

end

 

 

class Window_GraphicCharacter2 < Window_Base

 

  def initialize

    super(0, 0, 200,180)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Verdana"

    self.contents.font.size = 22

    refresh

  end

 

  def refresh

    self.contents.clear

      if $game_party.actors.size < 2

      self.contents.draw_text(25, 55, 50, 28, "Empty")

    else

      actor = $game_party.actors[1]

      draw_sprite(25, 55, actor.character_name, actor.character_hue)

    end

  end

 

end

 

 

class Window_Character1 < Window_Base

 

  def initialize

    super(0, 0, 200,180)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Verdana"

    self.contents.font.size = 22

    refresh

  end

 

  def refresh

    self.contents.clear

    actor = $game_party.actors[0]

    draw_actor_hp(actor, x + 4, y + 55, 144)

    draw_meter(actor.hp, actor.maxhp, x + 4, y + 82, 160, 4, Color.new(0, 128, 0, 255), Color.new(0, 255, 0, 255))

    draw_actor_sp(actor, x + 4, y + 110, 144)

    draw_meter(actor.hp, actor.maxhp, x + 4, y + 137, 160, 4, Color.new(128, 0, 128, 255), Color.new(255, 0, 255, 255))

    self.contents.font.size = 20

    draw_actor_class(actor, x + 50, y + 1)

    self.contents.draw_text(x + 50, y - 62, 144, 170, "_____________________")

    self.contents.draw_text(x + 80, y - 30, 144, 144, "Lv:")

    draw_actor_level(actor, x + 95, y + 6)

  end

 

end

 

 

class Window_Character2 < Window_Base

 

  def initialize

    super(0, 0, 200,200)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Verdana"

    self.contents.font.size = 22

    refresh

  end

 

  def refresh

    self.contents.clear

      if $game_party.actors.size < 2

        self.contents.draw_text(25, 55, 50, 28, "Empty")

      else

        actor = $game_party.actors[1]

        draw_actor_hp(actor, x + 4, y + 55, 144)

        draw_meter(actor.hp, actor.maxhp, x + 4, y + 82, 160, 4, Color.new(0, 128, 0, 255), Color.new(0, 255, 0, 255))

        draw_actor_sp(actor, x + 4, y + 110, 144)

        draw_meter(actor.hp, actor.maxhp, x + 4, y + 137, 160, 4, Color.new(128, 0, 128, 255), Color.new(255, 0, 255, 255))

        self.contents.font.size = 20

        draw_actor_class(actor, x + 50, y + 1)

        self.contents.draw_text(x + 50, y - 62, 144, 170, "_____________________")

        self.contents.draw_text(x + 80, y - 30, 144, 144, "Lv:")

        draw_actor_level(actor, x + 95, y + 6)

      end

  end

 

end

 

 

class Window_Character_Selection2 < Window_Base

 

  def initialize

    super(0, 0, 640, 51)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.visible = false

    self.z = 2000

    refresh

  end

 

  def refresh

    self.contents.clear

    self.contents.font.color = system_color

    cx = contents.text_size("Select a character").width

    self.contents.draw_text(145, -6, cx, 32, "Select a character", 2)

  end

 

end

 

#==============================================================================

# ** Window_Selectable

#------------------------------------------------------------------------------

# This window class contains cursor movement and scroll functions.

#==============================================================================

 

class Window_Selectable3 < Window_Base

#--------------------------------------------------------------------------

# * Public Instance Variables

#--------------------------------------------------------------------------

  attr_reader :index # cursor position

  attr_reader :help_window # help window

#--------------------------------------------------------------------------

# * Object Initialization

# x : window x-coordinate

# y : window y-coordinate

# width : window width

# height : window height

#--------------------------------------------------------------------------

  def initialize(x, y, width, height)

    super(x, y, width, height)

    @item_max = 1

    @column_max = 1

    @index = -1

  end

#--------------------------------------------------------------------------

# * Set Cursor Position

# index : new cursor position

#--------------------------------------------------------------------------

  def index=(index)

    @index = index

    # Update Help Text (update_help is defined by the subclasses)

      if self.active and @help_window != nil

        update_help

      end

    # Update cursor rectangle

    update_cursor_rect

  end

#--------------------------------------------------------------------------

# * Get Row Count

#--------------------------------------------------------------------------

  def row_max

    # Compute rows from number of items and columns

    return (@item_max + @column_max - 1) / @column_max

  end

#--------------------------------------------------------------------------

# * Get Top Row

#--------------------------------------------------------------------------

  def top_row

    # Divide y-coordinate of window contents transfer origin by 1 row

    # height of 32

    return self.oy / 32

  end

#--------------------------------------------------------------------------

# * Set Top Row

# row : row shown on top

#--------------------------------------------------------------------------

  def top_row=(row)

    # If row is less than 0, change it to 0

      if row < 0

        row = 0

      end

    # If row exceeds row_max - 1, change it to row_max - 1

      if row > row_max - 1

        row = row_max - 1

      end

    # Multiply 1 row height by 32 for y-coordinate of window contents

    # transfer origin

    self.oy = row * 32

  end

#--------------------------------------------------------------------------

# * Get Number of Rows Displayable on 1 Page

#--------------------------------------------------------------------------

  def page_row_max

    # Subtract a frame height of 32 from the window height, and divide it by

    # 1 row height of 32

    return (self.height - 32) / 32

  end

#--------------------------------------------------------------------------

# * Get Number of Items Displayable on 1 Page

#--------------------------------------------------------------------------

  def page_item_max

    # Multiply row count (page_row_max) times column count (@column_max)

    return page_row_max * @column_max

  end

#--------------------------------------------------------------------------

# * Set Help Window

# help_window : new help window

#--------------------------------------------------------------------------

  def help_window=(help_window)

    @help_window = help_window

    # Update help text (update_help is defined by the subclasses)

      if self.active and @help_window != nil

        update_help

      end

  end

#--------------------------------------------------------------------------

# * Update Cursor Rectangle

#--------------------------------------------------------------------------

  def update_cursor_rect

    # If cursor position is less than 0

      if @index < 0

        self.cursor_rect.empty

        return

      end

    # Get current row

    row = @index / @column_max

    # If current row is before top row

      if row < self.top_row

        # Scroll so that current row becomes top row

        self.top_row = row

      end

      # If current row is more to back than back row

      if row > self.top_row + (self.page_row_max - 1)

        # Scroll so that current row becomes back row

        self.top_row = row - (self.page_row_max - 1)

      end

    # Calculate cursor width

    cursor_width = self.width / @column_max - 32

    # Calculate cursor coordinates

    x = @index % @column_max * (cursor_width + 32)

    y = @index / @column_max * 32 - self.oy

    # Update cursor rectangle

      if $game_party.actors.size < 2

        self.cursor_rect.set(250 + @index * 140, y, 100, 20)

      else

        self.cursor_rect.set(160 + @index * 140, y, 150, 20)

      end

  end

#--------------------------------------------------------------------------

# * Frame Update

#--------------------------------------------------------------------------

  def update

    super

    # If cursor is movable

      if self.active and @item_max > 0 and @index >= 0

        # If pressing down on the directional buttons

          if Input.repeat?(Input::DOWN)

            # If column count is 1 and directional button was pressed down with no

            # repeat, or if cursor position is more to the front than

            # (item count - column count)

              if (@column_max == 1 and Input.trigger?(Input::DOWN)) or

                @index < @item_max - @column_max

                # Move cursor down

                $game_system.se_play($data_system.cursor_se)

                @index = (@index + @column_max) % @item_max

              end

          end

          # If the up directional button was pressed

          if Input.repeat?(Input::UP)

            # If column count is 1 and directional button was pressed up with no

            # repeat, or if cursor position is more to the back than column count

              if (@column_max == 1 and Input.trigger?(Input::UP)) or

                @index >= @column_max

                # Move cursor up

                $game_system.se_play($data_system.cursor_se)

                @index = (@index - @column_max + @item_max) % @item_max

              end

          end

          # If the right directional button was pressed

          if Input.repeat?(Input::RIGHT)

            # If column count is 2 or more, and cursor position is closer to front

            # than (item count -1)

              if @column_max >= 2 and @index < @item_max - 1

                # Move cursor right

                $game_system.se_play($data_system.cursor_se)

                @index += 1

              end

          end

          # If the left directional button was pressed

          if Input.repeat?(Input::LEFT)

            # If column count is 2 or more, and cursor position is more back than 0

              if @column_max >= 2 and @index > 0

                # Move cursor left

                $game_system.se_play($data_system.cursor_se)

                @index -= 1

              end

          end

          # If R button was pressed

          if Input.repeat?(Input::R)

            # If bottom row being displayed is more to front than bottom data row

              if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)

                # Move cursor 1 page back

                $game_system.se_play($data_system.cursor_se)

                @index = [@index + self.page_item_max, @item_max - 1].min

                self.top_row += self.page_row_max

              end

          end

          # If L button was pressed

          if Input.repeat?(Input::L)

            # If top row being displayed is more to back than 0

              if self.top_row > 0

                # Move cursor 1 page forward

                $game_system.se_play($data_system.cursor_se)

                @index = [@index - self.page_item_max, 0].max

                self.top_row -= self.page_row_max

              end

          end

      end

      # Update help text (update_help is defined by the subclasses)

      if self.active and @help_window != nil

        update_help

      end

    # Update cursor rectangle

    update_cursor_rect

  end

 

end

 

 

class Window_StatusCharacter1 < Window_Base

 

  def initialize

    super(0, 0, 440,180)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Verdana"

    self.contents.font.size = 22

    refresh

  end

 

  def refresh

    self.contents.clear

    self.contents.font.color = system_color

    self.contents.font.size = 20

    self.contents.draw_text(215, -63, 144, 144, "Status: ")

    self.contents.draw_text(190, 114, 120, 32, "Experience: ")

    actor = @actor

    @actor = $game_party.actors[0]

    draw_actor_name(@actor, x + 55, y - 7)

    draw_actor_state(@actor, 325, -8, 144)

    draw_actor_parameter(@actor, 0, 15 + 10, 3)

    draw_actor_parameter(@actor, 0, 15 + 40, 4)

    draw_actor_parameter(@actor, 0, 15 + 70, 5)

    draw_actor_parameter(@actor, 0, 15 + 100, 6)

    draw_actor_parameter(@actor, 190, 15 + 10, 0)

    draw_actor_parameter(@actor, 190, 15 + 40, 1)

    draw_actor_parameter(@actor, 190, 15 + 70, 2)

    draw_meter(@actor.str, 999, 0, 52, 168, 4, Color.new(106, 106, 106, 255), Color.new(248, 248, 248, 255))

    draw_meter(@actor.dex, 999, 0, 82, 168, 4, Color.new(0, 128, 108, 255), Color.new(0, 255, 232, 255))

    draw_meter(@actor.agi, 999, 0, 112, 168, 4, Color.new(128, 128, 0, 255), Color.new(255, 255, 0, 255))

    draw_meter(@actor.int, 999, 0, 142, 168, 4, Color.new(108, 0, 132, 255), Color.new(232, 0, 255, 255))

    draw_meter(@actor.atk, 600, 190, 52, 168, 4, Color.new(128, 0, 0, 255), Color.new(255, 0, 0, 255))

    draw_meter(@actor.pdef, 100, 190, 82, 168, 4, Color.new(0, 0, 128, 255), Color.new(0, 0, 255, 255))

    draw_meter(@actor.mdef, 100, 190, 112, 168, 4, Color.new(132, 0, 108, 255), Color.new(255, 0, 232, 255))

    draw_meter(@actor.now_exp.to_f, @actor.next_exp, 190, 142, 168, 4, Color.new(108, 132, 0, 255), Color.new(232, 255, 0, 255))

  end

 

end

 

 

class Window_StatusCharacter2 < Window_Base

 

  def initialize

    super(0, 0, 440,200)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Verdana"

    self.contents.font.size = 22

    refresh

  end

 

  def refresh

    self.contents.clear

      if $game_party.actors.size < 2

        self.contents.draw_text(25, 55, 50, 28, "Empty")

      else

        self.contents.font.color = system_color

        self.contents.font.size = 20

        self.contents.draw_text(215, -63, 144, 144, "Status: ")

        self.contents.draw_text(190, 114, 120, 32, "Experience: ")

        actor = @actor

        @actor = $game_party.actors[1]

        draw_actor_name(@actor, x + 55, y - 7)

        draw_actor_state(@actor, 325, -8, 144)

        draw_actor_parameter(@actor, 0, 15 + 10, 3)

        draw_actor_parameter(@actor, 0, 15 + 40, 4)

        draw_actor_parameter(@actor, 0, 15 + 70, 5)

        draw_actor_parameter(@actor, 0, 15 + 100, 6)

        draw_actor_parameter(@actor, 190, 15 + 10, 0)

        draw_actor_parameter(@actor, 190, 15 + 40, 1)

        draw_actor_parameter(@actor, 190, 15 + 70, 2)

        draw_meter(@actor.str, 999, 0, 52, 168, 4, Color.new(106, 106, 106, 255), Color.new(248, 248, 248, 255))

        draw_meter(@actor.dex, 999, 0, 82, 168, 4, Color.new(0, 128, 108, 255), Color.new(0, 255, 232, 255))

        draw_meter(@actor.agi, 999, 0, 112, 168, 4, Color.new(128, 128, 0, 255), Color.new(255, 255, 0, 255))

        draw_meter(@actor.int, 999, 0, 142, 168, 4, Color.new(108, 0, 132, 255), Color.new(232, 0, 255, 255))

        draw_meter(@actor.atk, 600, 190, 52, 168, 4, Color.new(128, 0, 0, 255), Color.new(255, 0, 0, 255))

        draw_meter(@actor.pdef, 100, 190, 82, 168, 4, Color.new(0, 0, 128, 255), Color.new(0, 0, 255, 255))

        draw_meter(@actor.mdef, 100, 190, 112, 168, 4, Color.new(132, 0, 108, 255), Color.new(255, 0, 232, 255))

        draw_meter(@actor.now_exp.to_f, @actor.next_exp, 190, 142, 168, 4, Color.new(108, 132, 0, 255), Color.new(232, 255, 0, 255))

      end

  end

 

end

 

 

class Window_Character_Selection1 < Window_Selectable3

 

  attr_accessor :commands

 

  def initialize(commands)

    super(0, 50, 640, 50)

    self.contents = Bitmap.new(width - 32, height - 32)

    @commands = commands

    @width = width

      if $game_party.actors.size < 2

        @item_max = 1

        @column_max = 1

      else

        @item_max = 2

        @column_max =2

      end

    @commands = 2

    self.visible = false

    self.active = false

    self.index = -1

    self.z = 2000

    refresh

  end

 

  def refresh

    self.contents.clear

    self.contents.font.color = system_color

      if $game_party.actors.size < 2

        self.contents.draw_text(180, -6, 144, 32, $game_party.actors[0].name, 2)

      else

        self.contents.draw_text(120, -6, 144, 32, $game_party.actors[0].name, 2)

        self.contents.draw_text(240, -6, 144, 32, $game_party.actors[1].name, 2)

      end

  end

 

end

 

 

class Window_Graphic1 < Window_Base

 

  def initialize

    super(0, 0, 280, 200)

    self.contents = Bitmap.new(width - 32, height - 32)

    refresh

  end

 

  def refresh

    self.contents.clear

    actor = $game_party.actors[0]

    draw_actor_battler(actor, x + 130, y + 150)

  end

 

end

 

 

class Window_Graphic2 < Window_Base

 

  def initialize

    super(0, 0, 280, 220)

    self.contents = Bitmap.new(width - 32, height - 32)

    refresh

  end

 

  def refresh

    self.contents.clear

      if $game_party.actors.size < 2

        self.contents.clear

      else

        actor = $game_party.actors[1]

        draw_actor_battler(actor, x + 130, y + 150)

      end

  end

 

end

 

 

class Window_SkillStatus < Window_Base

 

  def initialize(actor)

    super(0, 64, 640, 64)

    self.contents = Bitmap.new(width - 32, height - 32)

    @actor = actor

    refresh

  end

 

  def refresh

    self.contents.clear

    draw_actor_name(@actor, 0, 0)

    draw_actor_state(@actor, 150, 0)

    draw_actor_hp2(@actor, 270, 0)

    draw_actor_sp2(@actor, 440, 0)

  end

 

end

 

 

class Scene_Menu

 

  def initialize(menu_index = 0)

    @menu_index = menu_index

  end

 

  def main

    @update_frame = 0

    @window_location = Window_Location.new

    @window_location.x =270

    @window_character_selection1 = Window_Character_Selection1.new(@commands)

    @window_character_selection1.y = 50

    @window_character_selection2 = Window_Character_Selection2 .new

    @window_character1_graphic = Window_GraphicCharacter1.new

    @window_character1_graphic.y =100

    @window_character1_graphic.opacity = 0

    @window_character1_graphic.back_opacity = 0

    @window_character2_graphic = Window_GraphicCharacter2.new

    @window_character2_graphic.y =280

    @window_character2_graphic.opacity = 0

    @window_character2_graphic.back_opacity = 0

    @window_character1 = Window_Character1.new

    @window_character1.y =100

    @window_character2 = Window_Character2.new

    @window_character2.y =280

    @window_status_character1 = Window_StatusCharacter1.new

    @window_status_character1.x =200

    @window_status_character1.y =100

    @window_status_character2 = Window_StatusCharacter2.new

    @window_status_character2.x =200

    @window_status_character2.y =280

    @graphic1 = Window_Graphic1.new

    @graphic1.x = 240

    @graphic1.y = 92

    @graphic1.z = 501

    @graphic1.opacity = 0

    @graphic1.back_opacity = 0

    @graphic1.contents_opacity = 100

    @graphic2 = Window_Graphic2.new

    @graphic2.x = 240

    @graphic2.y = 272

    @graphic2.z = 501

    @graphic2.opacity = 0

    @graphic2.back_opacity = 0

    @graphic2.contents_opacity = 100

    @command_window = Window_Command2.new(["Items", "Skills", "Equip", "Quest", "Save", "Quit"])

    @command_window.index = @menu_index

    @dummy_window = Dummy_Window_Command.new

    @dummy_window.z = 500

    @dummy_window.opacity = 0

    @dummy_window.back_opacity = 0

    @dummy_window_icons = Dummy_Window_Command2.new

    @dummy_window_icons.opacity = 0

    @dummy_window_icons.back_opacity = 0

    @dummy_window_icons.contents_opacity = 100

    Graphics.transition

      loop do

        Graphics.update

        Input.update

        @update_frame += 1

          if @update_frame == 5

            @update_frame = 0

          end

        update

          if $scene != self

            break

          end

      end

    Graphics.freeze

    @window_location.dispose

    @window_character1.dispose

    @window_status_character1.dispose

    @window_character2.dispose

    @window_status_character2.dispose

    @command_window.dispose

    @graphic1.dispose

    @graphic2.dispose

    @dummy_window.dispose

    @dummy_window_icons.dispose

    @window_character1_graphic.dispose

    @window_character2_graphic.dispose

    @window_character_selection1.dispose

    @window_character_selection2.dispose

  end

 

  def update

    @command_window.update

    @window_character_selection1.update

      if @command_window.active

        update_command

        return

      end

      if @window_character_selection1.active

        update_character

        return

      end

  end

 

  def update_command

      if Input.trigger?(Input::B)

        $game_system.se_play($data_system.cancel_se)

        $scene = Scene_Map.new

        return

      end

      if Input.trigger?(Input::C)

          if $game_party.actors.size == 0 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

            when 1

              $game_system.se_play($data_system.decision_se)

              @window_character_selection1.visible = true

              @window_character_selection2.visible = true

              @window_character_selection1.active = true

              @window_character_selection1.index = 0

              @command_window.active = false

            when 2

              $game_system.se_play($data_system.decision_se)

              @window_character_selection1.visible = true

              @window_character_selection1.active = true

              @window_character_selection2.visible = true

              @window_character_selection1.index = 0

              @command_window.active = false

            when 3

              $game_system.se_play($data_system.decision_se)

              $scene = Scene_Missionmenu.new

            when 4

                if $game_system.save_disabled

                  $game_system.se_play($data_system.buzzer_se)

                  return

                end

              $game_system.se_play($data_system.decision_se)

              $scene = Scene_Save.new

            when 5

              $game_system.se_play($data_system.decision_se)

              $scene = Scene_End.new

          end

        return

      end

  end

 

  def update_character

      if Input.trigger?(Input::B)

        $game_system.se_play($data_system.cancel_se)

        @command_window.active = true

        @window_character_selection1.visible = false

        @window_character_selection1.active = false

        @window_character_selection2.visible = false

        @window_character_selection1.index = -1

        return

      end

      if Input.trigger?(Input::C)

          if $game_party.actors.size == 0 and @command_window.index < 4

            $game_system.se_play($data_system.buzzer_se)

            return

          end

        case @command_window.index

          when 1

            $game_system.se_play($data_system.decision_se)

            case @window_character_selection1.index

              when 0

                $scene = Scene_Skill.new(@window_character_selection1.index)

              when 1

                $scene = Scene_Skill.new(@window_character_selection1.index)

            end

          when 2

            $game_system.se_play($data_system.decision_se)

            case @window_character_selection1.index

              when 0

                $scene = Scene_Equip.new(@window_character_selection1.index)

              when 1

                $scene = Scene_Equip.new(@window_character_selection1.index)

            end

        end

        return

      end

  end

 

end
I suspect it's more than twice as long as it really needs to be, but I could be wrong.
 

MicKo

Member

[ruby]################################################################################
#                         CONFIG STARTS HERE                                   #
################################################################################
module CMS_Config
  # Commands you want to show, and their Icon.
  # Commands = { CommandID => ["Command", "IconName"], ... }
  Commands = {
  0 => ["Item", "034-Item03"],
  1 => ["Skill", "050-Skill07"],
  2 => ["Equip", "013-Body01"],
  3 => ["Quest", "033-Item02"],
  4 => ["Save", "037-Item06"],
  5 => ["Quit", "039-Item08"]
  }
  # Commands you want to activate Character Selection
  # CommandsCharSelect = "Command", "Command", ...
  CommandsCharSelect = "Skill", "Equip"
  # Scene Names used
  # ScenesName = "Scene_Name", "Scene_Name", ...
  ScenesName = "Scene_Item", "Scene_Skill", "Scene_Equip", "Scene_Missionmenu",
  "Scene_Save", "Scene_End"
  # Font used
  FontName = "Verdana", "Arial"
  # Font size used (-2 for some parts)
  FontSize = 22
  # Max Stat for meters
  MaxStat = { "ATK" => 9999, "PDEF" => 999, "MDEF" => 999 }
  # Gold Icon used
  GoldIcon = "032-Item01"
end
################################################################################
#                          CONFIG ENDS HERE                                    #
################################################################################
 
class Scene_Menu
 
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
 
  def main
    @command_window = Window_Menu_Commands.new(@menu_index)
    @actors_windows = {}
    for i in 0...2
      y = 100 + i * 190
      window_left = Window_Actor_Left.new(i, 0, y, 200, 190)
      window_right = Window_Actor_Right.new(i, 200, y, 440, 190)
      @actors_windows = [window_left, window_right]
    end
    @location_window = Window_Location.new(270, 0, 370, 100)
    @select_help_window = Window_Actor_Select_Help.new(0, 0, 640, 50)
    @select_window = Window_Actor_Select.new(0, 50, 640, 50)
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break unless $scene == self
    end
    Graphics.freeze
    dispose
  end
 
  def update
    @command_window.update
    for i in 0...$game_party.actors.size
      @actors_windows.each { |window| window.update }
    end
    @location_window.update
    @select_help_window.update
    @select_window.update
    update_input
  end
 
  def update_input
    if Input.trigger?(Input::B)
      if @select_window.active
        @select_window.active = false
        @select_window.visible = false
        @select_help_window.visible = false
        @command_window.active = true
        @command_window.visible = true
        @location_window.visible = true
        @command_window.index = 0
      else
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
        return
      end
    elsif Input.trigger?(Input::C)
      if @select_window.active
        $game_system.se_play($data_system.decision_se)
        scene_name = CMS_Config::ScenesName[@command_window.index]
        $scene = eval(scene_name + ".new(#{@select_window.index})")
      else
        charselect = CMS_Config::CommandsCharSelect
        command_name = CMS_Config::Commands[@command_window.index][0]
        if charselect.include?(command_name)
          $game_system.se_play($data_system.decision_se)
          @command_window.active = false
          @command_window.visible = false
          @location_window.visible = false
          @select_window.active = true
          @select_window.index = 0
          @select_window.visible = true
          @select_help_window.visible = true
        else
          str = CMS_Config::Commands[@command_window.index][0]
          if $game_system.save_disabled && str == "Save"
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.decision_se)
          $scene = eval(CMS_Config::ScenesName[@command_window.index] + ".new")
        end
      end
    end
  end
 
  def dispose
    @command_window.dispose
    for i in 0...2
      @actors_windows.each { |window| window.dispose }
    end
    @location_window.dispose
    @select_help_window.dispose
    @select_window.dispose
  end
end
 
class Window_Base
 
  def draw_meter(now, max, x, y, width, height, st_color, end_color = st_color)
    self.contents.fill_rect(x, y, width, height, Color.new(192, 192, 192))
    bg_color = Color.new(128, 128, 128, 128)
    self.contents.fill_rect(x+1, y+1, width-2, height-2, bg_color)
    now = now > max ? max : now
    percent = max != 0 ? (width-2) * now / max.to_f : 0
    if st_color == end_color
      self.contents.fill_rect(x+1, y+1, percent, height-2, st_color)
    else
      for i in 1..percent
        r = st_color.red + (end_color.red - st_color.red) / percent * i
        g = st_color.green + (end_color.green - st_color.green) / percent * i
        b = st_color.blue + (end_color.blue - st_color.blue) / percent * i
        a = st_color.alpha + (end_color.alpha - st_color.alpha) / percent * i
        self.contents.fill_rect(x+i, y+1, 1, height-2, Color.new(r, g, b, a))
      end
    end
  end
 
  def draw_actor_new_hp(actor, x, y, width = 144, opacity = 255)
    self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
    self.contents.font.color = actor.hp == 0 ? knockout_color :
      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
    str = "#{actor.hp}/#{actor.maxhp}"
    rect = self.contents.text_size(str)
    self.contents.draw_text(x + width - rect.width, y, rect.width, 32, str, 0)
  end
 
  def draw_actor_new_sp(actor, x, y, width = 144, opacity = 255)
    self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
    self.contents.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    str = "#{actor.sp}/#{actor.maxsp}"
    rect = self.contents.text_size(str)
    self.contents.draw_text(x + width - rect.width, y, rect.width, 32, str, 0)
  end
 
  def draw_actor_new_level(actor, x, y, opacity = 255)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, 32, 32, "Lv")
    self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
  end
 
  def draw_actor_battler(actor, x, y, opacity = 255)
    bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    cw = bitmap.width
    ch = bitmap.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x - cw / 2, y - ch / 2, bitmap, src_rect, opacity)
  end
end
 
class Window_Actor_Left < Window_Base
 
  def initialize(actor_id, x, y, width, height)
    super(x, y, width, height)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = CMS_Config::FontName
    self.contents.font.size = CMS_Config::FontSize - 2
    @actor_id = actor_id
    @actor = $game_party.actors[@actor_id]
    refresh
  end
 
  def refresh
    self.contents.clear
    if @actor_id + 1 > $game_party.actors.size
      str = "Empty"
      self.contents.draw_text(0, 0, width - 32, height - 32, str, 1)
    else
      draw_top
      draw_hp
      draw_sp
    end
  end
 
  def draw_top
    draw_actor_graphic(@actor, 25, 55)
    draw_actor_class(@actor, 50, 1)
    w = width - 32 - 48
    self.contents.fill_rect(48, 30, w, 1, Color.new(192, 192, 192))
    draw_actor_new_level(@actor, 50, 26)
  end
 
  def draw_hp
    draw_actor_new_hp(@actor, 4, 55, width - 40)
    st_color = Color.new(0, 128, 0, 255)
    end_color = Color.new(0, 255, 0, 255)
    draw_meter(@actor.hp, @actor.maxhp, 4, 82, 160, 4, st_color, end_color)
  end
 
  def draw_sp
    draw_actor_new_sp(@actor, 4, 110, width - 40)
    st_color = Color.new(128, 0, 128)
    end_color = Color.new(255, 0, 255)
    draw_meter(@actor.sp, @actor.maxsp, 4, 137, 160, 4, st_color, end_color)
  end
end
 
class Window_Actor_Right < Window_Base
 
  def initialize(actor_id, x, y, width, height)
    super(x, y, width, height)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = CMS_Config::FontName
    self.contents.font.size = CMS_Config::FontSize - 2
    @actor_id = actor_id
    @actor = $game_party.actors[@actor_id]
    refresh
  end
 
  def refresh
    self.contents.clear
    y = @actor_id * 100
    if @actor_id + 1 > $game_party.actors.size
      str = "Empty"
      self.contents.draw_text(0, 0, width - 32, height - 32, str, 1)
    else
      draw_actor_battler(@actor, width / 2 - 16, height / 2 - 16, 128)
      draw_actor_name(@actor, 55, 0)
      rect = self.contents.text_size("Status:")
      self.contents.draw_text(150, 0, rect.width, 32, "Status:", 0)
      draw_actor_state(@actor, 150 + rect.width, 0)
      draw_stats
    end
  end
 
  def draw_stats
    draw_actor_stat(@actor, "STR", 0, 40)
    draw_actor_stat(@actor, "DEX", 0, 70)
    draw_actor_stat(@actor, "AGI", 0, 100)
    draw_actor_stat(@actor, "INT", 0, 130)
    draw_actor_stat(@actor, "ATK", 180, 40)
    draw_actor_stat(@actor, "PDEF", 180, 70)
    draw_actor_stat(@actor, "MDEF", 180, 100)
    draw_actor_stat(@actor, "Exp:", 180, 130)
  end
 
  def draw_actor_stat(actor, stat, x, y)
    rect = self.contents.text_size(stat)
    self.contents.draw_text(x + 4, y, rect.width, rect.height, stat, 0)
    if stat == "Exp:"
      number = actor.now_exp
      if actor.next_exp == 0
        str = "-------"
      else
        str = "#{actor.now_exp}/#{actor.next_exp}"
      end
      self.contents.draw_text(x + 4, y, 160, rect.height, str, 2)
    else
      number = eval("actor." + stat.downcase)
      self.contents.draw_text(x + 4, y, 160, rect.height, number.to_s, 2)
    end
    st_color = get_start_color(stat)
    end_color = get_end_color(stat)
    draw_meter(number, get_max(stat), x+4, y+20, 160, 4, st_color, end_color)
  end
 
  def get_start_color(stat)
    case stat
    when "STR" then return Color.new(106, 106, 106, 255)
    when "DEX" then return Color.new(0, 128, 108, 255)
    when "AGI" then return Color.new(128, 128, 0, 255)
    when "INT" then return Color.new(108, 0, 132, 255)
    when "ATK" then return Color.new(128, 0, 0, 255)
    when "PDEF" then return Color.new(0, 0, 128, 255)
    when "MDEF" then return Color.new(132, 0, 108, 255)
    when "Exp:" then return Color.new(108, 132, 0, 255)
    end
  end
 
  def get_end_color(stat)
    case stat
    when "STR" then return Color.new(248, 248, 248, 255)
    when "DEX" then return Color.new(0, 255, 232, 255)
    when "AGI" then return Color.new(255, 255, 0, 255)
    when "INT" then return Color.new(232, 0, 255, 255)
    when "ATK" then return Color.new(255, 0, 0, 255)
    when "PDEF" then return Color.new(0, 0, 255, 255)
    when "MDEF" then return Color.new(255, 0, 232, 255)
    when "Exp:" then return Color.new(232, 255, 0, 255)
    end
  end
 
  def get_max(stat)
    if CMS_Config::MaxStat.keys.include?(stat)
      return CMS_Config::MaxStat[stat]
    else
      case stat
      when "STR", "DEX", "AGI", "INT" then return 999
      when "ATK", "PDEF", "MDEF" then return 9999
      when "Exp:"
        if @actor.next_exp == 0
          return @actor.now_exp
        else
          return @actor.next_exp
        end
      end
    end
  end
end
 
class Window_Menu_Commands < Window_Selectable
 
  def initialize(index = 0)
    super(0, 0, 270, 100)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = CMS_Config::FontName
    self.contents.font.size = CMS_Config::FontSize
    @commands = CMS_Config::Commands
    @item_max = @commands.size
    @column_max = 3
    self.index = index
    refresh
  end
 
  def refresh
    self.contents.clear
    for i in 0...@commands.keys.size
      x = (270 / @column_max) * (i % @column_max)
      y = 32 * (i / @column_max)
      draw_command(i, x, y)
    end
  end
 
  def draw_command(command_id, x, y)
    icon_name = @commands[command_id][1]
    bitmap = RPG::Cache.icon(icon_name)
    rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(x + 20, y + 1, bitmap, rect, 100)
    str = @commands[command_id][0]
    self.contents.font.color = normal_color
    if $game_system.save_disabled && str == "Save"
      self.contents.font.color = disabled_color
    end
    self.contents.draw_text(x, y, 90, 32, str, 0)
  end
end
 
class Window_Location < Window_Base
 
  def initialize(x, y, width, height)
    super(x, y, width, height)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = CMS_Config::FontName
    self.contents.font.size = CMS_Config::FontSize
    refresh
  end
 
  def refresh
    self.contents.clear
    draw_location(0, 0)
    draw_gold(150, 20)
  end
   
  def draw_location(x, y)
    self.contents.font.color = system_color
    rect = self.contents.text_size("Location: ")
    self.contents.draw_text(4, 0, rect.width, rect.height, "Location: ")
    self.contents.font.color = normal_color
    name_rect = self.contents.text_size($game_map.name)
    x = rect.width
    width = name_rect.width
    self.contents.draw_text(x, 0, width, name_rect.height, $game_map.name)
  end
 
  def draw_gold(x, y)
    self.contents.font.color = system_color
    bitmap = RPG::Cache.icon(CMS_Config::GoldIcon)
    self.contents.blt(x, y, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
    rect = self.contents.text_size($data_system.words.gold + ": ")
    str = $data_system.words.gold + ": "
    self.contents.draw_text(x + bitmap.width, y, rect.width, rect.height, str)
    self.contents.font.color = normal_color
    str = $game_party.gold.to_s
    gold_rect = self.contents.text_size(str)
    x = x + bitmap.width + rect.width
    self.contents.draw_text(x, y, gold_rect.width, gold_rect.height, str)
  end
end
 
class Window_Actor_Select_Help < Window_Base
 
  def initialize(x, y, width, height)
    super(x, y, width, height)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = CMS_Config::FontName
    self.contents.font.size = CMS_Config::FontSize
    self.visible = false
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, width-32, height-32, "Select a character", 1)
  end
end
 
class Window_Actor_Select < Window_Selectable
 
  def initialize(x, y, width, height)
    super(x, y, width, height)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = CMS_Config::FontName
    self.contents.font.size = CMS_Config::FontSize
    self.visible = false
    self.active = false
    @item_max = $game_party.actors.size
    @column_max = $game_party.actors.size
    self.index = -1
    refresh
  end
 
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    if row < self.top_row
      self.top_row = row
    end
    if row > self.top_row + (self.page_row_max - 1)
      self.top_row = row - (self.page_row_max - 1)
    end
    cursor_width = self.width / @column_max - 32
    x = @index % @column_max * (cursor_width + 32)
    y = @index / @column_max * 32 - self.oy
    self.cursor_rect.set(x, y, cursor_width, height - 32)
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    w = width / @column_max - 32
    for i in 0...$game_party.actors.size
      x = i % @column_max * (w + 32)
      str = $game_party.actors.name
      self.contents.draw_text(x, -2, w, height - 32, str, 1)
    end
  end
end
 
class Game_Actor < Game_Battler
 
  def now_exp
    return @exp - @exp_list[@level]
  end
 
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
end
 
class Game_Map
 
  def name
    map_infos[@map_id].name
  end
 
  def map_infos
    @mapinfos = load_data('Data/MapInfos.rxdata') if @mapinfos.nil?
    return @mapinfos
  end
end
[/ruby]
'Didn't bother adding comments everywhere, just tell me if you don't understand something.
 
I tried to put this in, just to see what it looks like, since my game only has 2 characters, and I get a Script Error on line 2... which is a comment... that has actually been happening quite a bit lately, with various scripts. I even inserted it into a brand new project, and nothing.

Halp? D: This is RMXP right?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top