Battle HUDs
Version: 3.0
Author: Pacman
Date: January 19th, 2012
Version History
- <Version 3.0> 19.01.2012 - Added enemy HUD, revamped script
- <Version 2.1> 12.08.2011 - Removed the error messages ._.
- <Version 2.0> 12.04.2011 - Added further configuration options concerning the font.
- <Version 1.1> 06.21.2011 - Fixed a minor divzero bug that occurred when a character had 0 max mp.
- <Version 1.0> 04.18.2011 - Original Release
Planned Future Versions
- I'll take any suggestions into consideration at the moment.
Description
There are a lot of battle scripts for VX out there, and they're
mostly fantastic. However, they all require so much configuration. This script
is the ultimate plug-and-play battle HUD: all you have to do is put it in the
editor and alter one thing if you really want to. This script simply puts the
actor's defined face into the battle window along with their HP and MP.
There is now also a HUD for the enemy selection part of battle. It contains
the enemies' names, HPs, MPs and states. You can prevent the HUD from drawing
these values buy placing certain tags in the enemy's notebox.
Features
- Incredibly simple plug-and-play battle HUD.
- Comprehensive display of enemies' stats in-battle.
- Optional configuration for font size, colour and type.
ScreenshotsFrom top to bottom: Actor HUD with new colours, Actor HUD with original colours, Enemy HUD.
Instructions
Plug-and-play. You can look at the configuration module if you must.
Script
#===============================================================================
#
# Battler HUD
# Version 3.0
# By Pacman (rmrk.net)
# Description: There are a lot of battle scripts for VX out there, and they're
# mostly fantastic. However, they all require so much configuration. This script
# is the ultimate plug-and-play battle HUD: all you have to do is put it in the
# editor and alter one thing if you really want to. This script simply puts the
# actor's defined face into the battle window along with their HP and MP.
# There is now also a HUD for the enemy selection part of battle. It contains
# the enemies' names, HPs, MPs and states. You can prevent the HUD from drawing
# these values buy placing certain tags in the enemy's notebox:
#
# UNKNOWN_STATUS - Nothing is drawn.
# UNKNOWN_STATE - The states are not drawn.
# UNKNOWN_NAME - The name is not drawn.
# UNKNOWN_HP - The HP is not drawn.
# UNKNOWN_MP - The MP is not drawn.
#
# Instructions: Put this script under materials and above main in the script
# editor. Change CharOpa to the desired opactiy if you wish, and let the
# script do the rest. You can also change the font type, size and colour in the
# configuration.
#
# Support: I reside almost ever-presently at rmrk.net.
#
#===============================================================================
module PacBFH # <- Do not touch
#-------------------------------------------------------------------------------
# EDITING SECTION
#-------------------------------------------------------------------------------
USE_ACTOR = true # Use actor HUD?
USE_ENEMY = true # Use enemy HUD?
CharOpa = 150 # Default 150
ORIG_COLOURS = true # Use original HP/MP colours or my new colours?
Colour = [255, 255, 255] # RGB(A) values, separated by commas.
Size = 17 # Size of the name text
Font = "Verdana" # Font of the name text
HPMP_SIZE = false # Does 'size' apply to the drawing of HP and MP?
#-------------------------------------------------------------------------------
# END EDITING SECTION
#-------------------------------------------------------------------------------
end
if PacBFH::USE_ACTOR
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# Alias listing
#--------------------------------------------------------------------------
alias pacman_WBS_ini initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 416, 128, 1)
@column_max = $game_party.members.size
refresh
self.active = false
self.opacity = 255
self.cursor_rect.set(0, self.index * 96, 90, 90)
end
#--------------------------------------------------------------------------
# * Draw Item
# index : Item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
rect.height = 96
self.contents.clear_rect(rect)
self.contents.font.color = Color.new(*PacBFH::Colour)
self.contents.font.size = PacBFH::Size
self.contents.font.name = PacBFH::Font
actor = $game_party.members[index]
draw_actor_face2(actor, index * 96,0,80)
draw_actor_name(actor, index * 96 + 8, 0)
draw_actor_state(actor, index * 96 + 4, 32, 20)
self.contents.font.size = PacBFH::HPMP_SIZE ? PacBFH::Size : 14
draw_hp_and_mp(actor, index * 96, 50, 90)
self.contents.font.color = Font.default_color
self.contents.font.name = Font.default_name
self.contents.font.size = Font.default_size
end
#--------------------------------------------------------------------------
# * Frame update for cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(index*96, 0, 90, 96)
end
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This is a superclass of all windows in the game.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Secondary Method of drawing actor face
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : width of box
# height: height of box
#--------------------------------------------------------------------------
def draw_actor_face2(actor, x, y, width = 96, height = 96)
draw_face2(actor.face_name, actor.face_index, x, y, width, height)
end
#--------------------------------------------------------------------------
# * Secondary Method of drawing face graphics
# face_name : Face graphic filename
# face_index : Face graphic index
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : width of box
# height : height of box
#--------------------------------------------------------------------------
def draw_face2(face_name, face_index, x, y, width = 96, height = 96)
bitmap = Cache.face(face_name)
rect = Rect.new(0, 0, 0, 0)
rect.x = face_index % 4 * 96 + (96 - width) / 2
rect.y = face_index / 4 * 96 + (96 - height) / 2
rect.width = width
rect.height = height -10
self.contents.blt(x + 5, y + 5, bitmap, rect, PacBFH::CharOpa)
bitmap.dispose
end
#--------------------------------------------------------------------------
# * Draw Actor HP and MP
# actor : actor whose stats are to be drawn
# x : draw spot x-coordinate
# y : draw spot y_coordinate
# width : width of draw spot
#--------------------------------------------------------------------------
def draw_hp_and_mp(actor, x, y, width)
if PacBFH::ORIG_COLOURS
back_color = gauge_back_color
hp_color1 = hp_gauge_color1
hp_color2 = hp_gauge_color2
mp_color1 = mp_gauge_color1
mp_color2 = mp_gauge_color2
else
back_color = Color.new(39, 58, 83, 255)
hp_color1 = Color.new(66, 114, 164, 255)
hp_color2 = Color.new(122, 175, 229, 255)
mp_color1 = Color.new(93, 50, 158, 255)
mp_color2 = Color.new(145, 122, 229, 255)
end
self.contents.fill_rect(x + 5, y + 15, width - 10, 7, back_color)
self.contents.gradient_fill_rect(x + 7, y + 17, (width - 14) * actor.hp /
actor.maxhp, 3, hp_color1, hp_color2)
self.contents.draw_text(x + 5, y, width - 10, 20, Vocab::hp, 0)
self.contents.draw_text(x + 5, y, width - 10, 20, actor.hp.to_s + "/" +
actor.maxhp.to_s, 2)
self.contents.fill_rect(x + 5, y + 35, width - 10, 7, back_color)
if actor.maxmp != 0
self.contents.gradient_fill_rect(x + 7, y + 37, (width - 14) * actor.mp /
actor.maxmp, 3, mp_color1, mp_color2)
else
self.contents.gradient_fill_rect(x + 7, y + 37, (width - 14) * actor.mp,
3, mp_color1, mp_color2)
end
self.contents.draw_text(x + 5, y + 20, width - 10, 20, Vocab::mp, 0)
self.contents.draw_text(x + 5, y + 20, width - 10, 20,
actor.mp.to_s + "/" + actor.maxmp.to_s, 2)
end
end
end
if PacBFH::USE_ENEMY
#==============================================================================
# ** Window_TargetEnemy
#------------------------------------------------------------------------------
# Window for selecting the enemy who is the action target on the battle
# screen.
#==============================================================================
class Window_TargetEnemy < Window_Command
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@enemies = []
commands = []
$game_troop.members.each do |enemy|
next unless enemy.exist?
@enemies.push(enemy)
commands.push(enemy.name)
end
super(416, commands)
self.height = 128
end
#--------------------------------------------------------------------------
# * Get Enemy Object
#--------------------------------------------------------------------------
def enemy
return @enemies[@index]
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
actor = @enemies[index]
unless actor.stat_note?('UNKNOWN_STATUS')
draw_actor_name(actor, 4, rect.y) unless actor.stat_note?('UNKNOW_NAME')
unless actor.stat_note?('UNKNOWN_STATUS')
draw_actor_state(actor, 114, rect.y, 48)
end
unless actor.stat_note?('UNKNOWN_HP')
draw_actor_hp(actor, 174, rect.y, 120)
end
unless actor.stat_note?('UNKNOWN_MP')
draw_actor_mp(actor, 310, rect.y, 70)
end
end
end
end
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemy characters. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :status_note
#--------------------------------------------------------------------------
# Alias listing
#--------------------------------------------------------------------------
alias pac_unstat_ini initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(*args)
pac_unstat_ini(*args)
@status_note = enemy.note
end
#--------------------------------------------------------------------------
# * Get tag from enemy note
#--------------------------------------------------------------------------
def stat_note?(note)
return @status_note.include?(note)
end
end
end
#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================
Credit
Thanks
- Lack of stuff to do that made me bored enough to do this.
- darkecho666, for a bug find.
Support
I live on RMRK.net. Just post here or PM me.
Known Compatibility Issues
Probably will not work with other battle systems, although this only changes Window_BattleStatus, but let me know if you divide by zero or something (this actually happened once!).
Demo
This is far too simple to need a demo.
Author's Notes
On my script writing scale, from inspired to dead bored, this is an incredibly bored script.
Restrictions
Credit me. I exhibit no problem for usage in commercial projects, but please let me know if you are using this in a commercial project.