Advertisement
Ventwig

VTS-Enemy HP Bars

Apr 9th, 2012
4,782
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 23.83 KB | None | 0 0
  1. #============================================================================
  2. #VTS Enemy HP Bars
  3. #By Ventwig
  4. #Version 1.7 - May 24 2013
  5. #For RPGMaker VX Ace
  6. #============================================================================
  7. # Here's another window-ish thing to show HP :)
  8. # Thanks Shaz for helping me out with this one :D
  9. # Thanks ItsKouta for showing me a horrible bug!
  10. # Thanks to #tag-this for helping with the hide numbers option!
  11. # Thanks Helladen for pointing out a small error!
  12. # Thanks Ulises for helping with the hurdle of not having RMVXA with me!
  13. # Thanks estriole, Tsukihime, and selchar for help with notetags!
  14. # Thanks Everyone for your suppourt & suggestions!
  15. #=============================================================================
  16. # Description:
  17. # This code shows the name, HP, and MP for up to 8 enemies at once.
  18. # Plug'N'Play and the HP bar updates after every hit/kill.
  19. # You can also set it so the numbers are hidden! Oooh!
  20. # Long boss bars, "hidden minions", and hover-over-battler bars are available
  21. # features! Yaaaaay!
  22. # Super cool: BARS CAN HOVER OVER THE ENEMY!
  23. # Options to scan enemies or show states will be added.
  24. #==============================================================================
  25. # Compatability:
  26. #  alias-es Game_Enemy and Scene_Battle
  27. #  Works with Neo Gauge Ultimate Ace (Recommended)
  28. #===============================================================================
  29. # Instructions: Put in materials, above main. Almost Plug and Play
  30. # Put above Neo Gauge Ultimate Ace if used
  31. #==============================================================================
  32. # Please give Credit to Ventwig if you would like to use one of my scripts
  33. # in a NON-COMMERCIAL project.
  34. # Please ask for permission if you would like to use it in a commercial game.
  35. # You may not re-distribute any of my scripts or claim as your own.
  36. # You may not release edits without permission, combatability patches are okay.
  37. #===============================================================================
  38. #Notetags
  39. #==============================================================================
  40. #<hide_hp>
  41. #<show_mp>/<hide_mp>
  42. #<boss_bar>
  43. #==============================================================================
  44. #Mix and match the three notetags! They're pretty much self-explanatory.
  45. #<hide_hp> stops hp from being shown
  46. #<show_mp> shows an mp bar, if REVERSE_MP below is set to false.
  47. #<hide_mp> hides the mp bar, if REVERSE_MP is true.
  48. #          If reverse_mp is false, enemies have hidden mp by default. If true,
  49. #          then they normally have mp shown. Please use the right one.
  50. #<boss_bar> sets the enemy to a boss, using the long bar (A BOSS MUST BE THE
  51. #           FIRST ENEMY IN THE TROOP OR ELSE EVERYTHING GOES WHACK)
  52. #==============================================================================
  53.  
  54. module EHUD
  55.   #====================================================================
  56.   #Breakthrough point! You can now choose to place the bar right where
  57.   #the enemy's battler is! But if you liked the old version, it's still
  58.   #there!
  59.   #TRUE means that the bar will hover over, like a cool new version.
  60.   #FALSE will keep all the normal info at the top.
  61.   #==============================================================
  62.   #TRUE still has the boss bar at the top, too!
  63.   #==============================================================
  64.   HOVER_BAR = true
  65.  
  66.   #Changes how far down the bars are in non-hover mode Recommended 20.
  67.   WINDOW_Y = 20
  68.  
  69.   #Want to show mp for most enemies but don't want to bother putting all the
  70.   #noteatags? Turn this to true and show_mp turns into hide_mp and will actually
  71.   #HIDE the mp with mp always showing by default
  72.   REVERSE_MP = false
  73.  
  74.   #Toggles whether or not a delay will be added after each attack so that the
  75.   #player can see the current hp/changes
  76.   DELAY = false
  77.   #Number, choose how long to wait between attacks (to let the player look
  78.   #at the HP bars. Recommended 4-6
  79.   #Only works if above is set to true
  80.   WINDOW_WAIT = 5
  81.  
  82.   #Decides whether or not to show the HP numbers/etc/etc.
  83.   #0 means normal (HP name, current and max hp)
  84.   #1 means just show HP amount, not the word, nor the max
  85.   #2 means just the bar <RECOMMENDED>
  86.   DRAW_HP_NUMBERS = 2
  87.  
  88.   #DRAW_LETTERS sets whether or not the script should draw the letters
  89.   #for the enemy in case there's multiple enemies, such as
  90.   #"Slime A" and "Slime B". This is recommended only for hover bars
  91.   #to make knowing who to target easy. It just looks clunky when the name is
  92.   #already shown.
  93.   DRAW_LETTERS = true
  94.  
  95.   #Selects whether or not you have Neo Gauge Ultimate Ace.
  96.   #If it is set to [[true]], this doesnt matter, if it's false,
  97.   #make sure you have it right!!!
  98.   NEO_ULTIMATE_ACE = true
  99.    
  100.   #These settings make it compatible with my "Nova Battle Display" system!
  101.   #Play around with the numbers, but I've provided recommended "Nova" settings
  102.   #Change the X value of the bar. Def: 0  Nova:150
  103.   BOSS_GAUGEX = 0
  104.   #How long the boss gauge should be.  Def: 475  Nova:325
  105.   BOSS_GAUGEW = 475
  106.  
  107.   #Determines whether or not the minions' HP will still be shown even
  108.   #in a boss battle!
  109.   #This is determined via a switch, so you can toggle per boss!
  110.   #ON=HIDE
  111.   #OFF=SHOW
  112.   #The thing about this switch, though, is that you have to toggle it MANUALLY
  113.   #everytime you want to change it. So before a boss fight, turn it on.
  114.   #After, turn it back off.
  115.   #THIS DOES NOT HAVE TO BE USED WITH JUST BOSSES
  116.   HIDE_MINIONS = 1
  117.  
  118. end
  119.  
  120. #module RPG
  121.   class RPG::BaseItem
  122.     def show_mp
  123.       if @show_mp.nil?
  124.         if EHUD::REVERSE_MP == false
  125.           if @note =~ /<show_mp>/i
  126.             @show_mp= true
  127.           end
  128.         else
  129.           if @note =~ /<hide_mp>/i
  130.             @show_mp= false
  131.           else
  132.             @show_mp = true
  133.           end
  134.         end
  135.       end
  136.       @show_mp
  137.     end
  138.     def hide_hp
  139.       if @hide_hp.nil?
  140.         if @note =~ /<hide_hp>/i
  141.           @hide_hp = true
  142.         else
  143.           @hide_hp = false
  144.         end
  145.       end
  146.       @hide_hp
  147.     end
  148.     def boss_bar
  149.       if @boss_bar.nil?
  150.         if @note =~ /<boss_bar>/i
  151.           @boss_bar= true
  152.         else
  153.           @boss_bar = false
  154.         end
  155.       end
  156.       @boss_bar
  157.     end
  158.   end  
  159. #end
  160.  
  161. class Game_Enemy < Game_Battler
  162.   #--------------------------------------------------------------------------
  163.   # * Method Aliases
  164.   #--------------------------------------------------------------------------
  165.   alias shaz_enemyhud_initialize initialize
  166.   #--------------------------------------------------------------------------
  167.   # * Public Instance Variables
  168.   #--------------------------------------------------------------------------
  169.   attr_accessor :old_hp                            # hp on last hud refresh
  170.   attr_accessor :old_mp                            # mp on last hud refresh
  171.   #--------------------------------------------------------------------------
  172.   # * Object Initialization
  173.   #--------------------------------------------------------------------------
  174.   def initialize(index, enemy_id)
  175.         shaz_enemyhud_initialize(index, enemy_id)
  176.         @old_hp = mhp
  177.         @old_mp = mmp
  178.   end
  179.   def boss_bar
  180.      return enemy.boss_bar
  181.   end
  182.   def show_mp
  183.      return enemy.show_mp
  184.   end
  185.   def hide_hp
  186.      return enemy.hide_hp
  187.   end
  188. end
  189.  
  190. class Window_Enemy_Hud < Window_Base
  191.  
  192.   ###################################################################
  193.   #Sets up what appears in the HUD
  194.   #Questions names and HUD, then displays them
  195.   #################################################################  
  196.   #Set up the window's start-up
  197.   def initialize
  198.     #Draws window
  199.     super(0,EHUD::WINDOW_Y,545,400) #h=130
  200.     self.opacity = 0
  201.     self.arrows_visible = false
  202.     self.z = 0
  203.     @x, @y = 5, 50    
  204.     troop_fix
  205.     if @enemy1.boss_bar == true
  206.       @boss_troop = true
  207.       @boss_enemy = @enemy1
  208.     else
  209.       @boss_troop = false
  210.       @boss_enemy = nil
  211.     end
  212.     enemy_hud
  213.     refresh
  214.   end
  215.  
  216.   if EHUD::NEO_ULTIMATE_ACE == false
  217.     def draw_actor_mp(actor, x, y, width = 124)
  218.       draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  219.       change_color(system_color)
  220.     end
  221.   else
  222.     def draw_actor_mp(actor, x, y, width = 124)
  223.       gwidth = width * actor.mp / [actor.mmp, 1].max
  224.       cg = neo_gauge_back_color
  225.       c1, c2, c3 = cg[0], cg[1], cg[2]
  226.       draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
  227.         HPMP_GAUGE_Y_PLUS, width, HPMP_GAUGE_HEIGHT, c1, c2, c3)
  228.       (1..3).each {|i| eval("c#{i} = MP_GCOLOR_#{i}")}
  229.       draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
  230.         HPMP_GAUGE_Y_PLUS, gwidth, HPMP_GAUGE_HEIGHT, c1, c2, c3, false, false,
  231.         width, 40)
  232.       change_color(system_color)
  233.     end
  234.   end
  235.      
  236.   if EHUD::DRAW_HP_NUMBERS == 0
  237.     if EHUD::NEO_ULTIMATE_ACE == false
  238.       def draw_actor_hp(actor, x, y, width = 124)
  239.        draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  240.        change_color(hp_color(actor))
  241.         draw_current_and_max_values(x, y, 124, actor.hp, actor.mhp,
  242.         hp_color(actor), normal_color)
  243.        change_color(system_color)
  244.         if EHUD::DRAW_LETTERS == true
  245.          draw_text(x,y,20,line_height,actor.letter)
  246.         end
  247.       end
  248.     else
  249.       def draw_actor_hp(actor, x, y, width = 124)
  250.       gwidth = width * actor.hp / actor.mhp
  251.       cg = neo_gauge_back_color
  252.       c1, c2, c3 = cg[0], cg[1], cg[2]
  253.       draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
  254.         HPMP_GAUGE_Y_PLUS, width, HPMP_GAUGE_HEIGHT, c1, c2, c3)
  255.       (1..3).each {|i| eval("c#{i} = HP_GCOLOR_#{i}")}
  256.       draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
  257.         HPMP_GAUGE_Y_PLUS, gwidth, HPMP_GAUGE_HEIGHT, c1, c2, c3, false, false,
  258.         width, 30)
  259.       change_color(system_color)
  260.       draw_current_and_max_values(x-25, y, 124, actor.hp, actor.mhp,
  261.       hp_color(actor), normal_color)
  262.       if EHUD::DRAW_LETTERS == true
  263.        draw_text(x,y,20,line_height,actor.letter)
  264.       end
  265.       end
  266.     end
  267.   end
  268.  
  269.   if EHUD::DRAW_HP_NUMBERS == 1
  270.     if EHUD::NEO_ULTIMATE_ACE == false
  271.       def draw_actor_hp(actor, x, y, width = 124)
  272.        draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  273.        change_color(hp_color(actor))
  274.        draw_text(x+40, y, 100, line_height, actor.hp)
  275.        change_color(system_color)
  276.         if EHUD::DRAW_LETTERS == true
  277.          draw_text(x,y,20,line_height,actor.letter)
  278.         end
  279.       end
  280.    else
  281.     def draw_actor_hp(actor, x, y, width = 124)
  282.        gwidth = width * actor.hp / actor.mhp
  283.     cg = neo_gauge_back_color
  284.     c1, c2, c3 = cg[0], cg[1], cg[2]
  285.     draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
  286.       HPMP_GAUGE_Y_PLUS, width, HPMP_GAUGE_HEIGHT, c1, c2, c3)
  287.     (1..3).each {|i| eval("c#{i} = HP_GCOLOR_#{i}")}
  288.     draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
  289.       HPMP_GAUGE_Y_PLUS, gwidth, HPMP_GAUGE_HEIGHT, c1, c2, c3, false, false,
  290.       width, 30)
  291.        change_color(hp_color(actor))
  292.        draw_text(x+40, y, 100, line_height, actor.hp)
  293.        change_color(system_color)
  294.       if EHUD::DRAW_LETTERS == true
  295.        draw_text(x,y,20,line_height,actor.letter)
  296.       end
  297.  
  298.     end
  299.    end
  300.   end
  301.  
  302.   if EHUD::DRAW_HP_NUMBERS == 2
  303.     if EHUD::NEO_ULTIMATE_ACE == false
  304.       def draw_actor_hp(actor, x, y, width = 124)
  305.        draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  306.         if EHUD::DRAW_LETTERS == true
  307.          draw_text(x,y,20,line_height,actor.letter)
  308.         end
  309.       end
  310.    else
  311.    def draw_actor_hp(actor, x, y, width = 124)
  312.      gwidth = width * actor.hp / actor.mhp
  313.      cg = neo_gauge_back_color
  314.      c1, c2, c3 = cg[0], cg[1], cg[2]
  315.     draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
  316.    HPMP_GAUGE_Y_PLUS, width, HPMP_GAUGE_HEIGHT, c1, c2, c3)
  317.    (1..3).each {|i| eval("c#{i} = HP_GCOLOR_#{i}")}
  318.    draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
  319.    HPMP_GAUGE_Y_PLUS, gwidth, HPMP_GAUGE_HEIGHT, c1, c2, c3, false, false,
  320.    width, 30)
  321.       if EHUD::DRAW_LETTERS == true
  322.        draw_text(x,y,20,line_height,actor.letter)
  323.       end
  324.    end
  325.    end
  326.  end
  327.  
  328.  
  329.   def troop_fix
  330.     if $game_troop.alive_members.size > 0
  331.       @enemy1 = $game_troop.alive_members[0]
  332.     end
  333.     if $game_troop.alive_members.size > 1
  334.       @enemy2 = $game_troop.alive_members[1]
  335.     end
  336.     if $game_troop.alive_members.size > 2
  337.       @enemy3 = $game_troop.alive_members[2]
  338.     end
  339.     if $game_troop.alive_members.size > 3
  340.       @enemy4 = $game_troop.alive_members[3]
  341.     end
  342.     if $game_troop.alive_members.size > 4
  343.       @enemy5 = $game_troop.alive_members[4]
  344.     end
  345.     if $game_troop.alive_members.size > 5
  346.       @enemy6 = $game_troop.alive_members[5]
  347.     end
  348.     if $game_troop.alive_members.size > 6
  349.       @enemy7 = $game_troop.alive_members[6]
  350.     end
  351.     if $game_troop.alive_members.size > 7
  352.       @enemy8 = $game_troop.alive_members[7]
  353.     end
  354.   end
  355.       #########################################################################
  356.       #########################################################################
  357.       #########################################################################
  358.     def enemy_hud
  359.       troop_fix    
  360.       if EHUD::HOVER_BAR == false
  361.         if $game_troop.alive_members.size > 0
  362.             if @boss_troop == true and @boss_enemy.enemy_id == @enemy1.enemy_id
  363.             draw_actor_name(@enemy1,EHUD::BOSS_GAUGEX,0)
  364.             draw_actor_hp(@enemy1,EHUD::BOSS_GAUGEX,20,width=EHUD::BOSS_GAUGEW)
  365.             draw_actor_icons(@enemy1, EHUD::BOSS_GAUGEX+200, 20, width = 96)
  366.             if @enemy1.show_mp[@enemy1.enemy_id]==true
  367.               draw_actor_mp(@enemy1,EHUD::BOSS_GAUGEX,30,width=EHUD::BOSS_GAUGEW)
  368.             end
  369.           else
  370.             if @enemy1.hide_hp == true
  371.               draw_actor_name(@enemy1,10,0)
  372.             else
  373.               draw_actor_name(@enemy1,10,0)
  374.               draw_actor_hp(@enemy1,10,20,width=96)
  375.               if @enemy1.show_mp == true
  376.                 draw_actor_mp(@enemy1,10,30,width=96)
  377.               end
  378.             end
  379.           end
  380.         end
  381.         if !$game_switches[EHUD::HIDE_MINIONS]
  382.           if $game_troop.alive_members.size > 1
  383.             if @boss_troop == true and @boss_enemy.enemy_id == @enemy1.enemy_id
  384.               draw_actor_name(@enemy2,10,50)
  385.               draw_actor_hp(@enemy2,10,70,width=96)
  386.               if @enemy2.show_mp == true
  387.                 draw_actor_mp(@enemy2,10,80,width=96)
  388.               end
  389.             else
  390.               if @enemy2.hide_hp == true
  391.                 draw_actor_name(@enemy2,10+125,0)
  392.               else
  393.                 draw_actor_name(@enemy2,10+125,0)
  394.                 draw_actor_hp(@enemy2,10+125,20,width=96)
  395.                 if @enemy2.show_mp == true
  396.                   draw_actor_mp(@enemy2,10+125,20,width=96)
  397.                 end
  398.               end
  399.             end
  400.           end
  401.           if $game_troop.alive_members.size > 2
  402.             if @boss_troop == true and @boss_enemy.enemy_id == @enemy1.enemy_id
  403.               draw_actor_name(@enemy3,10+125,50)
  404.               draw_actor_hp(@enemy3,10+125,70,width=96)
  405.               if @enemy3.show_mp == true
  406.                 draw_actor_mp(@enemy3,10+125,80,width=96)
  407.               end
  408.             else
  409.               if @enemy3.hide_hp == true
  410.                 draw_actor_name(@enemy3,10+250,0)
  411.               else
  412.                 draw_actor_name(@enemy3,10+250,0)
  413.                 draw_actor_hp(@enemy3,10+250,20,width=96)
  414.                 if @enemy3.show_mp == true
  415.                   draw_actor_mp(@enemy3,10+250,30,width=96)
  416.                 end
  417.               end
  418.             end
  419.           end
  420.           if $game_troop.alive_members.size > 3
  421.             if @boss_troop == true and @boss_enemy.enemy_id == @enemy1.enemy_id
  422.               draw_actor_name(@enemy4,10+250,50)
  423.               draw_actor_hp(@enemy4,10+250,70,width=96)
  424.               if @enemy4.show_mp == true
  425.                 draw_actor_mp(@enemy4,10+250,80,width=96)
  426.               end
  427.             else
  428.               if @enemy4.hide_hp == true
  429.                 draw_actor_name(@enemy4,10+375,0)
  430.               else
  431.                 draw_actor_name(@enemy4,10+375,0)
  432.                 draw_actor_hp(@enemy4,10+375,20,width=96)
  433.                 if @enemy4.show_mp == true
  434.                   draw_actor_mp(@enemy4,10+375,30,width=96)
  435.                 end
  436.               end
  437.             end
  438.           end
  439.           if $game_troop.alive_members.size > 4
  440.             if @boss_troop == true and @boss_enemy.enemy_id == @enemy1.enemy_id
  441.               draw_actor_name(@enemy5,10+375,50)
  442.               draw_actor_hp(@enemy5,10+375,70,width=96)
  443.               if @enemy5.show_mp == true
  444.                 draw_actor_mp(@enemy5,10+375,80,width=96)
  445.               end
  446.             else
  447.               if @enemy5.hide_hp == true
  448.                 draw_actor_name(@enemy5,10,50)
  449.               else
  450.                 draw_actor_name(@enemy5,10,50)
  451.                 draw_actor_hp(@enemy5,10,70,width=96)
  452.                 if @enemy5.show_mp == true
  453.                   draw_actor_mp(@enemy5,10,80,width=96)
  454.                 end
  455.               end
  456.             end
  457.           end
  458.           if $game_troop.alive_members.size > 5
  459.             if @boss_troop == false
  460.               if @enemy6.hide_hp == true
  461.                 draw_actor_name(@enemy6,10+125,50)
  462.               else
  463.                 draw_actor_name(@enemy6,10+125,50)
  464.                 draw_actor_hp(@enemy6,10+125,70,width=96)
  465.                 if @enemy6.show_mp == true
  466.                   draw_actor_mp(@enemy6,10+125,80,width=96)
  467.                 end
  468.               end
  469.             end
  470.           end
  471.           if $game_troop.alive_members.size > 6
  472.             if @boss_troop == false
  473.               if @enemy7.hide_hp == true
  474.                 draw_actor_name(@enemy7,10+250,50)
  475.               else
  476.                 draw_actor_name(@enemy7,10+250,50)
  477.                 draw_actor_hp(@enemy7,10+250,70,width=96)
  478.                 if @enemy7.show_mp == true
  479.                   draw_actor_mp(@enemy7,10+250,80,width=96)
  480.                 end
  481.               end
  482.             end
  483.           end
  484.           if $game_troop.alive_members.size > 7
  485.             if @boss_troop == false
  486.               if @enemy8.hide_hp == true
  487.                 draw_actor_name(@enemy8,10+375,50)
  488.               else
  489.                 draw_actor_name(@enemy8,10+375,50)
  490.                 draw_actor_hp(@enemy8,10+375,70,width=96)
  491.                 if @enemy8.show_mp == true
  492.                   draw_actor_mp(@enemy8,10+375,80,width=96)
  493.                 end
  494.               end
  495.             end
  496.           end
  497.         end
  498.     else
  499.       if $game_troop.alive_members.size > 0
  500.         if @boss_troop == true and @boss_enemy.enemy_id == @enemy1.enemy_id
  501.           draw_actor_name(@enemy1,EHUD::BOSS_GAUGEX,0)
  502.           draw_actor_hp(@enemy1,EHUD::BOSS_GAUGEX,20,width=EHUD::BOSS_GAUGEW)
  503.           draw_actor_icons(@enemy1,EHUD::BOSS_GAUGEX+200,0, width = 96)
  504.           if @enemy1.show_mp == true
  505.             draw_actor_mp(@enemy1,EHUD::BOSS_GAUGEX,30,width=EHUD::BOSS_GAUGEW)
  506.           end
  507.         elsif !$game_switches[EHUD::HIDE_MINIONS]
  508.           if @enemy1.hide_hp == true
  509.             #blank
  510.           else
  511.             draw_actor_hp(@enemy1,@enemy1.screen_x-50,@enemy1.screen_y-50,width=96)
  512.           if @enemy1.show_mp == true
  513.               draw_actor_mp(@enemy1,@enemy1.screen_x-50,@enemy1.screen_y-40,width=96)
  514.             end
  515.           end
  516.         end
  517.       end
  518.       if !$game_switches[EHUD::HIDE_MINIONS]
  519.         if $game_troop.alive_members.size > 1
  520.           if @enemy2.hide_hp == true
  521.               #blank
  522.           else
  523.             draw_actor_hp(@enemy2,@enemy2.screen_x-50,@enemy2.screen_y-50,width=96)
  524.           if @enemy2.show_mp == true
  525.               draw_actor_mp(@enemy2,@enemy2.screen_x-50,@enemy2.screen_y-40,width=96)
  526.             end
  527.           end
  528.         end
  529.         if $game_troop.alive_members.size > 2
  530.           if @enemy3.hide_hp == true
  531.             #blank
  532.           else
  533.             draw_actor_hp(@enemy3,@enemy3.screen_x-50,@enemy3.screen_y-50,width=96)
  534.           if @enemy3.show_mp == true
  535.               draw_actor_mp(@enemy3,@enemy3.screen_x-50,@enemy3.screen_y-40,width=96)
  536.             end
  537.           end
  538.         end
  539.         if $game_troop.alive_members.size > 3
  540.           if @enemy4.hide_hp == true
  541.             #blank
  542.           else
  543.             draw_actor_hp(@enemy4,@enemy4.screen_x-50,@enemy4.screen_y-50,width=96)
  544.           if @enemy4.show_mp == true
  545.               draw_actor_mp(@enemy4,@enemy4.screen_x-50,@enemy4.screen_y-40,width=96)
  546.             end
  547.           end
  548.         end
  549.         if $game_troop.alive_members.size > 4
  550.           if @enemy5.hide_hp == true
  551.             #blank
  552.           else
  553.             draw_actor_hp(@enemy5,@enemy5.screen_x-50,@enemy5.screen_y-50,width=96)
  554.           if @enemy5.show_mp == true
  555.               draw_actor_mp(@enemy5,@enemy5.screen_x-50,@enemy5.screen_y-40,width=96)
  556.             end
  557.           end
  558.         end
  559.         if $game_troop.alive_members.size > 5
  560.           if @enemy6.hide_hp == true
  561.             #blank
  562.           else
  563.             draw_actor_hp(@enemy6,10+125,70,width=96)
  564.           if @enemy6.show_mp == true
  565.               draw_actor_mp(@enemy6,10+125,80,width=96)
  566.             end
  567.           end
  568.         end
  569.         if $game_troop.alive_members.size > 6
  570.           if @enemy7.hide_hp == true
  571.             #blank
  572.           else
  573.             draw_actor_hp(@enemy7,10+250,70,width=96)
  574.           if @enemy7.show_mp == true
  575.               draw_actor_mp(@enemy7,10+250,80,width=96)
  576.             end
  577.           end
  578.         end
  579.         if $game_troop.alive_members.size > 7
  580.           if @enemy8.hide_hp == true
  581.             #blank
  582.           else
  583.             draw_actor_hp(@enemy8,10+375,70,width=96)
  584.           if @enemy8.show_mp == true
  585.               draw_actor_mp(@enemy8,10+375,80,width=96)
  586.             end
  587.           end
  588.         end
  589.       end
  590.     end
  591.   end
  592.    
  593.   def refresh
  594.     contents.clear
  595.     enemy_hud
  596.  #  @old_size = $game_troop.alive_members.size
  597.  #  if @old_size < 5 and @boss_troop == false
  598.  #     self.height = 80
  599.  #   end
  600.   end
  601.  
  602.   def update
  603.     # assume no refresh needed
  604.     refresh_okay = false
  605.  
  606.     # loop through remaining enemies one at a time - each enemy is put into the temporary variable called 'enemy'
  607.     $game_troop.alive_members.each do |enemy|
  608.       # have the hp or mp changed since last time?
  609.       if enemy.hp != enemy.old_hp || enemy.mp != enemy.old_mp
  610.         # we do need to update the hud
  611.         refresh_okay = true
  612.         # and replace the old values with the current values
  613.         enemy.old_hp = enemy.hp
  614.         enemy.old_mp = enemy.mp
  615.       end
  616.     end
  617.    
  618.     if $game_troop.alive_members.size != @old_size
  619.       refresh_okay = true
  620.     end
  621.     if @boss_enemy != nil
  622.       if @enemy1.enemy_id == @boss_enemy.enemy_id
  623.         @boss_troop = true
  624.       else
  625.         @boss_troop = false
  626.       end
  627.     end
  628.    
  629.     if refresh_okay
  630.           refresh
  631.     end
  632.   end
  633.  
  634. end
  635.  
  636. if EHUD::DELAY == true  
  637.   class Window_BattleLog
  638.     alias enemy_hud_battle_log_wait wait_and_clear
  639.     def wait_and_clear
  640.       wait while @num_wait < EHUD::WINDOW_WAIT if line_number > 0
  641.       clear
  642.     end
  643.   end
  644. end
  645.  
  646. #Show the window on the map
  647. class Scene_Battle < Scene_Base
  648.   alias original_create_all_windows create_all_windows
  649.     def create_all_windows
  650.       original_create_all_windows
  651.       create_enemy_hud_window
  652.     end
  653.     def create_enemy_hud_window
  654.       @enemy_hud_window = Window_Enemy_Hud.new
  655.     end
  656. end
  657.   #########################################################################
  658.   #End Of Script                                                          #
  659.   #########################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement