Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #============================================================================
- #VTS Enemy HP Bars
- #By Ventwig
- #Version 1.7 - May 24 2013
- #For RPGMaker VX Ace
- #============================================================================
- # Here's another window-ish thing to show HP :)
- # Thanks Shaz for helping me out with this one :D
- # Thanks ItsKouta for showing me a horrible bug!
- # Thanks to #tag-this for helping with the hide numbers option!
- # Thanks Helladen for pointing out a small error!
- # Thanks Ulises for helping with the hurdle of not having RMVXA with me!
- # Thanks estriole, Tsukihime, and selchar for help with notetags!
- # Thanks Everyone for your suppourt & suggestions!
- #=============================================================================
- # Description:
- # This code shows the name, HP, and MP for up to 8 enemies at once.
- # Plug'N'Play and the HP bar updates after every hit/kill.
- # You can also set it so the numbers are hidden! Oooh!
- # Long boss bars, "hidden minions", and hover-over-battler bars are available
- # features! Yaaaaay!
- # Super cool: BARS CAN HOVER OVER THE ENEMY!
- # Options to scan enemies or show states will be added.
- #==============================================================================
- # Compatability:
- # alias-es Game_Enemy and Scene_Battle
- # Works with Neo Gauge Ultimate Ace (Recommended)
- #===============================================================================
- # Instructions: Put in materials, above main. Almost Plug and Play
- # Put above Neo Gauge Ultimate Ace if used
- #==============================================================================
- # Please give Credit to Ventwig if you would like to use one of my scripts
- # in a NON-COMMERCIAL project.
- # Please ask for permission if you would like to use it in a commercial game.
- # You may not re-distribute any of my scripts or claim as your own.
- # You may not release edits without permission, combatability patches are okay.
- #===============================================================================
- #Notetags
- #==============================================================================
- #<hide_hp>
- #<show_mp>/<hide_mp>
- #<boss_bar>
- #==============================================================================
- #Mix and match the three notetags! They're pretty much self-explanatory.
- #<hide_hp> stops hp from being shown
- #<show_mp> shows an mp bar, if REVERSE_MP below is set to false.
- #<hide_mp> hides the mp bar, if REVERSE_MP is true.
- # If reverse_mp is false, enemies have hidden mp by default. If true,
- # then they normally have mp shown. Please use the right one.
- #<boss_bar> sets the enemy to a boss, using the long bar (A BOSS MUST BE THE
- # FIRST ENEMY IN THE TROOP OR ELSE EVERYTHING GOES WHACK)
- #==============================================================================
- module EHUD
- #====================================================================
- #Breakthrough point! You can now choose to place the bar right where
- #the enemy's battler is! But if you liked the old version, it's still
- #there!
- #TRUE means that the bar will hover over, like a cool new version.
- #FALSE will keep all the normal info at the top.
- #==============================================================
- #TRUE still has the boss bar at the top, too!
- #==============================================================
- HOVER_BAR = true
- #Changes how far down the bars are in non-hover mode Recommended 20.
- WINDOW_Y = 20
- #Want to show mp for most enemies but don't want to bother putting all the
- #noteatags? Turn this to true and show_mp turns into hide_mp and will actually
- #HIDE the mp with mp always showing by default
- REVERSE_MP = false
- #Toggles whether or not a delay will be added after each attack so that the
- #player can see the current hp/changes
- DELAY = false
- #Number, choose how long to wait between attacks (to let the player look
- #at the HP bars. Recommended 4-6
- #Only works if above is set to true
- WINDOW_WAIT = 5
- #Decides whether or not to show the HP numbers/etc/etc.
- #0 means normal (HP name, current and max hp)
- #1 means just show HP amount, not the word, nor the max
- #2 means just the bar <RECOMMENDED>
- DRAW_HP_NUMBERS = 2
- #DRAW_LETTERS sets whether or not the script should draw the letters
- #for the enemy in case there's multiple enemies, such as
- #"Slime A" and "Slime B". This is recommended only for hover bars
- #to make knowing who to target easy. It just looks clunky when the name is
- #already shown.
- DRAW_LETTERS = true
- #Selects whether or not you have Neo Gauge Ultimate Ace.
- #If it is set to [[true]], this doesnt matter, if it's false,
- #make sure you have it right!!!
- NEO_ULTIMATE_ACE = true
- #These settings make it compatible with my "Nova Battle Display" system!
- #Play around with the numbers, but I've provided recommended "Nova" settings
- #Change the X value of the bar. Def: 0 Nova:150
- BOSS_GAUGEX = 0
- #How long the boss gauge should be. Def: 475 Nova:325
- BOSS_GAUGEW = 475
- #Determines whether or not the minions' HP will still be shown even
- #in a boss battle!
- #This is determined via a switch, so you can toggle per boss!
- #ON=HIDE
- #OFF=SHOW
- #The thing about this switch, though, is that you have to toggle it MANUALLY
- #everytime you want to change it. So before a boss fight, turn it on.
- #After, turn it back off.
- #THIS DOES NOT HAVE TO BE USED WITH JUST BOSSES
- HIDE_MINIONS = 1
- end
- #module RPG
- class RPG::BaseItem
- def show_mp
- if @show_mp.nil?
- if EHUD::REVERSE_MP == false
- if @note =~ /<show_mp>/i
- @show_mp= true
- end
- else
- if @note =~ /<hide_mp>/i
- @show_mp= false
- else
- @show_mp = true
- end
- end
- end
- @show_mp
- end
- def hide_hp
- if @hide_hp.nil?
- if @note =~ /<hide_hp>/i
- @hide_hp = true
- else
- @hide_hp = false
- end
- end
- @hide_hp
- end
- def boss_bar
- if @boss_bar.nil?
- if @note =~ /<boss_bar>/i
- @boss_bar= true
- else
- @boss_bar = false
- end
- end
- @boss_bar
- end
- end
- #end
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * Method Aliases
- #--------------------------------------------------------------------------
- alias shaz_enemyhud_initialize initialize
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :old_hp # hp on last hud refresh
- attr_accessor :old_mp # mp on last hud refresh
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(index, enemy_id)
- shaz_enemyhud_initialize(index, enemy_id)
- @old_hp = mhp
- @old_mp = mmp
- end
- def boss_bar
- return enemy.boss_bar
- end
- def show_mp
- return enemy.show_mp
- end
- def hide_hp
- return enemy.hide_hp
- end
- end
- class Window_Enemy_Hud < Window_Base
- ###################################################################
- #Sets up what appears in the HUD
- #Questions names and HUD, then displays them
- #################################################################
- #Set up the window's start-up
- def initialize
- #Draws window
- super(0,EHUD::WINDOW_Y,545,400) #h=130
- self.opacity = 0
- self.arrows_visible = false
- self.z = 0
- @x, @y = 5, 50
- troop_fix
- if @enemy1.boss_bar == true
- @boss_troop = true
- @boss_enemy = @enemy1
- else
- @boss_troop = false
- @boss_enemy = nil
- end
- enemy_hud
- refresh
- end
- if EHUD::NEO_ULTIMATE_ACE == false
- def draw_actor_mp(actor, x, y, width = 124)
- draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
- change_color(system_color)
- end
- else
- def draw_actor_mp(actor, x, y, width = 124)
- gwidth = width * actor.mp / [actor.mmp, 1].max
- cg = neo_gauge_back_color
- c1, c2, c3 = cg[0], cg[1], cg[2]
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
- HPMP_GAUGE_Y_PLUS, width, HPMP_GAUGE_HEIGHT, c1, c2, c3)
- (1..3).each {|i| eval("c#{i} = MP_GCOLOR_#{i}")}
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
- HPMP_GAUGE_Y_PLUS, gwidth, HPMP_GAUGE_HEIGHT, c1, c2, c3, false, false,
- width, 40)
- change_color(system_color)
- end
- end
- if EHUD::DRAW_HP_NUMBERS == 0
- if EHUD::NEO_ULTIMATE_ACE == false
- def draw_actor_hp(actor, x, y, width = 124)
- draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
- change_color(hp_color(actor))
- draw_current_and_max_values(x, y, 124, actor.hp, actor.mhp,
- hp_color(actor), normal_color)
- change_color(system_color)
- if EHUD::DRAW_LETTERS == true
- draw_text(x,y,20,line_height,actor.letter)
- end
- end
- else
- def draw_actor_hp(actor, x, y, width = 124)
- gwidth = width * actor.hp / actor.mhp
- cg = neo_gauge_back_color
- c1, c2, c3 = cg[0], cg[1], cg[2]
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
- HPMP_GAUGE_Y_PLUS, width, HPMP_GAUGE_HEIGHT, c1, c2, c3)
- (1..3).each {|i| eval("c#{i} = HP_GCOLOR_#{i}")}
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
- HPMP_GAUGE_Y_PLUS, gwidth, HPMP_GAUGE_HEIGHT, c1, c2, c3, false, false,
- width, 30)
- change_color(system_color)
- draw_current_and_max_values(x-25, y, 124, actor.hp, actor.mhp,
- hp_color(actor), normal_color)
- if EHUD::DRAW_LETTERS == true
- draw_text(x,y,20,line_height,actor.letter)
- end
- end
- end
- end
- if EHUD::DRAW_HP_NUMBERS == 1
- if EHUD::NEO_ULTIMATE_ACE == false
- def draw_actor_hp(actor, x, y, width = 124)
- draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
- change_color(hp_color(actor))
- draw_text(x+40, y, 100, line_height, actor.hp)
- change_color(system_color)
- if EHUD::DRAW_LETTERS == true
- draw_text(x,y,20,line_height,actor.letter)
- end
- end
- else
- def draw_actor_hp(actor, x, y, width = 124)
- gwidth = width * actor.hp / actor.mhp
- cg = neo_gauge_back_color
- c1, c2, c3 = cg[0], cg[1], cg[2]
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
- HPMP_GAUGE_Y_PLUS, width, HPMP_GAUGE_HEIGHT, c1, c2, c3)
- (1..3).each {|i| eval("c#{i} = HP_GCOLOR_#{i}")}
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
- HPMP_GAUGE_Y_PLUS, gwidth, HPMP_GAUGE_HEIGHT, c1, c2, c3, false, false,
- width, 30)
- change_color(hp_color(actor))
- draw_text(x+40, y, 100, line_height, actor.hp)
- change_color(system_color)
- if EHUD::DRAW_LETTERS == true
- draw_text(x,y,20,line_height,actor.letter)
- end
- end
- end
- end
- if EHUD::DRAW_HP_NUMBERS == 2
- if EHUD::NEO_ULTIMATE_ACE == false
- def draw_actor_hp(actor, x, y, width = 124)
- draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
- if EHUD::DRAW_LETTERS == true
- draw_text(x,y,20,line_height,actor.letter)
- end
- end
- else
- def draw_actor_hp(actor, x, y, width = 124)
- gwidth = width * actor.hp / actor.mhp
- cg = neo_gauge_back_color
- c1, c2, c3 = cg[0], cg[1], cg[2]
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
- HPMP_GAUGE_Y_PLUS, width, HPMP_GAUGE_HEIGHT, c1, c2, c3)
- (1..3).each {|i| eval("c#{i} = HP_GCOLOR_#{i}")}
- draw_neo_gauge(x + HPMP_GAUGE_X_PLUS, y + line_height - 8 +
- HPMP_GAUGE_Y_PLUS, gwidth, HPMP_GAUGE_HEIGHT, c1, c2, c3, false, false,
- width, 30)
- if EHUD::DRAW_LETTERS == true
- draw_text(x,y,20,line_height,actor.letter)
- end
- end
- end
- end
- def troop_fix
- if $game_troop.alive_members.size > 0
- @enemy1 = $game_troop.alive_members[0]
- end
- if $game_troop.alive_members.size > 1
- @enemy2 = $game_troop.alive_members[1]
- end
- if $game_troop.alive_members.size > 2
- @enemy3 = $game_troop.alive_members[2]
- end
- if $game_troop.alive_members.size > 3
- @enemy4 = $game_troop.alive_members[3]
- end
- if $game_troop.alive_members.size > 4
- @enemy5 = $game_troop.alive_members[4]
- end
- if $game_troop.alive_members.size > 5
- @enemy6 = $game_troop.alive_members[5]
- end
- if $game_troop.alive_members.size > 6
- @enemy7 = $game_troop.alive_members[6]
- end
- if $game_troop.alive_members.size > 7
- @enemy8 = $game_troop.alive_members[7]
- end
- end
- #########################################################################
- #########################################################################
- #########################################################################
- def enemy_hud
- troop_fix
- if EHUD::HOVER_BAR == false
- if $game_troop.alive_members.size > 0
- if @boss_troop == true and @boss_enemy.enemy_id == @enemy1.enemy_id
- draw_actor_name(@enemy1,EHUD::BOSS_GAUGEX,0)
- draw_actor_hp(@enemy1,EHUD::BOSS_GAUGEX,20,width=EHUD::BOSS_GAUGEW)
- draw_actor_icons(@enemy1, EHUD::BOSS_GAUGEX+200, 20, width = 96)
- if @enemy1.show_mp[@enemy1.enemy_id]==true
- draw_actor_mp(@enemy1,EHUD::BOSS_GAUGEX,30,width=EHUD::BOSS_GAUGEW)
- end
- else
- if @enemy1.hide_hp == true
- draw_actor_name(@enemy1,10,0)
- else
- draw_actor_name(@enemy1,10,0)
- draw_actor_hp(@enemy1,10,20,width=96)
- if @enemy1.show_mp == true
- draw_actor_mp(@enemy1,10,30,width=96)
- end
- end
- end
- end
- if !$game_switches[EHUD::HIDE_MINIONS]
- if $game_troop.alive_members.size > 1
- if @boss_troop == true and @boss_enemy.enemy_id == @enemy1.enemy_id
- draw_actor_name(@enemy2,10,50)
- draw_actor_hp(@enemy2,10,70,width=96)
- if @enemy2.show_mp == true
- draw_actor_mp(@enemy2,10,80,width=96)
- end
- else
- if @enemy2.hide_hp == true
- draw_actor_name(@enemy2,10+125,0)
- else
- draw_actor_name(@enemy2,10+125,0)
- draw_actor_hp(@enemy2,10+125,20,width=96)
- if @enemy2.show_mp == true
- draw_actor_mp(@enemy2,10+125,20,width=96)
- end
- end
- end
- end
- if $game_troop.alive_members.size > 2
- if @boss_troop == true and @boss_enemy.enemy_id == @enemy1.enemy_id
- draw_actor_name(@enemy3,10+125,50)
- draw_actor_hp(@enemy3,10+125,70,width=96)
- if @enemy3.show_mp == true
- draw_actor_mp(@enemy3,10+125,80,width=96)
- end
- else
- if @enemy3.hide_hp == true
- draw_actor_name(@enemy3,10+250,0)
- else
- draw_actor_name(@enemy3,10+250,0)
- draw_actor_hp(@enemy3,10+250,20,width=96)
- if @enemy3.show_mp == true
- draw_actor_mp(@enemy3,10+250,30,width=96)
- end
- end
- end
- end
- if $game_troop.alive_members.size > 3
- if @boss_troop == true and @boss_enemy.enemy_id == @enemy1.enemy_id
- draw_actor_name(@enemy4,10+250,50)
- draw_actor_hp(@enemy4,10+250,70,width=96)
- if @enemy4.show_mp == true
- draw_actor_mp(@enemy4,10+250,80,width=96)
- end
- else
- if @enemy4.hide_hp == true
- draw_actor_name(@enemy4,10+375,0)
- else
- draw_actor_name(@enemy4,10+375,0)
- draw_actor_hp(@enemy4,10+375,20,width=96)
- if @enemy4.show_mp == true
- draw_actor_mp(@enemy4,10+375,30,width=96)
- end
- end
- end
- end
- if $game_troop.alive_members.size > 4
- if @boss_troop == true and @boss_enemy.enemy_id == @enemy1.enemy_id
- draw_actor_name(@enemy5,10+375,50)
- draw_actor_hp(@enemy5,10+375,70,width=96)
- if @enemy5.show_mp == true
- draw_actor_mp(@enemy5,10+375,80,width=96)
- end
- else
- if @enemy5.hide_hp == true
- draw_actor_name(@enemy5,10,50)
- else
- draw_actor_name(@enemy5,10,50)
- draw_actor_hp(@enemy5,10,70,width=96)
- if @enemy5.show_mp == true
- draw_actor_mp(@enemy5,10,80,width=96)
- end
- end
- end
- end
- if $game_troop.alive_members.size > 5
- if @boss_troop == false
- if @enemy6.hide_hp == true
- draw_actor_name(@enemy6,10+125,50)
- else
- draw_actor_name(@enemy6,10+125,50)
- draw_actor_hp(@enemy6,10+125,70,width=96)
- if @enemy6.show_mp == true
- draw_actor_mp(@enemy6,10+125,80,width=96)
- end
- end
- end
- end
- if $game_troop.alive_members.size > 6
- if @boss_troop == false
- if @enemy7.hide_hp == true
- draw_actor_name(@enemy7,10+250,50)
- else
- draw_actor_name(@enemy7,10+250,50)
- draw_actor_hp(@enemy7,10+250,70,width=96)
- if @enemy7.show_mp == true
- draw_actor_mp(@enemy7,10+250,80,width=96)
- end
- end
- end
- end
- if $game_troop.alive_members.size > 7
- if @boss_troop == false
- if @enemy8.hide_hp == true
- draw_actor_name(@enemy8,10+375,50)
- else
- draw_actor_name(@enemy8,10+375,50)
- draw_actor_hp(@enemy8,10+375,70,width=96)
- if @enemy8.show_mp == true
- draw_actor_mp(@enemy8,10+375,80,width=96)
- end
- end
- end
- end
- end
- else
- if $game_troop.alive_members.size > 0
- if @boss_troop == true and @boss_enemy.enemy_id == @enemy1.enemy_id
- draw_actor_name(@enemy1,EHUD::BOSS_GAUGEX,0)
- draw_actor_hp(@enemy1,EHUD::BOSS_GAUGEX,20,width=EHUD::BOSS_GAUGEW)
- draw_actor_icons(@enemy1,EHUD::BOSS_GAUGEX+200,0, width = 96)
- if @enemy1.show_mp == true
- draw_actor_mp(@enemy1,EHUD::BOSS_GAUGEX,30,width=EHUD::BOSS_GAUGEW)
- end
- elsif !$game_switches[EHUD::HIDE_MINIONS]
- if @enemy1.hide_hp == true
- #blank
- else
- draw_actor_hp(@enemy1,@enemy1.screen_x-50,@enemy1.screen_y-50,width=96)
- if @enemy1.show_mp == true
- draw_actor_mp(@enemy1,@enemy1.screen_x-50,@enemy1.screen_y-40,width=96)
- end
- end
- end
- end
- if !$game_switches[EHUD::HIDE_MINIONS]
- if $game_troop.alive_members.size > 1
- if @enemy2.hide_hp == true
- #blank
- else
- draw_actor_hp(@enemy2,@enemy2.screen_x-50,@enemy2.screen_y-50,width=96)
- if @enemy2.show_mp == true
- draw_actor_mp(@enemy2,@enemy2.screen_x-50,@enemy2.screen_y-40,width=96)
- end
- end
- end
- if $game_troop.alive_members.size > 2
- if @enemy3.hide_hp == true
- #blank
- else
- draw_actor_hp(@enemy3,@enemy3.screen_x-50,@enemy3.screen_y-50,width=96)
- if @enemy3.show_mp == true
- draw_actor_mp(@enemy3,@enemy3.screen_x-50,@enemy3.screen_y-40,width=96)
- end
- end
- end
- if $game_troop.alive_members.size > 3
- if @enemy4.hide_hp == true
- #blank
- else
- draw_actor_hp(@enemy4,@enemy4.screen_x-50,@enemy4.screen_y-50,width=96)
- if @enemy4.show_mp == true
- draw_actor_mp(@enemy4,@enemy4.screen_x-50,@enemy4.screen_y-40,width=96)
- end
- end
- end
- if $game_troop.alive_members.size > 4
- if @enemy5.hide_hp == true
- #blank
- else
- draw_actor_hp(@enemy5,@enemy5.screen_x-50,@enemy5.screen_y-50,width=96)
- if @enemy5.show_mp == true
- draw_actor_mp(@enemy5,@enemy5.screen_x-50,@enemy5.screen_y-40,width=96)
- end
- end
- end
- if $game_troop.alive_members.size > 5
- if @enemy6.hide_hp == true
- #blank
- else
- draw_actor_hp(@enemy6,10+125,70,width=96)
- if @enemy6.show_mp == true
- draw_actor_mp(@enemy6,10+125,80,width=96)
- end
- end
- end
- if $game_troop.alive_members.size > 6
- if @enemy7.hide_hp == true
- #blank
- else
- draw_actor_hp(@enemy7,10+250,70,width=96)
- if @enemy7.show_mp == true
- draw_actor_mp(@enemy7,10+250,80,width=96)
- end
- end
- end
- if $game_troop.alive_members.size > 7
- if @enemy8.hide_hp == true
- #blank
- else
- draw_actor_hp(@enemy8,10+375,70,width=96)
- if @enemy8.show_mp == true
- draw_actor_mp(@enemy8,10+375,80,width=96)
- end
- end
- end
- end
- end
- end
- def refresh
- contents.clear
- enemy_hud
- # @old_size = $game_troop.alive_members.size
- # if @old_size < 5 and @boss_troop == false
- # self.height = 80
- # end
- end
- def update
- # assume no refresh needed
- refresh_okay = false
- # loop through remaining enemies one at a time - each enemy is put into the temporary variable called 'enemy'
- $game_troop.alive_members.each do |enemy|
- # have the hp or mp changed since last time?
- if enemy.hp != enemy.old_hp || enemy.mp != enemy.old_mp
- # we do need to update the hud
- refresh_okay = true
- # and replace the old values with the current values
- enemy.old_hp = enemy.hp
- enemy.old_mp = enemy.mp
- end
- end
- if $game_troop.alive_members.size != @old_size
- refresh_okay = true
- end
- if @boss_enemy != nil
- if @enemy1.enemy_id == @boss_enemy.enemy_id
- @boss_troop = true
- else
- @boss_troop = false
- end
- end
- if refresh_okay
- refresh
- end
- end
- end
- if EHUD::DELAY == true
- class Window_BattleLog
- alias enemy_hud_battle_log_wait wait_and_clear
- def wait_and_clear
- wait while @num_wait < EHUD::WINDOW_WAIT if line_number > 0
- clear
- end
- end
- end
- #Show the window on the map
- class Scene_Battle < Scene_Base
- alias original_create_all_windows create_all_windows
- def create_all_windows
- original_create_all_windows
- create_enemy_hud_window
- end
- def create_enemy_hud_window
- @enemy_hud_window = Window_Enemy_Hud.new
- end
- end
- #########################################################################
- #End Of Script #
- #########################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement