Advertisement
roninator2

Kid Friendly Basic Quest - Party Command

Dec 14th, 2024
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.10 KB | None | 0 0
  1. # ╔═════════════════════════════════════╦════════════════════╗
  2. # ║ Title: KFBQ Party Command Override  ║  Version: 1.00     ║
  3. # ║ Author: Roninator2                  ║                    ║
  4. # ╠═════════════════════════════════════╬════════════════════╣
  5. # ║ Function:                           ║   Date Created     ║
  6. # ║                                     ╠════════════════════╣
  7. # ║   FFMQ Style Party Command          ║    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_PartyCommand
  21. #==============================================================================
  22.  
  23. class Window_KFBQPartyCommand < Window_HorzCommand
  24.   #--------------------------------------------------------------------------
  25.   # * Object Initialization
  26.   #--------------------------------------------------------------------------
  27.   def initialize
  28.     super(0, 20)
  29.     self.openness = 0
  30.     self.z = 400
  31.     self.opacity = 0
  32.     self.back_opacity = 0
  33.     self.contents_opacity = 255
  34.     deactivate
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # * Get Window Width
  38.   #--------------------------------------------------------------------------
  39.   def window_width
  40.     return Graphics.width
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # * Get Number of Lines to Show
  44.   #--------------------------------------------------------------------------
  45.   def visible_line_number
  46.     return 1
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # * Get Digit Count
  50.   #--------------------------------------------------------------------------
  51.   def col_max
  52.     return 3
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # * Get Spacing for Items Arranged Side by Side
  56.   #--------------------------------------------------------------------------
  57.   def spacing
  58.     return 12
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # * Get Item Width
  62.   #--------------------------------------------------------------------------
  63.   def item_width
  64.     (width - standard_padding * 2 + spacing) / col_max - spacing
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # * Calculate Width of Window Contents
  68.   #--------------------------------------------------------------------------
  69.   def contents_width
  70.     (item_width + spacing) * item_max - spacing
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # * Calculate Height of Window Contents
  74.   #--------------------------------------------------------------------------
  75.   def contents_height
  76.     item_height
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # * Get Leading Digits
  80.   #--------------------------------------------------------------------------
  81.   def top_col
  82.     ox / (item_width + spacing)
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # * Set Leading Digits
  86.   #--------------------------------------------------------------------------
  87.   def top_col=(col)
  88.     col = 0 if col < 0
  89.     col = col_max - 1 if col > col_max - 1
  90.     self.ox = col * (item_width + spacing)
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # * Get Trailing Digits
  94.   #--------------------------------------------------------------------------
  95.   def bottom_col
  96.     top_col + col_max - 1
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # * Set Trailing Digits
  100.   #--------------------------------------------------------------------------
  101.   def bottom_col=(col)
  102.     self.top_col = col - (col_max - 1)
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # * Scroll Cursor to Position Within Screen
  106.   #--------------------------------------------------------------------------
  107.   def ensure_cursor_visible
  108.     self.top_col = index if index < top_col
  109.     self.bottom_col = index if index > bottom_col
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # * Get Rectangle for Displaying Items
  113.   #--------------------------------------------------------------------------
  114.   def item_rect(index)
  115.     rect = super
  116.     rect.x = index * (item_width + spacing) + (30 / (index + 1))
  117.     rect.y = 0
  118.     rect.width -= 60
  119.     rect
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # * Get Alignment
  123.   #--------------------------------------------------------------------------
  124.   def alignment
  125.     return 1
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # * Move Cursor Down
  129.   #--------------------------------------------------------------------------
  130.   def cursor_down(wrap = false)
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # * Move Cursor Up
  134.   #--------------------------------------------------------------------------
  135.   def cursor_up(wrap = false)
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # * Move Cursor One Page Down
  139.   #--------------------------------------------------------------------------
  140.   def cursor_pagedown
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # * Move Cursor One Page Up
  144.   #--------------------------------------------------------------------------
  145.   def cursor_pageup
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # * Create Command List
  149.   #--------------------------------------------------------------------------
  150.   def make_command_list
  151.     add_command("Battle",  :fight)
  152.     add_command("Run", :escape)
  153.     add_command("Control",  :control)
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # * Setup
  157.   #--------------------------------------------------------------------------
  158.   def setup
  159.     clear_command_list
  160.     make_command_list
  161.     refresh
  162.     select(0)
  163.     activate
  164.     open
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # * Update Cursor
  168.   #--------------------------------------------------------------------------
  169.   def update_cursor
  170.     if @index < 0
  171.       cursor_rect.empty
  172.     else
  173.       ensure_cursor_visible
  174.       cursor_rect.set(item_rect(@index))
  175.       case index
  176.       when 1
  177.         cursor_rect.x -= 3
  178.       when 2
  179.         cursor_rect.x -= 9
  180.       end
  181.     end
  182.   end
  183. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement