The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => XP Scripts Database => Topic started by: gameface101 on September 09, 2009, 05:11:35 AM

Title: Algorithmic Graphic Meters for ABS HUD
Post by: gameface101 on September 09, 2009, 05:11:35 AM
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


Planned Future Versions

HUD Meters for HP , SP , EXP

Multiple Display Options

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi27.tinypic.com%2F4lrbs6.jpg&hash=60a4de1906cc4ce8eb2e7060de9b73a0ad892fc4)(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi36.tinypic.com%2F14wyi55.jpg&hash=cc0b369bf0de57fd40956d04e54c40db3a7aafda)

Features


Instructions


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



Special Thanks


Support

just go to GAMEFACE101.com
(or click on my sig)

*I'm looking for a response....

Compatibility

there shouldn't be any problems with other scripts.

-=DEMO=-

http://www.mediafire.com/?nqnu1w0im2g
(link updated 12-1-09)

~Zelda ~ eat your hearts out! ^,^

Restrictions

free 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 folder

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi32.tinypic.com%2F2vd5lqo.jpg&hash=339c00e3abfb7d9782b33e4b41431fb1d665e342)


STEP FOUR: create "heart" event

Default 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!!?
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi38.tinypic.com%2Ff24nxd.jpg&hash=8f3e5a26e9c76912671c5d9257a825feff972322)
http://rmrk.net/index.php/topic,34542.msg418159.html#msg418159
Title: Re: Algorithmic Graphic Meters for ABS HUD
Post by: Mr_Wiggles on December 01, 2009, 08:57:07 AM
looks intresting, sad to see that no one's replied in a while sad this can be a usefull script, i don't need it but i might use it later in a difrent game,
oh your demo link is broken...
Title: Re: Algorithmic Graphic Meters for ABS HUD
Post by: gameface101 on December 01, 2009, 10:22:52 AM
@Mr_Wiggles - U ROCK! I've been looking for a response, still I'm pleased with the number of views and
how modern algebra helped me out with this... he even recommended it to someones request. thx MA! ^,^

I renewed the download link with the old version 1.4
maybe when I get time I'll share the new version 2.0
when it's perfected of course...
here's a sneak peek!

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi50.tinypic.com%2Fifwt9u.jpg&hash=1c00817aef745ee67e45c4074174a56e3eef2d9d)
Hearts = HP
Diamonds = SP
Triangles = EXP
RED = player's name

thanks again for sharing your interest!
all it took was a minute of your time to make my day ^,^

-=[(G/A\/\/\|F/A\(C|E]=-


                     
Title: Re: Algorithmic Graphic Meters for ABS HUD
Post by: Mr_Wiggles on December 01, 2009, 08:21:44 PM
Your welcome, im thinking of useig this system in my next game.
Title: Re: Algorithmic Graphic Meters for ABS HUD
Post by: gameface101 on December 02, 2009, 03:13:22 AM
@Mr_Wiggles - well if you do decide to use it and need any support just click on my signature ^,^

or you can go here => http://gameface101.playogame.com/play-with-programming-scripts-and-software-f7/rmxp-algorithmic-graphic-meters-script-t3.htm

creating your very own shapes for the containers are very simple once you know which lines of code to edit.

Title: Re: Algorithmic Graphic Meters for ABS HUD
Post by: harl4101 on July 23, 2010, 08:48:57 PM
Could you put a new demo link up so I can warn you
Title: Re: Algorithmic Graphic Meters for ABS HUD
Post by: harl4101 on July 31, 2010, 04:37:31 AM
Quote from: harl4101 on July 23, 2010, 08:48:57 PM
Could you put a new demo link up so I can warn you

sorry so i can try it????