Advertisement
Guest User

DT's Display One Actor Menu

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