Advertisement
roninator2

Kid Friendly Basic Quest - Status Menu

Dec 14th, 2024
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 18.61 KB | None | 0 0
  1. # ╔═════════════════════════════════════╦════════════════════╗
  2. # ║ Title: KFBQ Status Menu Functions   ║  Version: 1.00     ║
  3. # ║ Author: Roninator2                  ║                    ║
  4. # ╠═════════════════════════════════════╬════════════════════╣
  5. # ║ Function:                           ║   Date Created     ║
  6. # ║                                     ╠════════════════════╣
  7. # ║   FFMQ Style Status Screens         ║    09 Mar 2023     ║
  8. # ╚═════════════════════════════════════╩════════════════════╝
  9. # ╔══════════════════════════════════════════════════════════╗
  10. # ║ Instructions:                                            ║
  11. # ║                                                          ║
  12. # ║  Set the Windows to look like FFMQ.                      ║
  13. # ║                                                          ║
  14. # ║  Set the numbers for the icons to display below          ║
  15. # ║                                                          ║
  16. # ╚══════════════════════════════════════════════════════════╝
  17. # ╔══════════════════════════════════════════════════════════╗
  18. # ║ Terms of use:                                            ║
  19. # ║ Free for all uses in RPG Maker - Except nudity           ║
  20. # ╚══════════════════════════════════════════════════════════╝
  21.  
  22. #==============================================================================
  23. # ** Module Element Icons for Status
  24. #==============================================================================
  25. module R2_Element_Icons
  26.   Elements = {
  27.   # Element ID => Icon number in Iconset sheet
  28.       1 => 143,   # damage
  29.       2 => 121,   # zombie
  30.       3 => 96,    # fire
  31.       4 => 97,    # water
  32.       5 => 98,    # thunder
  33.       6 => 100,   # earth
  34.       7 => 101,   # wind
  35.       8 => 159,   # shoot
  36.       9 => 122,   # drain
  37.       10 => 144,  # axe
  38.       11 => 278,  # bomb
  39.       }
  40. end
  41.  
  42. #==============================================================================
  43. # ** Window_Status_Command
  44. #==============================================================================
  45. class Window_Status_Command < Window_Command
  46.   #--------------------------------------------------------------------------
  47.   # * Initialize
  48.   #--------------------------------------------------------------------------
  49.   def initialize(x, y)
  50.     super(x, y)
  51.     self.back_opacity = 255
  52.     refresh
  53.     activate
  54.     unselect
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # * Dispose
  58.   #--------------------------------------------------------------------------
  59.   def dispose
  60.     contents.dispose unless disposed?
  61.     super unless disposed?
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # * Get Window Width
  65.   #--------------------------------------------------------------------------
  66.   def refresh
  67.     contents.clear
  68.     change_color(crisis_color)
  69.     name = "Status"
  70.     draw_text(4, 0, 200, line_height, name, 1)
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # * Get Window Width
  74.   #--------------------------------------------------------------------------
  75.   def window_width
  76.     return Graphics.width / 2
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # * Get Window Height
  80.   #--------------------------------------------------------------------------
  81.   def window_height
  82.     fitting_height(1)
  83.   end
  84. end
  85.  
  86. #==============================================================================
  87. # ** Window_Actor1_Exp
  88. #==============================================================================
  89. class Window_Actor1_Exp < Window_Base
  90.   #--------------------------------------------------------------------------
  91.   # * Object Initialization
  92.   #--------------------------------------------------------------------------
  93.   def initialize
  94.     super(0, 0, Graphics.width, Graphics.height / 3)
  95.     @actor = $game_party.members[0]
  96.     self.back_opacity = 255
  97.     refresh
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # * Refresh
  101.   #--------------------------------------------------------------------------
  102.   def refresh
  103.     contents.clear
  104.     draw_currency_value
  105.     draw_exp_info
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # * Draw Number (Gold Etc.) with Currency Unit
  109.   #--------------------------------------------------------------------------
  110.   def draw_currency_value
  111.     text = Vocab::currency_unit
  112.     cx = text_size(text).width
  113.     change_color(normal_color)
  114.     draw_text(205, 0, cx + 10, line_height, $game_party.gold, 2)
  115.     draw_text(0, 0, width, line_height, text, 0)
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # * Draw Experience Information
  119.   #--------------------------------------------------------------------------
  120.   def draw_exp_info
  121.     change_color(normal_color)
  122.     s1 = @actor.max_level? ? "-------" : @actor.exp
  123.     s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp
  124.     s_next = "NEXT EXP"
  125.     draw_text(0, 40, 180, line_height, "EXP")
  126.     draw_text(Graphics.width / 2, 40, 180, line_height, s_next)
  127.     draw_text(Graphics.width / 2 - 210, 40, 180, line_height, s1, 2)
  128.     draw_text(Graphics.width - 210, 40, 180, line_height, s2, 2)
  129.   end
  130. end
  131.  
  132. #==============================================================================
  133. # ** Window_Actor1_Element_Status
  134. #==============================================================================
  135. class Window_Actor1_Element_Status < Window_Base
  136.   #--------------------------------------------------------------------------
  137.   # * Object Initialization
  138.   #--------------------------------------------------------------------------
  139.   def initialize
  140.     super(0, Graphics.height / 2 - 20, Graphics.width / 2, Graphics.height / 3)
  141.     @actor = $game_party.members[0]
  142.     self.back_opacity = 0
  143.     refresh
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # * Refresh
  147.   #--------------------------------------------------------------------------
  148.   def refresh
  149.     contents.clear
  150.     draw_icons
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # * Draw Icons
  154.   #--------------------------------------------------------------------------
  155.   def draw_icons
  156.     # R2_Element_Icons::Elements
  157.     # code 13 - state rate - states
  158.     # code 14 - state resist - states
  159.     # code 11 - element rate - elements - 3 = fire
  160.     # code 12 - debuff rate - params - 0 = mhp
  161.     # code 22 - xparam
  162.     # code 23 - sparams
  163.     # element defense
  164.     data1 = []
  165.     fet = @actor.feature_objects.size
  166.     for g in 0..fet - 1 do
  167.       one = @actor.feature_objects[g].features
  168.       for e in 0..one.size - 1
  169.         if one[e].code == 11
  170.           data1 << one[e].data_id
  171.         end
  172.       end
  173.     end
  174.     data1.compact!
  175.     data1.uniq!
  176.     data1.each do |el|
  177.       num = el
  178.       y = 24
  179.       y = 52 if num > 5
  180.       num -= 5 if num > 5
  181.       draw_icon(R2_Element_Icons::Elements[el],  num * 24 + num * 8 - 30, y)
  182.     end
  183.     # status defense
  184.     data2 = []
  185.     fet2 = @actor.feature_objects.size
  186.     for i in 0..fet2 - 1 do
  187.       two = @actor.feature_objects[i].features
  188.       for h in 0..two.size - 1
  189.         if two[h].code == 14
  190.           state = $data_states[two[h].data_id]
  191.           data2 << state
  192.         end
  193.       end
  194.     end
  195.     data2.compact!
  196.     data2.uniq!
  197.     data2.each do |st|
  198.       num = st.id
  199.       y = 86
  200.       y = 120 if num > 5
  201.       num -= 5 if num > 5
  202.       draw_icon(st.icon_index, num * 24 + num * 8 - 30, y)
  203.     end
  204.   end
  205. end
  206.  
  207. #==============================================================================
  208. # ** Window_Actor2_Element_Status
  209. #==============================================================================
  210. class Window_Actor2_Element_Status < Window_Base
  211.   #--------------------------------------------------------------------------
  212.   # * Object Initialization
  213.   #--------------------------------------------------------------------------
  214.   def initialize
  215.     super(Graphics.width / 2, Graphics.height / 2 - 20, Graphics.width / 2, Graphics.height / 3)
  216.     @actor = $game_party.members[1]
  217.     self.back_opacity = 0
  218.     refresh
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # * Refresh
  222.   #--------------------------------------------------------------------------
  223.   def refresh
  224.     contents.clear
  225.     draw_icons
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # * Draw Icons
  229.   #--------------------------------------------------------------------------
  230.   def draw_icons
  231.     # R2_Element_Icons::Elements
  232.     # code 13 - state rate - states
  233.     # code 14 - state resist - states
  234.     # code 11 - element rate - elements - 3 = fire
  235.     # code 12 - debuff rate - params - 0 = mhp
  236.     # code 22 - xparam
  237.     # code 23 - sparams
  238.     # element defense
  239.     @actor = $game_party.members[1]
  240.     return if @actor.nil?
  241.     data1 = []
  242.     fet = @actor.feature_objects.size
  243.     for g in 0..fet - 1 do
  244.       one = @actor.feature_objects[g].features
  245.       for e in 0..one.size - 1
  246.         if one[e].code == 11
  247.           data1 << one[e].data_id
  248.         end
  249.       end
  250.     end
  251.     data1.compact!
  252.     data1.uniq!
  253.     data1.each do |el|
  254.       num = el
  255.       y = 24
  256.       y = 52 if num > 5
  257.       num -= 5 if num > 5
  258.       draw_icon(R2_Element_Icons::Elements[el],  num * 24 + num * 8 - 28, y)
  259.     end
  260.     # status defense
  261.     data2 = []
  262.     fet2 = @actor.feature_objects.size
  263.     for i in 0..fet2 - 1 do
  264.       two = @actor.feature_objects[i].features
  265.       for h in 0..two.size - 1
  266.         if two[h].code == 14
  267.           state = $data_states[two[h].data_id]
  268.           data2 << state
  269.         end
  270.       end
  271.     end
  272.     data2.compact!
  273.     data2.uniq!
  274.     data2.each do |st|
  275.       num = st.id
  276.       y = 86
  277.       y = 120 if num > 5
  278.       num -= 5 if num > 5
  279.       draw_icon(st.icon_index, num * 24 + num * 8 - 28, y)
  280.     end
  281.   end
  282. end
  283.  
  284. #==============================================================================
  285. # ** Window_Image_Defense
  286. #==============================================================================
  287. class Window_Image_Defense < Window_Base
  288.   #--------------------------------------------------------------------------
  289.   # * Object Initialization
  290.   #--------------------------------------------------------------------------
  291.   def initialize
  292.     super(Graphics.width / 2 - 100, Graphics.height / 2 - 20, 200, Graphics.height / 3)
  293.     self.back_opacity = 255
  294.     refresh
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # * Refresh
  298.   #--------------------------------------------------------------------------
  299.   def refresh
  300.     contents.clear
  301.     draw_image_defense
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # * Dispose
  305.   #--------------------------------------------------------------------------
  306.   def dispose
  307.     return if @defense_image.nil?
  308.     @defense_image.bitmap.dispose
  309.     @defense_image.dispose
  310.     super
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # * Draw Image for Scene
  314.   #--------------------------------------------------------------------------
  315.   def draw_image_defense
  316.     @defense_image = Sprite.new
  317.     @defense_image.bitmap = Cache.system("Element_Defense")
  318.     @defense_image.x = 200
  319.     @defense_image.y = 245
  320.     @defense_image.z = 200
  321.   end
  322. end
  323.  
  324. #==============================================================================
  325. # ** Window_Actor1_Status
  326. #==============================================================================
  327. class Window_Actor1_Status < Window_Base
  328.   #--------------------------------------------------------------------------
  329.   # * Object Initialization
  330.   #--------------------------------------------------------------------------
  331.   def initialize
  332.     super(0, 80, Graphics.width / 2, Graphics.height / 3 + 10)
  333.     @actor = $game_party.members[0]
  334.     self.back_opacity = 255
  335.     refresh
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # * Refresh
  339.   #--------------------------------------------------------------------------
  340.   def refresh
  341.     contents.clear
  342.     change_color(normal_color)
  343.     draw_text(20, 0, 200, line_height, "  ATTACK...........")
  344.     draw_text(200, 0, 44, line_height, @actor.atk, 2)
  345.     draw_text(20, line_height, 200, line_height, "  DEFENSE.......")
  346.     draw_text(200, line_height, 44, line_height, @actor.def, 2)
  347.     draw_text(20, line_height * 2, 200, line_height, "  SPEED..............")
  348.     draw_text(200, line_height * 2, 44, line_height, @actor.agi, 2)
  349.     draw_text(20, line_height * 3, 200, line_height, "  MAGIC..............")
  350.     draw_text(200, line_height * 3, 44, line_height, @actor.mat, 2)
  351.     draw_text(20, line_height * 4, 200, line_height, "  ACCURACY...")
  352.     draw_text(200, line_height * 4, 44, line_height, (@actor.hit * 100).to_i, 2)
  353.     draw_text(20, line_height * 5, 200, line_height, "  EVADE..............")
  354.     draw_text(200, line_height * 5, 44, line_height, (@actor.eva * 100).to_i, 2)
  355.   end
  356. end
  357.  
  358. #==============================================================================
  359. # ** Window_Actor2_Status
  360. #==============================================================================
  361. class Window_Actor2_Status < Window_Base
  362.   #--------------------------------------------------------------------------
  363.   # * Object Initialization
  364.   #--------------------------------------------------------------------------
  365.   def initialize
  366.     super(Graphics.width / 2, 80, Graphics.width / 2, Graphics.height / 3 + 10)
  367.     self.back_opacity = 255
  368.     refresh
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # * Refresh
  372.   #--------------------------------------------------------------------------
  373.   def refresh
  374.     contents.clear
  375.     return if !$game_party.members[1]
  376.     @actor = $game_party.members[1]
  377.     change_color(normal_color)
  378.     draw_text(20, 0, 200, line_height, "  ATTACK...........")
  379.     draw_text(200, 0, 44, line_height, @actor.atk, 2)
  380.     draw_text(20, line_height, 200, line_height, "  DEFENSE.......")
  381.     draw_text(200, line_height, 44, line_height, @actor.def, 2)
  382.     draw_text(20, line_height * 2, 200, line_height, "  SPEED..............")
  383.     draw_text(200, line_height * 2, 44, line_height, @actor.agi, 2)
  384.     draw_text(20, line_height * 3, 200, line_height, "  MAGIC..............")
  385.     draw_text(200, line_height * 3, 44, line_height, @actor.mat, 2)
  386.     draw_text(20, line_height * 4, 200, line_height, "  ACCURACY...")
  387.     draw_text(200, line_height * 4, 44, line_height, (@actor.hit * 100).to_i, 2)
  388.     draw_text(20, line_height * 5, 200, line_height, "  EVADE..............")
  389.     draw_text(200, line_height * 5, 44, line_height, (@actor.eva * 100).to_i, 2)
  390.   end
  391. end
  392.  
  393. #==============================================================================
  394. # ** Scene_Status
  395. #==============================================================================
  396. class Scene_Status < Scene_MenuBase
  397.   #--------------------------------------------------------------------------
  398.   # * Start Processing
  399.   #--------------------------------------------------------------------------
  400.   def start
  401.     super
  402.     create_windows
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # * Make the windows
  406.   #--------------------------------------------------------------------------
  407.   def create_windows
  408.     create_actor_exp_window
  409.     create_actor1_defense_window
  410.     create_actor2_defense_window
  411.     create_image_window
  412.     create_command_window
  413.     create_actor1_status
  414.     create_actor2_status
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # * Actor 1 Exp Window
  418.   #--------------------------------------------------------------------------
  419.   def create_actor_exp_window
  420.     @actor1_exp = Window_Actor1_Exp.new
  421.   end
  422.   #--------------------------------------------------------------------------
  423.   # * Defense Window Actor 1
  424.   #--------------------------------------------------------------------------
  425.   def create_actor1_defense_window
  426.     @actor1_exp_window = Window_Actor1_Element_Status.new
  427.   end
  428.   #--------------------------------------------------------------------------
  429.   # * Defense Window Actor 2
  430.   #--------------------------------------------------------------------------
  431.   def create_actor2_defense_window
  432.     @actor2_exp_window = Window_Actor2_Element_Status.new
  433.   end
  434.   #--------------------------------------------------------------------------
  435.   # * Actor 1 Exp Window
  436.   #--------------------------------------------------------------------------
  437.   def create_image_window
  438.     @image_window = Window_Image_Defense.new
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # * Create Command Window
  442.   #--------------------------------------------------------------------------
  443.   def create_command_window
  444.     @command_window = Window_Status_Command.new(Graphics.width / 2, 0)
  445.     @command_window.set_handler(:cancel,   method(:return_scene))
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # * Status Window Actor 1
  449.   #--------------------------------------------------------------------------
  450.   def create_actor1_status
  451.     @actor1_status_window = Window_Actor1_Status.new
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # * Status Window Actor 2
  455.   #--------------------------------------------------------------------------
  456.   def create_actor2_status
  457.     @actor2_status_window = Window_Actor2_Status.new
  458.   end
  459. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement