Fhizban

VX Ace Simple Party HUD 1.2

Aug 16th, 2015
878
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #===============================================================================
  2. #                          +++ FHIZBAN'S PARTY HUD +++
  3. # - by Fhizban (also Malagar)
  4. # - Version 1.2 - August 2015
  5. # - for RPGMaker VX Ace
  6. # - free for Non-Commercial and Commercial use
  7. #
  8. # A simple plug-and-play script that displays your parties most essential stats
  9. # in a nice and clean HUD window on the map screen.
  10. #
  11. #===============================================================================
  12.  
  13. class Window_Fhiz_Hud < Window_Base
  14.   #=============================================================================
  15.   # CONFIGURATION - OPTIONS
  16.   #=============================================================================
  17.   HIDE_SWITCH   = 3     # Switch to show/hide the HUD (during text or cut-scenes)
  18.   WIN_OPACITY   = 128   # Inner Window Opacity (255=full... 128=half... 0=invisible)
  19.   FRAME_OPACITY = 0   # Window Frame Opacity (255=full... 128=half... 0=invisible)
  20.   FONT_SIZE     = Font.default_size    # Numeric font size or use Font.default_size
  21.   DRAW_HP       = true  # Draw the HP bar and text?
  22.   DRAW_MP       = true  # Draw the MP bar and text?
  23.   DRAW_STATES   = true  # Draw the state icons?
  24.   DRAW_NAME     = true  # Draw the Actors name?
  25.   DRAW_FACE     = true  # Draw the Actors face?
  26.   PADDING       = 10    # Padding between Actors
  27.   # The constants below usually require no changes
  28.   WIN_HEIGHT    = 120   # Total height of the HUD window
  29.   WIN_WIDTH     = 96    # Width of one character subsection
  30.   OFFSET_X      = 5
  31.   OFFSET_Y      = 0
  32.   #=============================================================================
  33.   # CONFIGURATION - END
  34.   #=============================================================================
  35.  
  36.   #=============================================================================
  37.   # INITALIZE
  38.   #=============================================================================
  39.   def initialize
  40.       super(0,Graphics.height-WIN_HEIGHT,Graphics.width,WIN_HEIGHT)
  41.       @x, @y, @i = 10, 50, 0
  42.       @party_size = $game_party.all_members.size
  43.     contents.font.size = FONT_SIZE
  44.       self.back_opacity = WIN_OPACITY
  45.     self.opacity = FRAME_OPACITY
  46.     @actor_hp = []
  47.     @actor_mp = []
  48.       fhiz_hud
  49.       check_visible
  50.   end
  51.   #=============================================================================
  52.   #
  53.   #=============================================================================
  54.   def fhiz_hud
  55.     i = 0
  56.     while i < @party_size
  57.       @actor = $game_party.members[i]
  58.       @actor_hp[i] = @actor.hp
  59.       @actor_mp[i] = @actor.mp
  60.       i += 1
  61.     end
  62.     i = 0
  63.     while i < @party_size
  64.       @actor = $game_party.members[i]
  65.       @x = OFFSET_X + (WIN_WIDTH + OFFSET_X)*i + (PADDING*i)
  66.       @y = OFFSET_Y
  67.       if DRAW_FACE
  68.         if @actor_hp[i] > 0
  69.           draw_actor_face(@actor, @x, @y, true)
  70.         else
  71.           draw_actor_face(@actor, @x, @y, true)
  72.         end
  73.       end
  74.       if DRAW_NAME
  75.           draw_actor_name(@actor, @x, @y)
  76.       end
  77.       if DRAW_STATES
  78.         draw_actor_icons(@actor, @x, @y+(WIN_HEIGHT-line_height*4), WIN_WIDTH)
  79.       end
  80.       if DRAW_HP
  81.         draw_actor_hp(@actor, @x, @y+(WIN_HEIGHT-line_height*3), WIN_WIDTH)
  82.       end
  83.       if DRAW_MP
  84.         draw_actor_mp(@actor, @x, @y+(WIN_HEIGHT-line_height*2), WIN_WIDTH)
  85.       end
  86.       i += 1
  87.     end
  88.   end
  89.  
  90.   #=============================================================================
  91.   def check_visible
  92.     if self.visible != $game_switches[HIDE_SWITCH]
  93.       self.visible = $game_switches[HIDE_SWITCH]
  94.     end
  95.   end
  96.  
  97.   #=============================================================================
  98.   def refresh
  99.     contents.clear
  100.     fhiz_hud
  101.     @party_size = $game_party.all_members.size
  102.   end
  103.  
  104.   #=============================================================================
  105.   # Check if gauges require to be redrawn
  106.   #=============================================================================
  107.   def update
  108.     super
  109.     check_visible
  110.     if @party_size != $game_party.all_members.size
  111.       refresh
  112.     end
  113.     i = 0
  114.     while i < @party_size
  115.       if $game_party.members[i].hp != @actor_hp[i] or $game_party.members[i].mp != @actor_mp[i]
  116.           refresh
  117.         end
  118.       i += 1
  119.     end
  120.   end
  121.  
  122. end  
  123.  
  124. #===============================================================================
  125. #Show the window on the map
  126. #===============================================================================
  127. class Scene_Map < Scene_Base
  128.   alias original_create_all_windows create_all_windows
  129.     def create_all_windows
  130.       original_create_all_windows
  131.       create_face_window
  132.     end
  133.     def create_face_window
  134.       @face_window = Window_Fhiz_Hud.new
  135.     end
  136. end
  137.  
  138. #===============================================================================
RAW Paste Data