[RMXP] Display Enemy Information in Battle

"Hey folks, in RPG MAKER XP, when using an item, this information appears on the character as shown in the image below.

Spoiler: Screenshot of the Image
1710893319597.png

I would like it so that when attacking the monster, this information appears on it, such as name [status], HP, and MP.


Spoiler: "Edited image in Photoshop of how I would like it to appear."
1710893799205.png


Does anyone know how to do this?
Perhaps this is what you need...

Updated!

Ruby:
# * BattleItemHelp XP * #
#   Scripter : Kyonides Arkanthes
#   2024-03-29

class Game_BattleAction
  def attack?
    @kind == 0 and @basic == 0
  end

  def skill?
    @kind == 1 and @skill_id > 0
  end

  def item?
    @item_id > 0
  end

  def enemy_target?
    attack? or skill?
  end
end

class Window_Help
  def set_actor(actor)
    if actor != @actor
      self.contents.clear
      draw_actor_name(actor, 4, 0)
      draw_actor_state(actor, 140, 0)
      draw_actor_hp(actor, 284, 0)
      draw_actor_sp(actor, 460, 0)
      @actor = actor
      @text = nil
      self.visible = true
    end
  end

  def set_enemy(enemy)
    @text = nil
    contents.clear
    draw_actor_name(enemy, 4, 0)
    draw_actor_state(enemy, 140, 0)
    draw_actor_hp(enemy, 284, 0)
    draw_actor_sp(enemy, 460, 0)
  end
end

class Window_Skill
  def visible=(bool)
    super(bool)
    update_help if @help_window
  end
end

class Scene_Battle
  alias :kyon_blt_item_help_scn_btl_start_enemy_sel :start_enemy_select
  def start_enemy_select
    kyon_blt_item_help_scn_btl_start_enemy_sel
    @enemy_arrow.update_help
    @help_window.visible = @active_battler.current_action.enemy_target?
  end
end
Hello, thank you! However, it didn't work out. Nevertheless, I managed to find a blog that teaches how to do it, which is this "http://cid6.over-blog.com/article-538809.html". However, at the end of the code, only the HP appears, so I asked ChatGPT for help, and incredibly, after several correction requests that it itself generated, I managed to generate both HP and MP. If you look at the website in French through Google Chrome, which allows you to use the 'translate pages' feature to our native language, you will see that it modifies the 'Windows Help' at the end of the tutorial it provides. This is the code I put instead of his.

Spoiler: code
class Window_Help < Window_Base
attr_accessor :scan # Accessor attribute to check if scanning is on or off

def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font = Font.new("Arial")
@SCAn = false # Initially, scanning is off
end

def set_text(text, align = 0)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end

def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
draw_actor_hp(actor, 284, 0)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
end
end

# Method to set enemy information in the help window
def set_enemy(enemy)
hp_text = "HP:"
mp_text = "MP:"
hp_data = "#{enemy.hp}/#{enemy.maxhp}"
mp_data = "#{enemy.sp}/#{enemy.maxsp}"

# Drawing text on screen
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 160, 32, "#{enemy.name}", 1) # Enemy name
self.contents.font.color = Color.new(0, 191, 255) # Light blue color for HP
self.contents.draw_text(160, 0, 32, 32, hp_text) # HP text
self.contents.font.color = normal_color
self.contents.draw_text(192, 0, 100, 32, hp_data) # HP data
self.contents.font.color = Color.new(0, 191, 255) # Light blue color for MP
self.contents.draw_text(292, 0, 32, 32, mp_text) # MP text
self.contents.font.color = normal_color
self.contents.draw_text(324, 0, 100, 32, mp_data) # MP data
self.visible = true
end
end

Spoiler: Work result
1711734106961.png

"Below the Side Layout is another script unrelated to this one, and the sword on top selecting the enemy is a Windskin, the work result is just showing the HP and MP, unfortunately, I couldn't do the status more, but it's already good enough to get by."
Note: I'm not sure how to close the topic, but I managed to figure it out on my own. If anyone checks the tutorial on the website and wants the code from this post as well to display both HP and MP instead of just HP, which was generated in ChatGPT, feel free. I don't need credits, but give credit to the person who posted the tutorial even though they didn't ask for credits, "Cidragon6"
Oh come on! It worked on the default RMXP demo. Plus you simply made ChatGPT come with a more convoluted way to achieve what could have been done from the very beginning with my short code.

That scan method the bot added serves no real purpose. There's no code making a call to that window's scan method at all.

EDIT

There was a condition that prevented it from refreshing it at will. So I had to adjust my script a little bit.
And it has an advantage: it will display the help window while selecting the hero's attack target.
Oh come on! It worked on the default RMXP demo. Plus you simply made ChatGPT come with a more convoluted way to achieve what could have been done from the very beginning with my short code.

That scan method the bot added serves no real purpose. There's no code making a call to that window's scan method at all.

EDIT

There was a condition that prevented it from refreshing it at will. So I had to adjust my script a little bit.
And it has an advantage: it will display the help window while selecting the hero's attack target.

Hi, I tested it here and it worked. Yes, your script is indeed better because the tutorial I had seen before messes with the code of the Windows help and Battle Scene. I had thought no one would respond to this, so I used that method. Nonetheless, thank you very much. I'll see if I can return the edited settings back to the default and go back to the project to use your script. Can I use it in a non-commercial project? If so, how can I mention it in the credits? And sorry for any inconvenience.
I'll soon post it as a full-fledged script with all the details may need to know about it.
I'll soon post it as a full-fledged script with all the details may need to know about it.
Okay, thank you for helping.

Original thread: https://forums.rpgmakerweb.com/threads/rmxp-display-enemy-information-in-battle.166986/