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.

[VX] Single Actor Menu

[VX] Single Actor Menu Version: 1.1
By: Brew

Introduction

Yes, I know there are a bunch of single actor menus available. If you like any of them better, use it. Won't hurt my feelings a bit. :scruff:
This was by request, is pretty plain & simple. I figured it could also be used as an example for budding script-writers, or as a starting point.


Features
  • Add "Load" to menu
  • Remove "Skills" from menu
  • Eliminate Character Selection.
  • Reformatted Status Window

Screenshots

Single_Actor_Menu.png


Demo

http://hbgames.org/user_files/Single_Actor_Menu_VX.exe

Script

Window_Status
Code:
#==============================================================================

# ** Window_Status MOD

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

#  This window displays full status specs on the status screen.

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

 

class Window_Status < Window_Base

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

  # * Object Initialization

  #     actor : actor

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

  def initialize(actor)

    super(160, 0, 384, 416)

    @actor = actor

    refresh

  end

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

  # * Refresh

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

  def refresh

    self.contents.clear

    draw_actor_face(@actor, 8, 8)

    draw_actor_name(@actor, 108, 0)

    draw_actor_class(@actor, 236, 0)

    draw_basic_info(108, 64)

    draw_actor_state(@actor, 8, 128)

    draw_parameters(8, 160)

    draw_actor_level(@actor, 8, 288)

    draw_exp_info(8, 320)

    draw_equipments(128, 128)

  end

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

  # * Draw Basic Information

  #     x : Draw spot X coordinate

  #     y : Draw spot Y coordinate

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

  def draw_basic_info(x, y)

    draw_actor_hp(@actor, x, y)

    draw_actor_mp(@actor, x + 108, y)

  end

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

  # * Draw Parameters

  #     x : Draw spot X coordinate

  #     y : Draw spot Y coordinate

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

  def draw_parameters(x, y)

    draw_actor_parameter(@actor, x, y + WLH * 0, 0)

    draw_actor_parameter(@actor, x, y + WLH * 1, 1)

    draw_actor_parameter(@actor, x, y + WLH * 2, 2)

    draw_actor_parameter(@actor, x, y + WLH * 3, 3)

  end

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

  # * Draw Experience Information

  #     x : Draw spot X coordinate

  #     y : Draw spot Y coordinate

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

  def draw_exp_info(x, y)

    s1 = @actor.exp_s

    s2 = @actor.next_rest_exp_s

    s_next = sprintf(Vocab::ExpNext, Vocab::level)

    self.contents.font.color = system_color

    self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)

    self.contents.draw_text(x, y + WLH * 1, 180, WLH, s_next)

    self.contents.font.color = normal_color

    self.contents.draw_text(x + 128, y + WLH * 0, 180, WLH, s1, 0)

    self.contents.draw_text(x + 128, y + WLH * 1, 180, WLH, s2, 0)

  end

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

  # * Draw Equipment

  #     x : Draw spot X coordinate

  #     y : Draw spot Y coordinate

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

  def draw_equipments(x, y)

    self.contents.font.color = system_color

    self.contents.draw_text(x, y, 120, WLH, Vocab::equip)

    for i in 0..4

      draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1))

    end

  end

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

  # * Draw Parameters

  #     actor : actor

  #     x     : draw spot x-coordinate

  #     y     : draw spot y-coordinate

  #     type  : Type of parameters (0-3)

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

  def draw_actor_parameter(actor, x, y, type)

    case type

    when 0

      parameter_name = Vocab::atk

      parameter_value = actor.atk

    when 1

      parameter_name = Vocab::def

      parameter_value = actor.def

    when 2

      parameter_name = Vocab::spi

      parameter_value = actor.spi

    when 3

      parameter_name = Vocab::agi

      parameter_value = actor.agi

    end

    self.contents.font.color = system_color

    self.contents.draw_text(x, y, 48, WLH, parameter_name)

    self.contents.font.color = normal_color

    self.contents.draw_text(x + 48, y, 36, WLH, parameter_value, 2)

  end

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

  # * Draw State

  #     actor : actor

  #     x     : draw spot x-coordinate

  #     y     : draw spot y-coordinate

  #     width : draw spot width

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

  def draw_actor_state(actor, x, y, width = 96)

    count = 0

    for state in actor.states

      draw_icon(state.icon_index, x + 24 * count, y)

      count += 1

      break if (24 * count > width - 24)

    end

    if count == 0

      self.contents.draw_text(x, y, 120, WLH, "[Normal]")

    end

  end

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

  # * Draw HP

  #     actor : actor

  #     x     : draw spot x-coordinate

  #     y     : draw spot y-coordinate

  #     width : Width

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

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

    draw_actor_hp_gauge(actor, x, y, width)

    self.contents.font.color = system_color

    self.contents.draw_text(x, y, 30, WLH, Vocab::hp)

    self.contents.font.color = hp_color(actor)

    last_font_size = self.contents.font.size

    xr = x + width

    if width < 100

      self.contents.draw_text(xr - 44, y, 44, WLH, actor.hp, 2)

    else

      self.contents.draw_text(x, y, width, WLH, actor.maxhp, 2)

      maxw = self.contents.text_size(actor.maxhp).width

      self.contents.draw_text(x, y, width - maxw, WLH, "/", 2)

      self.contents.draw_text(x, y, width - maxw - 8, WLH, actor.hp, 2)

    end

  end

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

  # * Draw HP gauge

  #     actor : actor

  #     x     : draw spot x-coordinate

  #     y     : draw spot y-coordinate

  #     width : Width

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

  def draw_actor_hp_gauge(actor, x, y, width = 100)

    gw = width * actor.hp / actor.maxhp

    gc1 = hp_gauge_color1

    gc2 = hp_gauge_color2

    self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)

    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)

  end

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

  # * Draw MP

  #     actor : actor

  #     x     : draw spot x-coordinate

  #     y     : draw spot y-coordinate

  #     width : Width

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

  def draw_actor_mp(actor, x, y, width = 100)

    draw_actor_mp_gauge(actor, x, y, width)

    self.contents.font.color = system_color

    self.contents.draw_text(x, y, 30, WLH, Vocab::mp)

    self.contents.font.color = mp_color(actor)

    last_font_size = self.contents.font.size

    xr = x + width

    if width < 100

      self.contents.draw_text(xr - 44, y, 44, WLH, actor.mp, 2)

    else

      self.contents.draw_text(x, y, width, WLH, actor.maxmp, 2)

      maxw = self.contents.text_size(actor.maxmp).width

      self.contents.draw_text(x, y, width - maxw, WLH, "/", 2)

      self.contents.draw_text(x, y, width - maxw - 8, WLH, actor.mp, 2)

    end

  end

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

  # * Draw MP Gauge

  #     actor : actor

  #     x     : draw spot x-coordinate

  #     y     : draw spot y-coordinate

  #     width : Width

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

  def draw_actor_mp_gauge(actor, x, y, width = 100)

    gw = width * actor.mp / [actor.maxmp, 1].max

    gc1 = mp_gauge_color1

    gc2 = mp_gauge_color2

    self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)

    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)

  end

end
Scene_Menu
Code:
#==============================================================================

# ** Scene_Menu MOD

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

#  This class performs the menu screen processing.

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

 

class Scene_Menu < Scene_Base

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

  # * Object Initialization

  #     menu_index : command cursor's initial position

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

  def initialize(menu_index = 0)

    @menu_index = menu_index

    ## Change Font

    @save_font = Font.default_name

    Font.default_name = ["Verdana", "Arial"]

  end

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

  # * Start processing

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

  def start

    super

    create_menu_background

    create_command_window

    @gold_window = Window_Gold.new(0, 360)

    @status_window = Window_Status.new($game_party.members[0])

  end

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

  # * Termination Processing

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

  def terminate

    super

    dispose_menu_background

    @command_window.dispose

    @gold_window.dispose

    @status_window.dispose

    Font.default_name = @save_font

  end

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

  # * Frame Update

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

  def update

    super

    update_menu_background

    @command_window.update

    @gold_window.update

    @status_window.update

    update_command_selection

  end

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

  # * Create Command Window

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

  def create_command_window

    s1 = Vocab::item

    s2 = Vocab::equip

    s3 = Vocab::save

    s4 = "Load"

    s5 = Vocab::game_end

    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])

    @command_window.index = @menu_index

    if $game_party.members.size == 0          # If number of party members is 0

      @command_window.draw_item(0, false)     # Disable item

      @command_window.draw_item(1, false)     # Disable equipment

    end

    if $game_system.save_disabled             # If save is forbidden

      @command_window.draw_item(2, false)     # Disable save

    end

  end

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

  # * Update Command Selection

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

  def update_command_selection

    if Input.trigger?(Input::B)

      Sound.play_cancel

      $scene = Scene_Map.new

    elsif Input.trigger?(Input::C)

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

        Sound.play_buzzer

        return

      elsif $game_system.save_disabled and @command_window.index == 4

        Sound.play_buzzer

        return

      end

      Sound.play_decision

      case @command_window.index

      when 0      # Item

        $scene = Scene_Item.new

      when 1  # Skill, equipment, status

        $scene = Scene_Equip.new(0)

      when 2      # Save

        $scene = Scene_File.new(true, false, false)

      when 3

        $scene = Scene_File.new(false, false, false)

      when 4      # End Game

        $scene = Scene_End.new

      end

    end

  end

end
Scene_File, Scene_Equip, Scene_End
Code:
#==============================================================================

# ** Scene_File MOD

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

#  This class performs the save and load screen processing.

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

class Scene_File

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

  # * Return to Original Screen

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

  def return_scene

    if @from_title

      $scene = Scene_Title.new

    elsif @from_event

      $scene = Scene_Map.new

    elsif @saving

      $scene = Scene_Menu.new(2)

    else

      $scene = Scene_Menu.new(3)

    end

  end

end

 

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

# ** Scene_Equip Mod

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

#  This class performs the equipment screen processing.

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

 

class Scene_Equip < Scene_Base

 

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

  # * Return to Original Screen

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

  def return_scene

    $scene = Scene_Menu.new(1)

  end

end

 

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

# ** Scene_End

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

#  This class performs game end screen processing.

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

 

class Scene_End < Scene_Base

  

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

  # * Return to Original Screen

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

  def return_scene

    $scene = Scene_Menu.new(4)

  end

end

Instructions

Insert Scripts above Main in the ▼ Materials section

FAQ



Compatibility

Any script that aliases methods in Window_Status, Scene_Menu, Scene_File or Scene_Equip should be posted below these scripts.
Any script that modifies methods in those scripts could conflict with these scripts.

Credits and Thanks

Brewmeister

Terms and Conditions

Don't host this anywhere else. Don't claim credit for original script.
Other than that, pretty much anything you want to do.
Use for commercial/non-commercial, edit, modify, bend, spindle, mutilate, print it & wipe your ass with it, I don't care. :scruff:

Links to other single actor menus for those hunting

viewtopic.php?p=35091#p35091
viewtopic.php?f=12&t=60601
viewtopic.php?f=12&t=60943
viewtopic.php?f=11&t=61260
http://rmrk.net/index.php/topic,6408.0.html
viewtopic.php?f=12&p=642924
 

Jason

Awesome Bro

I actually started something like this, since I was fiddling around with the idea of having a one player party in VX, I've also made a one player battle layout in the VX style. I think since this is already done I'll take it and meddle with it, maybe change some things around, lol.

1manbattle.PNG
 
@udivision: I assume because it was part of the request.

@Brew: Indeed a nice little script... I've seen a few fellas having problems with taking the actor selection part out, so this might really be a good reference.
I see neat scripting style as well, for once... you follow RMVX's style pretty closely; a bit too much at times, like the command window initialization - I don't think assigning 5 variables just to dump them a second later makes too much sense, and I'm not sure why Enterbrain did it.

The one thing that really confuses me is the font assigning... Why would you assign a specific font to the menu, while keeping the same windowskin the rest of the game uses? That'll create confusion if anything, and Verdana and Arial aren't fonts you need to layout your dream menu either, IMO... another request thing, probably?

All in all, quite good work on this once, though - might come in handy for some!
 
Yes, the requester left skills off the menu. I assume because his skills are all battle related. It would be pretty easy to add back.
He also asked for the ability to change the font for the menu.

Blue, I expect the reason for assigning the menu options to variables was just for 'neatness'.
I do the same thing when I'm coding something I expect novice programmers to use as an example or learning tool.
I did see a nice modification to the battle actor command window that did command selection using the command name instead of index.
Nice, because you could rearrange the menu and each command works as intended regardless of position.

Be Well
 

Dokien

Sponsor

Add this to your Materials:

Scene_End
Code:
#==============================================================================

# ** Scene_End

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

#  This class performs game end screen processing.

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

 

class Scene_End < Scene_Base

  

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

  # * Return to Original Screen

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

  def return_scene

    $scene = Scene_Menu.new(4)

  end

end

There was a bug that repeated for me when I cancelled the Game End option and it added another menu selection with no value.
 

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