Drawing multiple text bitmap on screen [VXAce]

Sorry for the new account, can't remember my old one nor the email from decade ago.

My intended script is to check every events in the map for those with the correct "graphic"'s filename and get enemy's parameter from the database based on those names then draw the parameter as a bitmap text on top of the event, at least that's what I think I am doing.


the top image is the one I want, but for some reason it only stays like that for a split second then only the event with highest ID number keep its number.

Spoiler: code
module Sapphidoll_HPdisplay
# ============================================================================
Fname = "Verdana"
Fsize = 13
Fshadow = 20
Fbold = true
# ============================================================================
end

class Game_Map


alias Sapphidoll_EnemyHPShow_update update
def update(main = false)
update_HPpop if @popHP
Sapphidoll_EnemyHPShow_update(main)
end

def update_HPpop
@popHP.update
end

def dispose_HPpop
@popHP.dispose if @popsprite
@popHP = nil
end

def monsterIDcheck(i)
if $game_map.events.character_name == "$slime"
return(1)
end
if $game_map.events.character_name == "$bee"
return(2)
else
return(0)
end
end

def enemyHPdisplay
i = 1
while i <= $game_map.events.size
monID = i
monData = monsterIDcheck(i)
if monData != 0
@popHP = Sprite_enemyHPdisplay.new(@viewport1, monID, monData)
end
i+= 1
end

end


end

class Sprite_enemyHPdisplay < Sprite

def initialize(viewport,monID, monData)

super(viewport)
@displayx = $game_map.events[monID].screen_x
@displayy = $game_map.events[monID].screen_y
@displayed_HP = $data_enemies[monData].params[0]
create_bitmap
update
end

def create_bitmap
self.bitmap = Bitmap.new(200, 20)
self.bitmap.rect.x = @displayx
self.bitmap.rect.y = @displayy
self.x = @displayx - 99
self.y = @displayy -18
self.z = 3
self.bitmap.font.size = Sapphidoll_HPdisplay::Fsize
self.bitmap.font.name = Sapphidoll_HPdisplay::Fname
self.bitmap.font.shadow = Sapphidoll_HPdisplay::Fshadow
self.bitmap.font.bold = Sapphidoll_HPdisplay::Fbold
end

def update
super
bitmap.draw_text(self.bitmap.rect, @displayed_HP, 1)
end
end

class Scene_Map < Scene_Base
def dispose_spriteset
@spriteset.dispose
$game_map.dispose_HPpop
end
end

class Game_Interpreter #no error

def showmonsterHP()
$game_map.enemyHPdisplay()
end

end

the code is based on Galv's Event Pop-Ups. can anyone tell me what's exactly wrong with it? I am not much of programmer. I also use another script to fix the camera position so I don't need the text to move around.

Original thread: https://forums.rpgmakerweb.com/threads/drawing-multiple-text-bitmap-on-screen-vxace.146396/