edit: 12-1-09 *download link renewed
ALGORITHMIC GRAPHIC METERS for ABS HUD
Version: 1.4
Author: g/A\/\/\|E|F/A\(C|=101
(original 'Heart Container' script by DarkRog 2006)
special thanks to modern algebra AND albertfish for Script Help!
Latest Update: 9-22-09
Version History- <Version 1.1> included alias method, so no need to edit Scene_Map
- <Version 1.2> included variable setting to control the amount of hearts
- <Version 1.3> included switch setting to enable or disable display
- <Version 1.4> new version for SP with a blue diamond algorithm
Planned Future Versions- <Version 1.5> vertical alignment or orientation
- <Version 1.6> constant settings for an even easier setup
HUD Meters for HP , SP , EXP
Multiple Display Options Features- the script will draw the "container", "outline", and "fill" through algorithms, meaning... no need for pictures!
- option settings can display hero's name, value and max value, containers and max containers, or percentage!
- multiple algorithms to use for different shapes, hearts, diamonds, triangles, squares.... even customize your own!
- easy one switch to disable or enable display and easy one variable to control the amount of containers!
Instructions- copy and paste this script above your Main script
- assign a switch to control display (default is 401)
- assign a variable to control container amount (default is 101)
- then control through events...^,^
THE SCRIPT
################################################################################
# Algorithmic Graphic Meter
# revised by ~Gameface101
# V 1.4 (2009)
#
# original "Heart Container" script by DarkRog (2006)
# a BIG special thanks to modern algebra on helping me out on this.
#
# http://rmrk.net/index.php/topic,34542.0.html
#
################################################################################
# Instructions:
#
# Simply copy and paste above Main like any plug'n'play script!
# Doesn't require any graphics!
# Easy to adjust your very own custom settings!
#
#(optional)
# - 1 switch (default is 2)
# - 1 variable (default is 2)
# you only need to assign a switch to enable/disable display
# and assign a variable to dynamically add/remove hearts
################################################################################
class Window_Corazones < Window_Base
def initialize
#super(-8, 410, 640, 96)#-----------=[x,y window position & x,y window size]
#[bottom left] or
super(-8, -8, 640, 96)#------------=[x,y window position & x,y window size]
#[top left]
#[Heart Containers] (number of hearts you wish to display)
#--------------------------------------------------
#corazones = 10 #[use this setting for a fixed number of hearts] or...
corazones = $game_variables[101]#to control amount of hearts by variable.
#[Opacity] (how clear or solid in appearance)
#--------------------------------------------------
opacidad = 255 #opacity: 0= invisible to 255= solid
#[Options] 0 =Blank 1 =Hero's name 2 =Value/MaxValue 3 =Hearts/Maxhearts 4 =HP%
#--------------------------------------------------
opcion = 0 #info text, review the options above:
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Impact"#---------------------------=[FONT TYPE]
self.contents.font.size = 24#---------------------------------=[FONT SIZE]
self.z = 3000#-------------------------------------------------=[BLENDING]
self.opacity = 0 #------------------------------------------=[WINDOW SKIN]
@hearts = corazones
@opacity = opacidad
@option = opcion
@hr = 0
refresh
end
#-------------------------------------------------------------------------------
def refresh
@hearts = $game_variables[101]#-----------------------------=[Variable_ID]
self.contents.clear
@n = $game_party.actors[0].hp
@mn = $game_party.actors[0].maxhp
#n is the value, and mn the maxvalue:
@hr = 0
@lh = 0
for i in 0..@hearts-1
##############################################################[heart containers]
self.contents.fill_rect(i*14, 4, 1, 3, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+1, 3, 1, 5, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+2, 2, 1, 7, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+3, 1, 1, 9, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+4, 0, 1, 11, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+5, 1, 1, 11, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+6, 2, 1, 11, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+7, 1, 1, 11, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+8, 0, 1, 11, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+9, 1, 1, 9, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+10, 2, 1, 7, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+11, 3, 1, 5, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+12, 4, 1, 3, Color.new(0, 0, 0, @opacity))
################################################################################
#################################################################[heart outline]
self.contents.fill_rect(i*14+1, 4, 1, 2, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+2, 3, 1, 4, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+3, 2, 1, 6, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+4, 1, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+5, 2, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+6, 3, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+7, 2, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+8, 1, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+9, 2, 1, 6, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+10, 3, 1, 4, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+11, 4, 1, 2, Color.new(255, 255, 255, @opacity))
################################################################################
#[color settings]
@c = 255
@l = @n*100/@mn
@ho = @l*@hearts
####################################################################[heart fill]
c_color(1)
self.contents.fill_rect(i*14+2, 4, 1, 2, Color.new(@c, 0, 0, @opacity))
c_color(2)
self.contents.fill_rect(i*14+3, 3, 1, 4, Color.new(@c, 0, 0, @opacity))
c_color(3)
self.contents.fill_rect(i*14+4, 2, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(4)
self.contents.fill_rect(i*14+5, 3, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(5)
self.contents.fill_rect(i*14+6, 4, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(6)
self.contents.fill_rect(i*14+7, 3, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(7)
self.contents.fill_rect(i*14+8, 2, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(8)
self.contents.fill_rect(i*14+9, 3, 1, 4, Color.new(@c, 0, 0, @opacity))
c_color(9)
self.contents.fill_rect(i*14+10, 4, 1, 2, Color.new(@c, 0, 0, @opacity))
################################################################################
@hr += 1
end
#[update]
def update
@value=$game_variables[101]#-------------=[to update current amount of Hearts]
$old_hp = $game_party.actors[0].hp#--------=[to update current amount of HP]
end
#######################################################################[OPTIONS]
if @option == 1
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, $game_party.actors[0].name, 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, $game_party.actors[0].name, 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, $game_party.actors[0].name, 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, $game_party.actors[0].name, 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, $game_party.actors[0].name, 0)
elsif @option == 2
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, "#{@n}/#{@mn}", 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, "#{@n}/#{@mn}", 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, "#{@n}/#{@mn}", 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, "#{@n}/#{@mn}", 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, "#{@n}/#{@mn}", 0)
elsif @option == 3
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, "#{@ho/100}/#{@hearts}", 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, "#{@ho/100}/#{@hearts}", 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, "#{@ho/100}/#{@hearts}", 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, "#{@ho/100}/#{@hearts}", 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, "#{@ho/100}/#{@hearts}", 0)
elsif @option == 4
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, "#{@l}%", 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, "#{@l}%", 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, "#{@l}%", 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, "#{@l}%", 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, "#{@l}%", 0)
end
end
end
################################################################################
##################################################################[COLOR METHOD]
def c_color(a)
if @hr <= (@ho/100)-1
@c = 255 #
else
if @ho/10-@hr*10 >= a and @ho/10-@hr*10 <= 9
@c = 255 #
else
@c = 0 #
end
end
end
################################################################################
#############=======================================[alias method for Scene_Map]
# Scene_Map #
#############
class Scene_Map
alias gameface101_main main
def main #MAIN
@corazones = Window_Corazones.new
gameface101_main
@corazones.dispose
end
alias gameface101_update update
def update #UPDATE
gameface101_update
@corazones.refresh if $old_hp != $game_party.actors[0].hp
@corazones.visible = $game_switches[401]#------=[SWITCH_ID DISPLAY ON/OFF]
@corazones.update
end
end
Credit- original "Window_Corazones" script by DarkRog (2006)
- revised and modified by g/A\/\/\|E|F/A\(C|=101 (2009)
Special Thanks- first I'd like to thank DarkRog for making the original script which was the only heart container script out there...
- second I would like to thank modern algebra for script help and starting me off on my scripting quest.
- third I would like to thank albertfish for ultimately stepping in and becoming my scripting mentor.
- and I can't forget about all those zelda games I played when I was a kid...
Supportjust go to GAMEFACE101.com
(or click on my sig)
*I'm looking for a response....
Compatibilitythere shouldn't be any problems with other scripts.
-=DEMO=-http://www.mediafire.com/?nqnu1w0im2g(link updated 12-1-09)
~Zelda ~ eat your hearts out! ^,^
Restrictionsfree to use...must give credit
(especially if you're using the latest XAS!)
HOW TO USE AS A HEART CONTAINER HEALTH BAR:STEP ONE: copy script, paste above Main script- New alias method with Scene_Map, no need to edit other scripts
STEP TWO: create "control" event Default Settings:(example)[set trigger = parallel process]
@>Control Variables: [0002:HEARTS]=3 (for three hearts...)
@>Control Switches: [0002:HEARTS]= ON (to display the hearts...)
@>Control Self Switch:A =ON (turn to the next event page)
STEP THREE: copy graphic to your character folderSTEP FOUR: create "heart" eventDefault Settings:(example)(10 points as an example)
[set trigger = player touch]
@>Play SE:'003-System03',100,100 #(sound when collect heart)
@>Control Parameters: [Hero], MaxHP +10 #(increase Hero's maximum HP 'capacity')
@>Control Variables: [0002:HEARTS] +=1 #(to gain extra heart container)
@>Change HP: Entire Party,+10 #(increase Hero's HP)
@>Control Self Switch:A =ON (turn to the next event page)
*set graphic (copied above)
*check - Stop Animation
have you seen the latest development!!?
http://rmrk.net/index.php/topic,34542.msg418159.html#msg418159