Advertisement
roninator2

Kid Friendly Basic Quest - Actor Command

Dec 13th, 2024
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 10.11 KB | None | 0 0
  1. # ╔═════════════════════════════════════╦════════════════════╗
  2. # ║ Title: KFBQ Actor Command Override  ║  Version: 1.00     ║
  3. # ║ Author: Roninator2                  ║                    ║
  4. # ╠═════════════════════════════════════╬════════════════════╣
  5. # ║ Function:                           ║   Date Created     ║
  6. # ║                                     ╠════════════════════╣
  7. # ║   FFMQ Style Actor Commands         ║    12 Mar 2023     ║
  8. # ╚═════════════════════════════════════╩════════════════════╝
  9. # ╔══════════════════════════════════════════════════════════╗
  10. # ║ Instructions:                                            ║
  11. # ║                                                          ║
  12. # ║  none                                                    ║
  13. # ╚══════════════════════════════════════════════════════════╝
  14. # ╔══════════════════════════════════════════════════════════╗
  15. # ║ Terms of use:                                            ║
  16. # ║ Free for all uses in RPG Maker - Except nudity           ║
  17. # ╚══════════════════════════════════════════════════════════╝
  18.  
  19. #==============================================================================
  20. # ■ Window_BattleCommandBlank
  21. #==============================================================================
  22. class Window_BattleCommandBlank < Window_Base
  23.   #--------------------------------------------------------------------------
  24.   # * Object Initialization
  25.   #--------------------------------------------------------------------------
  26.   def initialize(x, y, w, h)
  27.     hgt = line_height * h + 10
  28.     super(x, y, w, hgt)
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # * Get Line Height
  32.   #--------------------------------------------------------------------------
  33.   def line_height
  34.     return 21
  35.   end  
  36. end
  37.  
  38. #==============================================================================
  39. # ** Window_ActorCommand
  40. #==============================================================================
  41.  
  42. class Window_KFBQActorCommand < Window_HorzCommand
  43.   #--------------------------------------------------------------------------
  44.   # * Object Initialization
  45.   #--------------------------------------------------------------------------
  46.   def initialize
  47.     super(0, 0)
  48.     self.opacity = 0
  49.     self.back_opacity = 0
  50.     self.z = 400
  51.     self.openness = 0
  52.     deactivate
  53.     @actor = nil
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # * Get Window Width
  57.   #--------------------------------------------------------------------------
  58.   def window_width
  59.     return Graphics.width
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # * Get Number of Lines to Show
  63.   #--------------------------------------------------------------------------
  64.   def visible_line_number
  65.     return 4
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # * Get Row Count
  69.   #--------------------------------------------------------------------------
  70.   def row_max
  71.     return 2
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # * Get Digit Count
  75.   #--------------------------------------------------------------------------
  76.   def col_max
  77.     return 2
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # * Get Spacing for Items Arranged Side by Side
  81.   #--------------------------------------------------------------------------
  82.   def spacing
  83.     return  8
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # * Calculate Width of Window Contents
  87.   #--------------------------------------------------------------------------
  88.   def contents_width
  89.     (item_width + spacing) * (item_max / 2) - spacing
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # * Calculate Height of Window Contents
  93.   #--------------------------------------------------------------------------
  94.   def contents_height
  95.     item_height * 4
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # * Create Command List
  99.   #--------------------------------------------------------------------------
  100.   def make_command_list
  101.     return unless @actor
  102.     add_attack_command
  103.     add_spell_command
  104.     add_item_command
  105.     add_guard_command
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # * Add Attack Command to List
  109.   #--------------------------------------------------------------------------
  110.   def add_attack_command
  111.     add_command("Attack", :attack, @actor.attack_usable?)
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # * Add Attack Command to List
  115.   #--------------------------------------------------------------------------
  116.   def add_spell_command
  117.     add_command("Spell", :spell)
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # * Add Item Command to List
  121.   #--------------------------------------------------------------------------
  122.   def add_item_command
  123.     add_command("Item", :item)
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # * Add Guard Command to List
  127.   #--------------------------------------------------------------------------
  128.   def add_guard_command
  129.     add_command("Defense", :guard, @actor.guard_usable?)
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # * Setup
  133.   #--------------------------------------------------------------------------
  134.   def setup(actor)
  135.     @actor = actor
  136.     clear_command_list
  137.     make_command_list
  138.     refresh
  139.     select(0)
  140.     activate
  141.     open
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # * Draw Item
  145.   #--------------------------------------------------------------------------
  146.   def draw_item(index)
  147.     change_color(normal_color, command_enabled?(index))
  148.     draw_text(item_rect_for_text(index), command_name(index), alignment)
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # * Get Rectangle for Displaying Items
  152.   #--------------------------------------------------------------------------
  153.   def item_rect(index)
  154.     rect = Rect.new
  155.     rect.width = item_width
  156.     rect.height = item_height
  157.     case index
  158.     when 0
  159.       rect.x = 20
  160.       rect.y = 0
  161.     when 1
  162.       rect.x = 220
  163.       rect.y = 0
  164.     when 2
  165.       rect.x = 20
  166.       rect.y = 60
  167.     when 3
  168.       rect.x = 220
  169.       rect.y = 60
  170.     end
  171.     rect
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # * Update Cursor
  175.   #--------------------------------------------------------------------------
  176.   def update_cursor
  177.     cursor_rect.set(item_rect(@index))
  178.     cursor_rect.width -= 150
  179.     case index
  180.     when 0
  181.       cursor_rect.x = 90
  182.       cursor_rect.y = 0
  183.     when 1
  184.       cursor_rect.x = 290
  185.       cursor_rect.y = 0
  186.     when 2
  187.       cursor_rect.x = 90
  188.       cursor_rect.y = 60
  189.     when 3
  190.       cursor_rect.x = 290
  191.       cursor_rect.y = 60
  192.     end
  193.     cursor_rect
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # * Get Alignment
  197.   #--------------------------------------------------------------------------
  198.   def alignment
  199.     return 1
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # * Move Cursor Down
  203.   #--------------------------------------------------------------------------
  204.   def cursor_down(wrap = false)
  205.     case index
  206.     when 0
  207.       select(2)
  208.     when 1
  209.       select(3)
  210.     when 2
  211.       select(0)
  212.     when 3
  213.       select(1)
  214.     end
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # * Move Cursor Up
  218.   #--------------------------------------------------------------------------
  219.   def cursor_up(wrap = false)
  220.     case index
  221.     when 0
  222.       select(2)
  223.     when 1
  224.       select(3)
  225.     when 2
  226.       select(0)
  227.     when 3
  228.       select(1)
  229.     end
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # * Move Cursor Right
  233.   #--------------------------------------------------------------------------
  234.   def cursor_right(wrap = false)
  235.     case index
  236.     when 0
  237.       select(1)
  238.     when 1
  239.       select(0)
  240.     when 2
  241.       select(3)
  242.     when 3
  243.       select(2)
  244.     end
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # * Move Cursor Left
  248.   #--------------------------------------------------------------------------
  249.   def cursor_left(wrap = false)
  250.     case index
  251.     when 0
  252.       select(1)
  253.     when 1
  254.       select(0)
  255.     when 2
  256.       select(3)
  257.     when 3
  258.       select(2)
  259.     end
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # * Move Cursor One Page Down
  263.   #--------------------------------------------------------------------------
  264.   def cursor_pagedown
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # * Move Cursor One Page Up
  268.   #--------------------------------------------------------------------------
  269.   def cursor_pageup
  270.   end
  271. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement