Guest User

DT's Display One Actor Menu

a guest
Apr 4th, 2012
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 11.01 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # DT's Display One Actor Menu
  4. # Author: DoctorTodd
  5. # Date (04/4/2012)
  6. # Type: (Menu)
  7. # Version: (0.1) (VXA)
  8. # Level: (Simple)
  9. #
  10. #===============================================================================
  11. #
  12. # Description: A menu that displays one actor, while allowing you to switch
  13. # actors
  14. #
  15. # Credits: Me (DoctorTodd)
  16. #
  17. #===============================================================================
  18. #
  19. # Instructions
  20. # Paste above main.
  21. #
  22. #===============================================================================
  23. #
  24. # Contact me for commercial use, other wise just credit me and don't repost
  25. # without my permission.
  26. #
  27. #===============================================================================
  28. #
  29. # Editing begins 40 and ends on 59.
  30. #
  31. #===============================================================================
  32. module DTOPM
  33.  
  34.   #Window skin to use, place in system.
  35.   WINDOW = ('Window')
  36.  
  37.   #Status Window X
  38.   SX = 230
  39.  
  40.   #Status Window Y
  41.   SY = 95
  42.  
  43.   #Gold window X
  44.   GX = 70
  45.  
  46.   #Gold Window Y
  47.   GY = 262
  48.  
  49.   #Command Window X
  50.   CX = 70
  51.  
  52.   #Command Window Y
  53.   CY = 95
  54. end
  55.  
  56. class Scene_Menu < Scene_MenuBase
  57.   #--------------------------------------------------------------------------
  58.   # * Start processing
  59.   #--------------------------------------------------------------------------
  60.   def start
  61.     super
  62.     create_background
  63.     create_command_window
  64.     create_info_window
  65.     create_gold_window
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # * Update
  69.   #--------------------------------------------------------------------------
  70.   def update
  71.     super
  72.     @info_window.update
  73.    @command_window.activate
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # * Create Gold Window
  77.   #--------------------------------------------------------------------------
  78.   def create_gold_window
  79.     @gold_window = Window_Gold.new
  80.     @gold_window.x = (DTOPM::GX)
  81.     @gold_window.y = (DTOPM::GY)
  82.     @gold_window.windowskin = Cache.system(DTOPM::WINDOW)
  83.     @gold_window.height = 55
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # * Create Info Window
  87.   #--------------------------------------------------------------------------
  88.   def create_info_window
  89.     @info_window = Window_MenuInfo.new((DTOPM::SX), (DTOPM::SY))
  90.     @info_window.windowskin = Cache.system(DTOPM::WINDOW)
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # * Create Command Window
  94.   #--------------------------------------------------------------------------
  95.   def create_command_window
  96.    @command_window = Window_MenuCommand.new
  97.     @command_window.set_handler(:item,      method(:command_item))
  98.     @command_window.set_handler(:skill,     method(:command_skill))
  99.     @command_window.set_handler(:equip,     method(:command_equip))
  100.     @command_window.set_handler(:status,    method(:command_status))
  101.     @command_window.set_handler(:save,      method(:command_save))
  102.     @command_window.set_handler(:game_end,  method(:command_game_end))
  103.     @command_window.set_handler(:cancel,    method(:return_scene))
  104.     @command_window.set_handler(:pagedown, method(:next_actor))
  105.     @command_window.set_handler(:pageup,   method(:prev_actor))
  106.     @command_window.x = (DTOPM::CX)
  107.     @command_window.y = (DTOPM::CY)
  108.     @command_window.windowskin = Cache.system(DTOPM::WINDOW)
  109.   end
  110. end
  111.  
  112.  #--------------------------------------------------------------------------
  113.   # * [Item] Command
  114.   #--------------------------------------------------------------------------
  115.   def command_item
  116.     SceneManager.call(Scene_Item)
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # * [Equipment] Command
  120.   #--------------------------------------------------------------------------
  121.   def command_equip
  122.          @actor = $game_party.members[0]
  123.     SceneManager.call(Scene_Equip)
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # * [Status] Command
  127.   #--------------------------------------------------------------------------
  128.   def command_status
  129.          @actor = $game_party.members[0]
  130.     SceneManager.call(Scene_Status)
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # * [Save] Command
  134.   #--------------------------------------------------------------------------
  135.   def command_save
  136.     SceneManager.call(Scene_Save)
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # * [Exit Game] Command
  140.   #--------------------------------------------------------------------------
  141.   def command_game_end
  142.     SceneManager.call(Scene_End)
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # * [Skill] Command
  146.   #--------------------------------------------------------------------------
  147.   def command_skill
  148.          @actor = $game_party.members[0]
  149.       SceneManager.call(Scene_Skill)
  150.     end
  151.   #--------------------------------------------------------------------------  
  152.   # * Change Actors
  153.   #--------------------------------------------------------------------------
  154.   def on_actor_change
  155.     @command_window.actor = @actor
  156.     @info_window.actor = @actor
  157.   end
  158. #===================================================================
  159. # ** Window_MenuStatus
  160. #------------------------------------------------------------------------------
  161. #  This window displays the characters status on the menu screen.
  162. #==============================================================================
  163. class Window_MenuInfo < Window_Base
  164.   #--------------------------------------------------------------------------
  165.   # * Object Initialization
  166.   #     x : window X coordinate
  167.   #     y : window Y coordinate
  168.   #--------------------------------------------------------------------------
  169.   def initialize(x, y)
  170.     super(x, y, 300, 221)
  171.     refresh
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # * Refresh
  175.   #--------------------------------------------------------------------------
  176.   def refresh
  177.     self.contents.clear
  178.         @actor = $game_party.members[0]
  179.       draw_actor_face(@actor, 0, 0)
  180.       draw_actor_name(@actor , 110, 5)
  181.       draw_actor_level(@actor, 190, 5)
  182.       draw_actor_hp(@actor, 110 ,40)
  183.       draw_actor_mp(@actor, 110 , 65)
  184.       draw_actor_param(@actor, 0, 100, 0)
  185.       draw_actor_param(@actor, 0, 124, 1)
  186.       draw_actor_param(@actor, 0, 148, 2)
  187.       draw_actor_param(@actor, 0, 172, 3)
  188.       draw_actor_graphic(@actor, 220, 160)
  189.       draw_actor_icons(@actor, 190, 180, width = 96)
  190.     end
  191.   end
  192. #==============================================================================
  193. # ** Window_MenuCommand
  194. #------------------------------------------------------------------------------
  195. #  This command window appears on the menu screen.
  196. #==============================================================================
  197.  
  198. class Window_MenuCommand < Window_Command
  199.   #--------------------------------------------------------------------------
  200.   # * Initialize Command Selection Position (Class Method)
  201.   #--------------------------------------------------------------------------
  202.   def self.init_command_position
  203.     @@last_command_symbol = nil
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # * Object Initialization
  207.   #--------------------------------------------------------------------------
  208.   def initialize
  209.     super(0, 0)
  210.     select_last
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # * Get Window Width
  214.   #--------------------------------------------------------------------------
  215.   def window_width
  216.     return 160
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # * Get Number of Lines to Show
  220.   #--------------------------------------------------------------------------
  221.   def visible_line_number
  222.     item_max
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # * Create Command List
  226.   #--------------------------------------------------------------------------
  227.   def make_command_list
  228.     add_main_commands
  229.     add_original_commands
  230.     add_save_command
  231.     add_game_end_command
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # * Add Main Commands to List
  235.   #--------------------------------------------------------------------------
  236.   def add_main_commands
  237.     add_command(Vocab::item,   :item,   main_commands_enabled)
  238.     add_command(Vocab::skill,  :skill,  main_commands_enabled)
  239.     add_command(Vocab::equip,  :equip,  main_commands_enabled)
  240.     add_command(Vocab::status, :status, main_commands_enabled)
  241.   end
  242.   #--------------------------------------------------------------------------
  243.   # * For Adding Original Commands
  244.   #--------------------------------------------------------------------------
  245.   def add_original_commands
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # * Add Save to Command List
  249.   #--------------------------------------------------------------------------
  250.   def add_save_command
  251.     add_command(Vocab::save, :save, save_enabled)
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # * Add Exit Game to Command List
  255.   #--------------------------------------------------------------------------
  256.   def add_game_end_command
  257.     add_command(Vocab::game_end, :game_end)
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # * Get Activation State of Main Commands
  261.   #--------------------------------------------------------------------------
  262.   def main_commands_enabled
  263.     $game_party.exists
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # * Get Activation State of Formation
  267.   #--------------------------------------------------------------------------
  268.   def formation_enabled
  269.     $game_party.members.size >= 2 && !$game_system.formation_disabled
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # * Get Activation State of Save
  273.   #--------------------------------------------------------------------------
  274.   def save_enabled
  275.     !$game_system.save_disabled
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # * Processing When OK Button Is Pressed
  279.   #--------------------------------------------------------------------------
  280.   def process_ok
  281.     @@last_command_symbol = current_symbol
  282.     super
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # * Restore Previous Selection Position
  286.   #--------------------------------------------------------------------------
  287.   def select_last
  288.     select_symbol(@@last_command_symbol)
  289.   end
  290. end
Advertisement
Add Comment
Please, Sign In to add comment