[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

Image

Demo

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

Script

Window_Status
  1. #==============================================================================
  2. # ** Window_Status MOD
  3. #------------------------------------------------------------------------------
  4. #  This window displays full status specs on the status screen.
  5. #==============================================================================
  6.  
  7. class Window_Status < Window_Base
  8.   #--------------------------------------------------------------------------
  9.   # * Object Initialization
  10.   #     actor : actor
  11.   #--------------------------------------------------------------------------
  12.   def initialize(actor)
  13.     super(160, 0, 384, 416)
  14.     @actor = actor
  15.     refresh
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # * Refresh
  19.   #--------------------------------------------------------------------------
  20.   def refresh
  21.     self.contents.clear
  22.     draw_actor_face(@actor, 8, 8)
  23.     draw_actor_name(@actor, 108, 0)
  24.     draw_actor_class(@actor, 236, 0)
  25.     draw_basic_info(108, 64)
  26.     draw_actor_state(@actor, 8, 128)
  27.     draw_parameters(8, 160)
  28.     draw_actor_level(@actor, 8, 288)
  29.     draw_exp_info(8, 320)
  30.     draw_equipments(128, 128)
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # * Draw Basic Information
  34.   #     x : Draw spot X coordinate
  35.   #     y : Draw spot Y coordinate
  36.   #--------------------------------------------------------------------------
  37.   def draw_basic_info(x, y)
  38.     draw_actor_hp(@actor, x, y)
  39.     draw_actor_mp(@actor, x + 108, y)
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # * Draw Parameters
  43.   #     x : Draw spot X coordinate
  44.   #     y : Draw spot Y coordinate
  45.   #--------------------------------------------------------------------------
  46.   def draw_parameters(x, y)
  47.     draw_actor_parameter(@actor, x, y + WLH * 0, 0)
  48.     draw_actor_parameter(@actor, x, y + WLH * 1, 1)
  49.     draw_actor_parameter(@actor, x, y + WLH * 2, 2)
  50.     draw_actor_parameter(@actor, x, y + WLH * 3, 3)
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # * Draw Experience Information
  54.   #     x : Draw spot X coordinate
  55.   #     y : Draw spot Y coordinate
  56.   #--------------------------------------------------------------------------
  57.   def draw_exp_info(x, y)
  58.     s1 = @actor.exp_s
  59.     s2 = @actor.next_rest_exp_s
  60.     s_next = sprintf(Vocab::ExpNext, Vocab::level)
  61.     self.contents.font.color = system_color
  62.     self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)
  63.     self.contents.draw_text(x, y + WLH * 1, 180, WLH, s_next)
  64.     self.contents.font.color = normal_color
  65.     self.contents.draw_text(x + 128, y + WLH * 0, 180, WLH, s1, 0)
  66.     self.contents.draw_text(x + 128, y + WLH * 1, 180, WLH, s2, 0)
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # * Draw Equipment
  70.   #     x : Draw spot X coordinate
  71.   #     y : Draw spot Y coordinate
  72.   #--------------------------------------------------------------------------
  73.   def draw_equipments(x, y)
  74.     self.contents.font.color = system_color
  75.     self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
  76.     for i in 0..4
  77.       draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1))
  78.     end
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # * Draw Parameters
  82.   #     actor : actor
  83.   #     x     : draw spot x-coordinate
  84.   #     y     : draw spot y-coordinate
  85.   #     type  : Type of parameters (0-3)
  86.   #--------------------------------------------------------------------------
  87.   def draw_actor_parameter(actor, x, y, type)
  88.     case type
  89.     when 0
  90.       parameter_name = Vocab::atk
  91.       parameter_value = actor.atk
  92.     when 1
  93.       parameter_name = Vocab::def
  94.       parameter_value = actor.def
  95.     when 2
  96.       parameter_name = Vocab::spi
  97.       parameter_value = actor.spi
  98.     when 3
  99.       parameter_name = Vocab::agi
  100.       parameter_value = actor.agi
  101.     end
  102.     self.contents.font.color = system_color
  103.     self.contents.draw_text(x, y, 48, WLH, parameter_name)
  104.     self.contents.font.color = normal_color
  105.     self.contents.draw_text(x + 48, y, 36, WLH, parameter_value, 2)
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # * Draw State
  109.   #     actor : actor
  110.   #     x     : draw spot x-coordinate
  111.   #     y     : draw spot y-coordinate
  112.   #     width : draw spot width
  113.   #--------------------------------------------------------------------------
  114.   def draw_actor_state(actor, x, y, width = 96)
  115.     count = 0
  116.     for state in actor.states
  117.       draw_icon(state.icon_index, x + 24 * count, y)
  118.       count += 1
  119.       break if (24 * count > width - 24)
  120.     end
  121.     if count == 0
  122.       self.contents.draw_text(x, y, 120, WLH, "[Normal]")
  123.     end
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # * Draw HP
  127.   #     actor : actor
  128.   #     x     : draw spot x-coordinate
  129.   #     y     : draw spot y-coordinate
  130.   #     width : Width
  131.   #--------------------------------------------------------------------------
  132.   def draw_actor_hp(actor, x, y, width = 100)
  133.     draw_actor_hp_gauge(actor, x, y, width)
  134.     self.contents.font.color = system_color
  135.     self.contents.draw_text(x, y, 30, WLH, Vocab::hp)
  136.     self.contents.font.color = hp_color(actor)
  137.     last_font_size = self.contents.font.size
  138.     xr = x + width
  139.     if width < 100
  140.       self.contents.draw_text(xr - 44, y, 44, WLH, actor.hp, 2)
  141.     else
  142.       self.contents.draw_text(x, y, width, WLH, actor.maxhp, 2)
  143.       maxw = self.contents.text_size(actor.maxhp).width
  144.       self.contents.draw_text(x, y, width - maxw, WLH, "/", 2)
  145.       self.contents.draw_text(x, y, width - maxw - 8, WLH, actor.hp, 2)
  146.     end
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # * Draw HP gauge
  150.   #     actor : actor
  151.   #     x     : draw spot x-coordinate
  152.   #     y     : draw spot y-coordinate
  153.   #     width : Width
  154.   #--------------------------------------------------------------------------
  155.   def draw_actor_hp_gauge(actor, x, y, width = 100)
  156.     gw = width * actor.hp / actor.maxhp
  157.     gc1 = hp_gauge_color1
  158.     gc2 = hp_gauge_color2
  159.     self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
  160.     self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # * Draw MP
  164.   #     actor : actor
  165.   #     x     : draw spot x-coordinate
  166.   #     y     : draw spot y-coordinate
  167.   #     width : Width
  168.   #--------------------------------------------------------------------------
  169.   def draw_actor_mp(actor, x, y, width = 100)
  170.     draw_actor_mp_gauge(actor, x, y, width)
  171.     self.contents.font.color = system_color
  172.     self.contents.draw_text(x, y, 30, WLH, Vocab::mp)
  173.     self.contents.font.color = mp_color(actor)
  174.     last_font_size = self.contents.font.size
  175.     xr = x + width
  176.     if width < 100
  177.       self.contents.draw_text(xr - 44, y, 44, WLH, actor.mp, 2)
  178.     else
  179.       self.contents.draw_text(x, y, width, WLH, actor.maxmp, 2)
  180.       maxw = self.contents.text_size(actor.maxmp).width
  181.       self.contents.draw_text(x, y, width - maxw, WLH, "/", 2)
  182.       self.contents.draw_text(x, y, width - maxw - 8, WLH, actor.mp, 2)
  183.     end
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # * Draw MP Gauge
  187.   #     actor : actor
  188.   #     x     : draw spot x-coordinate
  189.   #     y     : draw spot y-coordinate
  190.   #     width : Width
  191.   #--------------------------------------------------------------------------
  192.   def draw_actor_mp_gauge(actor, x, y, width = 100)
  193.     gw = width * actor.mp / [actor.maxmp, 1].max
  194.     gc1 = mp_gauge_color1
  195.     gc2 = mp_gauge_color2
  196.     self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
  197.     self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  198.   end
  199. end
Expand to see the code.

Scene_Menu
  1. #==============================================================================
  2. # ** Scene_Menu MOD
  3. #------------------------------------------------------------------------------
  4. #  This class performs the menu screen processing.
  5. #==============================================================================
  6.  
  7. class Scene_Menu < Scene_Base
  8.   #--------------------------------------------------------------------------
  9.   # * Object Initialization
  10.   #     menu_index : command cursor's initial position
  11.   #--------------------------------------------------------------------------
  12.   def initialize(menu_index = 0)
  13.     @menu_index = menu_index
  14.     ## Change Font
  15.     @save_font = Font.default_name
  16.     Font.default_name = ["Verdana", "Arial"]
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # * Start processing
  20.   #--------------------------------------------------------------------------
  21.   def start
  22.     super
  23.     create_menu_background
  24.     create_command_window
  25.     @gold_window = Window_Gold.new(0, 360)
  26.     @status_window = Window_Status.new($game_party.members[0])
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # * Termination Processing
  30.   #--------------------------------------------------------------------------
  31.   def terminate
  32.     super
  33.     dispose_menu_background
  34.     @command_window.dispose
  35.     @gold_window.dispose
  36.     @status_window.dispose
  37.     Font.default_name = @save_font
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # * Frame Update
  41.   #--------------------------------------------------------------------------
  42.   def update
  43.     super
  44.     update_menu_background
  45.     @command_window.update
  46.     @gold_window.update
  47.     @status_window.update
  48.     update_command_selection
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # * Create Command Window
  52.   #--------------------------------------------------------------------------
  53.   def create_command_window
  54.     s1 = Vocab::item
  55.     s2 = Vocab::equip
  56.     s3 = Vocab::save
  57.     s4 = "Load"
  58.     s5 = Vocab::game_end
  59.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
  60.     @command_window.index = @menu_index
  61.     if $game_party.members.size == 0          # If number of party members is 0
  62.       @command_window.draw_item(0, false)     # Disable item
  63.       @command_window.draw_item(1, false)     # Disable equipment
  64.     end
  65.     if $game_system.save_disabled             # If save is forbidden
  66.       @command_window.draw_item(2, false)     # Disable save
  67.     end
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # * Update Command Selection
  71.   #--------------------------------------------------------------------------
  72.   def update_command_selection
  73.     if Input.trigger?(Input::B)
  74.       Sound.play_cancel
  75.       $scene = Scene_Map.new
  76.     elsif Input.trigger?(Input::C)
  77.       if $game_party.members.size == 0 and @command_window.index < 4
  78.         Sound.play_buzzer
  79.         return
  80.       elsif $game_system.save_disabled and @command_window.index == 4
  81.         Sound.play_buzzer
  82.         return
  83.       end
  84.       Sound.play_decision
  85.       case @command_window.index
  86.       when 0      # Item
  87.         $scene = Scene_Item.new
  88.       when 1  # Skill, equipment, status
  89.         $scene = Scene_Equip.new(0)
  90.       when 2      # Save
  91.         $scene = Scene_File.new(true, false, false)
  92.       when 3
  93.         $scene = Scene_File.new(false, false, false)
  94.       when 4      # End Game
  95.         $scene = Scene_End.new
  96.       end
  97.     end
  98.   end
  99. end
Expand to see the code.

Scene_File, Scene_Equip, Scene_End
  1. #==============================================================================
  2. # ** Scene_File MOD
  3. #------------------------------------------------------------------------------
  4. #  This class performs the save and load screen processing.
  5. #==============================================================================
  6. class Scene_File
  7.   #--------------------------------------------------------------------------
  8.   # * Return to Original Screen
  9.   #--------------------------------------------------------------------------
  10.   def return_scene
  11.     if @from_title
  12.       $scene = Scene_Title.new
  13.     elsif @from_event
  14.       $scene = Scene_Map.new
  15.     elsif @saving
  16.       $scene = Scene_Menu.new(2)
  17.     else
  18.       $scene = Scene_Menu.new(3)
  19.     end
  20.   end
  21. end
  22.  
  23. #==============================================================================
  24. # ** Scene_Equip Mod
  25. #------------------------------------------------------------------------------
  26. #  This class performs the equipment screen processing.
  27. #==============================================================================
  28.  
  29. class Scene_Equip < Scene_Base
  30.  
  31.   #--------------------------------------------------------------------------
  32.   # * Return to Original Screen
  33.   #--------------------------------------------------------------------------
  34.   def return_scene
  35.     $scene = Scene_Menu.new(1)
  36.   end
  37. end
  38.  
  39. #==============================================================================
  40. # ** Scene_End
  41. #------------------------------------------------------------------------------
  42. #  This class performs game end screen processing.
  43. #==============================================================================
  44.  
  45. class Scene_End < Scene_Base
  46.  
  47.   #--------------------------------------------------------------------------
  48.   # * Return to Original Screen
  49.   #--------------------------------------------------------------------------
  50.   def return_scene
  51.     $scene = Scene_Menu.new(4)
  52.   end
  53. end
Expand to see the code.


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
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.

If you'd like to take a look at my one player battle layout, here's a picture :) Show
Image
Yep, nice. I assume anyone who wants a one actor menu, will also want a one actor battle layout.
Any reason why you got rid of skills?
@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
Um, when you quit the load option it returns to the main menu! :O
EDIT: Nice script by the way ;D
good catch, squall. I forgot to test backing out. Fixed, script updated above.
I will definitely be using this script in my game, thanks!
Add this to your Materials:

Scene_End
  1. #==============================================================================
  2. # ** Scene_End
  3. #------------------------------------------------------------------------------
  4. #  This class performs game end screen processing.
  5. #==============================================================================
  6.  
  7. class Scene_End < Scene_Base
  8.  
  9.   #--------------------------------------------------------------------------
  10.   # * Return to Original Screen
  11.   #--------------------------------------------------------------------------
  12.   def return_scene
  13.     $scene = Scene_Menu.new(4)
  14.   end
  15. end
Expand to see the code.


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

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=74305