I've tested several times and it seems to me that this script isn't compatible with Yanfly Engine Ace - Battle Engine Add-On: Enemy HP Bars(which needs Yanfly Engine Ace - Ace Battle Engine) even without any extra dlls. The hp bars just don't show at all.
Although this script's order in the list obviously doesn't matter here, I tired all the 3 orderings(top, middle, bottom) and nothing changed. I've also tried to set ANIMATE_HP_GAUGE as both true and false, but bothing changed again. (So actually I've tested 6 combinations lol)
The hp bars are implemented using a new class which is inherited from Viewport. The below method initialize the hp bar instances:
Spoiler
#-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize(battler, sprite, type) @battler = battler @base_sprite = sprite @type = type dw = YEA::BATTLE::ENEMY_GAUGE_WIDTH dw += 2 if @type == :back @start_width = dw dh = YEA::BATTLE::ENEMY_GAUGE_HEIGHT dh += 2 if @type == :back rect = Rect.new(0, 0, dw, dh) @current_hp = @battler.hp @current_mhp = @battler.mhp @target_gauge_width = target_gauge_width @gauge_rate = 1.0 setup_original_hide_gauge super(rect) self.z = 125 create_gauge_sprites self.visible = false update_position end
The below method creates the plane containing the bitmap used to draw the hp bars:
Spoiler
#-------------------------------------------------------------------------- # create_gauge_sprites #-------------------------------------------------------------------------- def create_gauge_sprites @sprite = Plane.new(self) dw = self.rect.width * 2 @sprite.bitmap = Bitmap.new(dw, self.rect.height) case @type when :back colour1 = Colour.text_colour(@battler.enemy.back_gauge_colour) colour2 = Colour.text_colour(@battler.enemy.back_gauge_colour) when :hp colour1 = Colour.text_colour(@battler.enemy.hp_gauge_colour1) colour2 = Colour.text_colour(@battler.enemy.hp_gauge_colour2) end dx = 0 dy = 0 dw = self.rect.width dh = self.rect.height @gauge_width = target_gauge_width @sprite.bitmap.gradient_fill_rect(dx, dy, dw, dh, colour1, colour2) @sprite.bitmap.gradient_fill_rect(dw, dy, dw, dh, colour2, colour1) @visible_counter = 0 end
After briefly reading this script's Plane implementations, I tried to edit the below method from:
Spoiler
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # bitmap # Get the tile bitmap of this instance of Plane. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- def bitmap @bitmap end
To:
Spoiler
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # bitmap # Get the tile bitmap of this instance of Plane. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- def bitmap @sprite.bitmap end
And the HP bars come back.
With ANIMATE_HP_GAUGE as true, their displays are as if the enemies' hps constantly reducing per frame, the reduction begins from full hp to 0 hp, and then the hp "comes" back at full and get reduced again, causing an endless reduction-reset-to-full loop.
The below method implements ANIMATE_HP_GAUGE:
Spoiler
#-------------------------------------------------------------------------- # update #-------------------------------------------------------------------------- def update super self.visible = gauge_visible? @sprite.ox += 4 if YEA::BATTLE::ANIMATE_HP_GAUGE update_position update_gauge @visible_counter -= 1 end
With ANIMATE_HP_GAUGE as false, everything works fine.
I tried to fix the issues myself, but as my above attempt clearly failed, and I still only know little about Plane, I think I need help on this one
🙂
P.S.: My wild guess is that the issues have something to do with the below method of this script:
Spoiler
Code:
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # bitmap= # Set the tile bitmap of this instance of Plane. # bmp : Bitmap #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- def bitmap=(bmp) error_disposed if disposed? if bmp.nil? @sprite.bitmap = nil return @bitmap = nil end w, h = vrect.width, vrect.height nw = bmp.width <= 100 ? 2 : 3 nh = bmp.height <= 100 ? 2 : 3 dx = [(w / bmp.width).ceil, 1].max * nw dy = [(h / bmp.height).ceil, 1].max * nh bw = dx * bmp.width bh = dy * bmp.height @bitmap = bmp key = [vrect.to_a, bmp.name] if Cache.has_plane?(key) @sprite.bitmap = Cache.plane(key) else @sprite.bitmap = Bitmap.new(bw, bh) dx.times do |x| dy.times do |y| @sprite.bitmap.blt(x * bmp.width, y * bmp.height, @bitmap, @bitmap.rect) end end Cache.add_plane(key, @sprite.bitmap) end end