TheSixth

Custom Parameter Display

Apr 21st, 2018
1,488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.07 KB | None | 0 0
  1. =begin
  2.  
  3. - Status Display Change
  4. - Requires: Sixth's Custom Parameters script
  5. - Made by: Sixth
  6.  
  7. This script will change the parameter and equipment display in the status menu.
  8. It will let you display the parameters from my Custom Parameters script too.
  9.  
  10. This is made for the default status menu, so it will most probably not work
  11. with custom status menu scripts.
  12.  
  13. =end
  14. module CPrmDisp
  15.  
  16.   # Enter the parameters you want to show on the status screen into the :show
  17.   # setting array.
  18.   # You can display default parameters by entering their ID.
  19.   # To display your custom parameters made by my script, enter their setting
  20.   # key.
  21.   # Order them however you want, add as many as you want.
  22.   # Adjust the other visual settings as you see fit.
  23.   Stats = {
  24.     :show => [
  25.       2,3,4,5,6,7,
  26.       'str','dex','vit','res','spi','sta','blk','skl','pro','rge','cha','mor',
  27.     ],
  28.     :pos => [4,163], # Position of the first parameter drawn.
  29.     :size => [100,24], # Size reserved for 1 parameter.
  30.     :rows => 6, # Maximum rows shown.
  31.     :spacing => [8,2], # Horizontal and vertical spacing between each parameter.
  32.     :padding => [4,1], # Padding of the text in the display box.
  33.     :box => Color.new(100,100,100,128), # Display box color.
  34.   }
  35.  
  36.   # Setup how the equipment display will look like here.
  37.   Equips = {
  38.     :empty => ["Empty", 185], # The word and icon displayed for empty equip slots.
  39.     :pos => [330, 163], # Position of the first equipment drawn.
  40.     :size => [186,24], # Size reserved for 1 equipment.
  41.     :rows => 6, # Maximum rows shown.
  42.     :spacing => [8,2], # Horizontal and vertical spacing between each equipment.
  43.     :padding => [4,1], # Padding of the text in the display box.
  44.     :box => Color.new(100,100,100,128), # Display box color.
  45.   }
  46.  
  47. end
  48. # End of settings! No touchy-touchy below! o.o
  49.  
  50. class Window_Base < Window
  51.  
  52.   def draw_actor_cparam(actor, x, y, w, h, stat)
  53.     change_color(system_color)
  54.     draw_text(x, y, w, h, CustomParams::Params[stat][:short])
  55.     change_color(normal_color)
  56.     draw_text(x, y, w, h, actor.send(stat), 2)
  57.   end
  58.  
  59. end
  60.  
  61. class Window_Status < Window_Selectable
  62.    
  63.   def draw_block3(y)
  64.     dt = CPrmDisp::Stats; edt = CPrmDisp::Equips
  65.     draw_stats_ex(*dt[:pos],*dt[:size],dt[:rows],dt[:spacing],dt[:padding],dt[:box])
  66.     draw_equipments(*edt[:pos],*edt[:size],edt[:rows],edt[:spacing],edt[:padding],edt[:box])
  67.   end
  68.  
  69.   def draw_stats_ex(x,y,w,h,rows,sp,pad,color)
  70.     CPrmDisp::Stats[:show].each_with_index do |prm,i|
  71.       yy = i % rows * (h + sp[1]) + y
  72.       xx = (i / rows * (w + sp[0])) + x
  73.       contents.fill_rect(xx,yy,w,h,color)
  74.       if CustomParams::Params.include?(prm) # Custom parameter
  75.         draw_actor_cparam(@actor, xx+pad[0], yy+pad[1], w-pad[0]*2, h-pad[1]*2, prm)
  76.       else # Default parameter
  77.         draw_actor_param_ex(@actor, xx+pad[0], yy+pad[1], w-pad[0]*2, h-pad[1]*2, prm)
  78.       end
  79.     end
  80.   end
  81.  
  82.   def draw_equipments(x,y,w,h,rows,sp,pad,color)
  83.     @actor.equips.each_with_index do |item, i|
  84.       yy = i % rows * (h + sp[1]) + y
  85.       xx = (i / rows * (w + sp[0])) + x
  86.       contents.fill_rect(xx,yy,w,h,color)
  87.       if item.nil? # No equip on slot
  88.         draw_empty_slot(xx+pad[0], yy+pad[1], w-pad[0]*2, h-pad[1]*2)
  89.       else # Equipped item
  90.         draw_item_name(item, xx+pad[0], yy+pad[1], true, w-pad[0]*2, h-pad[1]*2)
  91.       end
  92.     end
  93.   end
  94.  
  95.   def draw_empty_slot(x, y, w, h)
  96.     draw_icon(CPrmDisp::Equips[:empty][1], x, y + (h-24)/2)
  97.     change_color(normal_color,false)
  98.     draw_text(x + 26, y, w, h, CPrmDisp::Equips[:empty][0])
  99.   end
  100.    
  101.   def draw_item_name(item, x, y, enabled = true, w = 172, h = 24)
  102.     return unless item
  103.     draw_icon(item.icon_index, x, y + (h-24)/2, enabled)
  104.     change_color(normal_color, enabled)
  105.     draw_text(x + 26, y, w, h, item.name)
  106.   end
  107.  
  108.   def draw_actor_param_ex(actor, x, y, w, h, param_id)
  109.     change_color(system_color)
  110.     draw_text(x, y, w, h, Vocab::param(param_id))
  111.     change_color(normal_color)
  112.     draw_text(x, y, w, h, actor.param(param_id), 2)
  113.   end
  114.  
  115. end
  116. # End of script! O_O
Add Comment
Please, Sign In to add comment