Jump to content

Recommended Posts

YanPac Battle HUD Version 0.3

Yanfly and Pacman

 

Introduction

This script adds the Actor HUD from Yanfly Engine Ace's Battle System to the default battle system. It draws the actor's name, face, HP, MP, TP, action and states. The script automatically detects whether to draw the actor's TP or MP depending on which skills they have. You can change some simple aesthetic options in the configuration.

 

Features

- Comprehensive HUD for actors in battle.

- Simple notebox tags to alter the drawing of HP, TP and MP.

- Allows for simple aesthetic configuration.

 

Screenshots

Be carefult, very large. From top to bottom, the screenshots are; the normal HUD, drawing HP and MP; the normal HUD with some tags in the actors’ noteboxes to make specific gauges drawn; the same HUD working with Neo Gauge Ultimate; the HUD with one actor having no gauges drawn (yeah, you can do that); and the same HUD during the action. The database image shows you how you can use the tags.

 

GAmnw.jpg

eoD9W.jpg

 

 

How to Use

Simply paste the script in an empty slot underneath Materials. The configuration is explained in the script header, as are the notetags.

 

Demo

Not really necessary.

 

Script

I recommend getting it from Pastebin or my blog. However, I will post it here.

 

#===============================================================================
#
# YanPac Battle HUD (0.3)
# 27/02/2012
# By Yanfly and Pacman (originally by Yanfly, extracted and worked on by Pacman)
# This script adds the Actor HUD from Yanfly Engine Ace's Battle System to the
# default battle system. It draws the actor's name, face, HP, MP, TP, action
# and states. The script automatically detects whether to draw the actor's TP
# or MP depending on which skills they have. You can change some simple
# aesthetic options below.
# You can use simple notetags to make sure the actor's gauges are drawn:
# \def_draw_hp  - Definitely draw HP
# \def_draw_mp  - Definitely draw MP
# \def_draw_tp  - Definitely draw TP
# \def_not_hp   - Definitely don't draw HP
# \def_not_mp   - Definitely don't draw MP
# \def_not_tp   - Definitely don't draw TP
# The main point of this standalone script is to optimize compatibility with
# other scripts and increase efficiency (currently pending ).
#
# Version list:
# 0.3: Compatible with Change Gauge Display
#   http://pacmanvx.wordpress.com/2012/02/11/change-gauge-display/
# 0.2: Compatible with Neo Gauge Ultimate
#   http://pacmanvx.wordpress.com/2012/02/05/neo-gauge-ultimate/
# 0.l: Script extracted / created.
#
#===============================================================================
module PAC_HUD
#===============================================================================
# BEGIN CONFIGURATION
#===============================================================================
 BATTLESTATUS_NAME_FONT_SIZE = 20	# Font size used for name.
 BATTLESTATUS_TEXT_FONT_SIZE = 16	# Font size used for HP, MP, TP.
 BATTLESTATUS_NO_ACTION_ICON = 185   # No action icon.
 BATTLESTATUS_HPGAUGE_Y_PLUS = 11	# Y Location buffer used for HP gauge.
 BATTLESTATUS_CENTER_FACES   = false # Center faces for the Battle Status.
 MP_OVER_TP = true				   # If TP is not drawn, draw MP? (still
								  # applies notetag effects)
#===============================================================================
# END CONFIGURATION
#===============================================================================
end
$imported ||= {}
#==============================================================================
# â–  Numeric
#------------------------------------------------------------------------------
#  Numeric ã¯æ•°å€¤ã®æŠ½è±¡ã‚¯ãƒ©ã‚¹ã§ã™ã€‚Ruby ã§ã¯ç•°ãªã‚‹æ•°å€¤ã‚¯ãƒ©ã‚¹é–“ã§æ¼”ç®—ã‚’è¡Œã†ã“ã¨ãŒã§ãã¾ã™ã€‚
# 演算や比較を行ã†ãƒ¡ã‚½ãƒƒãƒ‰ (+, -, *, /, <=>) ãªã©ã¯ã‚µãƒ–クラスã§å®šç¾©ã•ã‚Œã¾ã™ã€‚ã¾ãŸã€åŠ¹çŽ‡ã®ãŸã‚ Numeric
# ã®ãƒ¡ã‚½ãƒƒãƒ‰ã¨åŒã˜ãƒ¡ã‚½ãƒƒãƒ‰ãŒã‚µãƒ–クラスã§å†å®šç¾©ã•ã‚Œã¦ã„ã‚‹å ´åˆãŒã‚ã‚Šã¾ã™ã€‚ ç§ã®ã²ã©ã„日本語を言ã„訳。
#==============================================================================
class Numeric
 #--------------------------------------------------------------------------
 # * Group Digits
 #--------------------------------------------------------------------------
 unless defined?(group); def group; return self.to_s; end; end
end
#==============================================================================
# â–  Game_Battler
#------------------------------------------------------------------------------
#  スプライトや行動ã«é–¢ã™ã‚‹ãƒ¡ã‚½ãƒƒãƒ‰ã‚’追加ã—ãŸãƒãƒˆãƒ©ãƒ¼ã®ã‚¯ãƒ©ã‚¹ã§ã™ã€‚ã“ã®ã‚¯ãƒ©ã‚¹
# 㯠Game_Actor クラス㨠Game_Enemy クラスã®ã‚¹ãƒ¼ãƒ‘ークラスã¨ã—ã¦ä½¿ç”¨ã•ã‚Œã¾ã™ã€‚
#==============================================================================
class Game_Battler < Game_BattlerBase
 #--------------------------------------------------------------------------
 # * Draw Battler's HP?
 #--------------------------------------------------------------------------
 def draw_hp?; return true; end
 #--------------------------------------------------------------------------
 # * Draw Battler's MP?
 #--------------------------------------------------------------------------
 def draw_mp?; return true; end
 #--------------------------------------------------------------------------
 # * Draw Battler's TP?
 #--------------------------------------------------------------------------
 def draw_tp?
return $imported[:pac_change_gauge] ? $game_system.opt_display_tp :
 $data_system.opt_display_tp
 end
end
#==============================================================================
# â–  Game_Actor
#------------------------------------------------------------------------------
#  アクターを扱ã†ã‚¯ãƒ©ã‚¹ã§ã™ã€‚ã“ã®ã‚¯ãƒ©ã‚¹ã¯ Game_Actors クラス($game_actors)
# ã®å†…部ã§ä½¿ç”¨ã•ã‚Œã€Game_Party クラス($game_party)ã‹ã‚‰ã‚‚å‚ç…§ã•ã‚Œã¾ã™ã€‚
#==============================================================================
class Game_Actor < Game_Battler
 #--------------------------------------------------------------------------
 # * Draw Actor's HP?
 #--------------------------------------------------------------------------
 def draw_hp?
return true if !self.actor.note[/\\def[_ ]?draw[_ ]?hp/i].nil?
return false if !self.actor.note[/\\def[_ ]?not[_ ]?hp/i].nil?
if $imported[:pac_gauge_change]
  return false if self.actor.no_hp_display?
end
return true
 end
 #--------------------------------------------------------------------------
 # * Draw Actor's MP?
 #--------------------------------------------------------------------------
 def draw_mp?
return true if !self.actor.note[/\\def[_ ]?draw[_ ]?mp/i].nil?
return false if !self.actor.note[/\\def[_ ]?not[_ ]?mp/i].nil?
if $imported[:pac_gauge_change]
  return false if self.actor.no_mp_display?
end
return true if !draw_tp? && PAC_HUD::MP_OVER_TP
for skill in skills
  next unless added_skill_types.include?(skill.stype_id)
  return true if skill.mp_cost > 0
end
return false
 end
 #--------------------------------------------------------------------------
 # * Draw Actor's TP?
 #--------------------------------------------------------------------------
 def draw_tp?
return true if !self.actor.note[/\\def[_ ]?draw[_ ]?tp/i].nil?
return false if !self.actor.note[/\\def[_ ]?not[_ ]?tp/i].nil?
if $imported[:pac_gauge_change]
  return false if self.actor.no_tp_display?
end
return false unless $imported[:pac_change_gauge] ?
 $game_system.opt_display_tp : $data_system.opt_display_tp
for skill in skills
  next unless added_skill_types.include?(skill.stype_id)
  return true if skill.tp_cost > 0
end
return false
 end
end
#==============================================================================
# â–  Window_BattleStatus
#------------------------------------------------------------------------------
#  ãƒãƒˆãƒ«ç”»é¢ã§ã€ãƒ‘ーティメンãƒãƒ¼ã®ã‚¹ãƒ†ãƒ¼ã‚¿ã‚¹ã‚’表示ã™ã‚‹ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã§ã™ã€‚
#==============================================================================
class Window_BattleStatus < Window_Selectable
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
super(0, 0, window_width, window_height)
self.openness = 0
@party = $game_party.battle_members.clone
 end
 #--------------------------------------------------------------------------
 # * Column Max
 #--------------------------------------------------------------------------
 def col_max; return $game_party.max_battle_members; end
 #--------------------------------------------------------------------------
 # * Get Battle Members
 #--------------------------------------------------------------------------
 def battle_members; return $game_party.battle_members; end
 #--------------------------------------------------------------------------
 # * Get Current Actor
 #--------------------------------------------------------------------------
 def actor; return battle_members[@index]; end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
super
return if @party == $game_party.battle_members
@party = $game_party.battle_members.clone
refresh
 end
 #--------------------------------------------------------------------------
 # * Draw Item
 #	 index : index of item to be drawn
 #--------------------------------------------------------------------------
 def draw_item(index)
return if index.nil?
clear_item(index)
actor = battle_members[index]
rect = item_rect(index)
return if actor.nil?
draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
draw_actor_name(actor, rect.x, rect.y, rect.width-8)
draw_actor_action(actor, rect.x, rect.y)
draw_actor_icons(actor, rect.x, line_height*1, rect.width)
gx = PAC_HUD::BATTLESTATUS_HPGAUGE_Y_PLUS
contents.font.size = PAC_HUD::BATTLESTATUS_TEXT_FONT_SIZE
if draw_hp?(actor)
  draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
end
if draw_tp?(actor) && draw_mp?(actor)
  dw = rect.width/2-2
  dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  draw_actor_tp(actor, rect.x+2, line_height*3, dw)
  dw = rect.width - rect.width/2 - 2
  draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
elsif draw_tp?(actor) && !draw_mp?(actor)
  draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
elsif !draw_tp?(actor) && draw_mp?(actor)
  draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
else
end
 end
 #--------------------------------------------------------------------------
 # * Get Item Rect
 #	 index : index of item to get rect for
 #--------------------------------------------------------------------------
 def item_rect(index)
rect = Rect.new
rect.width = contents.width / $game_party.max_battle_members
rect.height = contents.height
rect.x = index * rect.width
if PAC_HUD::BATTLESTATUS_CENTER_FACES
  rect.x += (contents.width - $game_party.members.size * rect.width) / 2
end
rect.y = 0
return rect
 end
 #--------------------------------------------------------------------------
 # * Draw Face (specifically for this HUD)
 #--------------------------------------------------------------------------
 def draw_face(face_name, face_index, dx, dy, enabled = true)
bitmap = Cache.face(face_name)
fx = [(96 - item_rect(0).width + 1) / 2, 0].max
fy = face_index / 4 * 96 + 2
fw = [item_rect(0).width - 4, 92].min
rect = Rect.new(fx, fy, fw, 92)
rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
 end
 #--------------------------------------------------------------------------
 # * Draw Actor Name
 #--------------------------------------------------------------------------
 def draw_actor_name(actor, dx, dy, dw = 112)
reset_font_settings
contents.font.size = PAC_HUD::BATTLESTATUS_NAME_FONT_SIZE
change_color(hp_color(actor))
draw_text(dx+24, dy, dw-24, line_height, actor.name)
 end
 #--------------------------------------------------------------------------
 # * Draw Actor's Action Icon
 #--------------------------------------------------------------------------
 def draw_actor_action(actor, dx, dy)
draw_icon(action_icon(actor), dx, dy)
 end
 #--------------------------------------------------------------------------
 # * Get Actor's Action Icon
 #--------------------------------------------------------------------------
 def action_icon(actor)
return PAC_HUD::BATTLESTATUS_NO_ACTION_ICON if actor.current_action.nil?
return PAC_HUD::BATTLESTATUS_NO_ACTION_ICON if actor.current_action.item.nil?
return actor.current_action.item.icon_index
 end
 #--------------------------------------------------------------------------
 # * Draw Actor's TP?
 #--------------------------------------------------------------------------
 def draw_tp?(actor)
return actor.draw_tp?
 end
 #--------------------------------------------------------------------------
 # * Draw Actor's MP?
 #--------------------------------------------------------------------------
 def draw_mp?(actor)
return actor.draw_mp?
 end
 #--------------------------------------------------------------------------
 # * Draw Actor's HP?
 #--------------------------------------------------------------------------
 def draw_hp?(actor)
return actor.draw_hp?
 end
 #--------------------------------------------------------------------------
 # * Draw Current & Max Values
 #--------------------------------------------------------------------------
 def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
change_color(color1)
draw_text(dx, dy, dw, line_height, current.group, 2)
 end
 #--------------------------------------------------------------------------
 # * Draw Actor's HP Gauge
 #--------------------------------------------------------------------------
 def draw_actor_hp(actor, dx, dy, width = 124, h = 6, *args)
if defined?(draw_neo_gauge) # NGU Support
  gwidth = width * actor.hp / actor.mhp
  cg = neo_gauge_back_color
  c1, c2, c3 = cg[0], cg[1], cg[2]
  draw_neo_gauge(dx, dy + line_height - 8, width, h, c1, c2, c3)
  (1..3).each { |i| eval("c#{i} = HP_GCOLOR_#{i}")}
  draw_neo_gauge(dx, dy + line_height - 8, gwidth, h, c1, c2, c3, false,
   false, width, 40)
else
  draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
end
change_color(system_color)
cy = (Font.default_size - contents.font.size) / 2 + 1
draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
  hp_color(actor), normal_color)
 end
 #--------------------------------------------------------------------------
 # * Draw Actor's MP Gauge
 #--------------------------------------------------------------------------
 def draw_actor_mp(actor, dx, dy, width = 124)
if defined?(draw_neo_gauge) # NGU Support
  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(dx, dy + line_height - 8, width, 6, c1, c2, c3)
  (1..3).each { |i| eval("c#{i} = MP_GCOLOR_#{i}")}
  draw_neo_gauge(dx, dy + line_height - 8, gwidth, 6, c1, c2, c3, false,
   false, width, 40)
else
  draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
end
change_color(system_color)
cy = (Font.default_size - contents.font.size) / 2 + 1
draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
  mp_color(actor), normal_color)
 end
 #--------------------------------------------------------------------------
 # * Draw Actor's TP Gauge
 #--------------------------------------------------------------------------
 def draw_actor_tp(actor, dx, dy, width = 124)
if defined?(draw_neo_gauge) # NGU Support
  gwidth = width * actor.tp / 100
  cg = neo_gauge_back_color
  c1, c2, c3 = cg[0], cg[1], cg[2]
  draw_neo_gauge(dx, dy + line_height - 8, width, 6, c1, c2, c3)
  (1..3).each { |i| eval("c#{i} = TP_GCOLOR_#{i}")}
  draw_neo_gauge(dx, dy + line_height - 8, gwidth, 6, c1, c2, c3, false,
   false, width, 40)
else
  draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
end
change_color(system_color)
cy = (Font.default_size - contents.font.size) / 2 + 1
draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
change_color(tp_color(actor))
draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
 end
end
$imported[:yanpac_battle_hud] = [0.3]
#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================

 

 

 

FAQ

None, as of yet. Ask away if you have any questions.

 

Credit and Thanks

Credit - Pacman

Credit - Yanfly

Thanks - Yami

 

Author's Notes

I will make this script compatible with another script if you ask me, and it isn’t too hard. But be aware that I do have schoolwork, so don’t expect everything done within a day. I hope this script works for you, and you like it!

Note that I am not very active on this forum, it is much easier to reach me on my blog (in my signature) or on RMRK. I do check in here occasionally though.

I made this because someone on RRR requested a Battle HUD for actors in VXA. Because I’m lazy, I simply extracted the HUD from YEA Battle System and made it work on its own. Yanfly did give me permission to do this. In addition to this simple request, I decided to make this HUD compatible with other scripts for maximum awesomeness.

Edited by SuperAngryPacman

Share this post


Link to post
Share on other sites

I was just thinking. Man, it would be great to have that Yanfly script that displayed Faces/Status in the default battle window.

Lo and behold... It was posted 2 hours ago. haha.

 

Went ahead and grabbed the code from your blog to help your hits.

;D

Share this post


Link to post
Share on other sites

That's an interesting idea. Yanfly's Battle Engine Ace does come with the exact same graphical HUD, but not the same customization in terms of the gauges. I'm not entirely sure if it'll work, and I'm not really in a position to test, so give it a shot. Make sure you place this script under Battle Engine Ace. Let me know how it goes!

Share this post


Link to post
Share on other sites

Do you mean changing the opacity of the window to 0 (i.e., making the background of the window invisible)? If so, use this:

#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  This window is for displaying the status of party members on the battle
# screen.
#==============================================================================

class Window_BattleStatus < Window_Selectable
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 alias opacity_fix_init initialize
 def initialize(*args)
opacity_fix_init(*args)
self.opacity = 0
 end
end

#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================

Share this post


Link to post
Share on other sites

The HP Gauge colours are in the windowskin, both the 21st and 22nd colours are used. Altering those on the windowskin graphic will change it in the HUD. You could alternatively put this in your script editor:

class Window_Base
 def hp_gauge_color1
   Color.new(224, 128, 64)
 end
 def hp_gauge_color2
   Color.new(240, 192, 64)
 end
end

And alter the numbers inside the brackets to get the colour you desire.

 

As for making the gauge wider, I'm not sure why you would want to, but you could go to line 195 and change it from

      draw_actor_hp(actor, rect.x + 2, line_height * 2 + gx, rect.width - 4)

to

      draw_actor_hp(actor, rect.x + 2, line_height * 2 + gx, rect.width)

If that's what you wanted?

Share this post


Link to post
Share on other sites

So I'm having a problem using this script. I'm using the HF2 textures so when I use this script it gives me the "null" icon for when I try to attack. Does anyone know how I change the values for the icons? I managed to change the 'noaction' icon from a random sword to an orb but I wasn't able to find a specific value for the action icon.

 

Does anyone know how to fix this?

 

I'm attaching the icon set for reference and a screenshot of the battle view.

IconSet.png

HF2.png

Share this post


Link to post
Share on other sites

This is because rpg maker uses it's default icon set values. You overwrote the icons for the system by making your own iconset. The icon that would be shown here by default is the one in the image at the top of this thread. The fist with lightning symbols.

If you use a skill, does it show that icon?

You should make your icon set from the default set and just add on what you want at the end of the default icon set (make a copy).

 

 

 

Edited by roninator2
removed image

Share this post


Link to post
Share on other sites

Thank you for your reply. I have figured out my problem and what I did is I just went in and manually changed all of the icons to what I believe they should be, or as close as possible. It now works and shows the correct icon for the skill or magic.

 

Thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×