Paddy 77 Posted April 19, 2013 Hoy! For my upcoming project, I am after a specific type of HUD that displays hearts as opposed to HP. There actually is a script for this, but it was written for VX. http://www.gdunlimited.net/scripts/rpg-maker-vx/window-scripts/omegax-zelda-hearts-system That's it there. In that script, one heart equals 4 HP, and can be increased as and when you please. Upon gaining more health, the amount of hearts increases by one per every 4 HP. If someone could either convert Omega's script, or just write a new one that would be fantastic. I can sort out the graphics for it myself, it's just that system that I'm after. Cheers! Share this post Link to post Share on other sites
Sievnn 14 Posted April 19, 2013 I would like this too. 1 Share this post Link to post Share on other sites
Paddy 77 Posted April 19, 2013 It would be awesome if more people express an interest in this. Hopefully it will increase the likelyhood of someone taking on this request. Share this post Link to post Share on other sites
Ariel Schnee 7 Posted April 20, 2013 It would be awesome if more people express an interest in this. Hopefully it will increase the likelyhood of someone taking on this request. Ditto. 1 Share this post Link to post Share on other sites
Paddy 77 Posted April 20, 2013 Oops. I actually forgot to mention I will be using an Active Battle System for my project. If that makes any difference at all. Share this post Link to post Share on other sites
+ Novem 344 Posted April 20, 2013 I would be interested in this too. I would honestly be interested in a whole zelda themed script pack, that would be great, because there's a ton of stuff in Zelda that would be awesome for ABS's like Pearl. 1 Share this post Link to post Share on other sites
Paddy 77 Posted April 20, 2013 (edited) There are already plenty of scripts that are fantastic for implementing features similar to the Zelda series. I think the only one made specifically for a Zelda feature was that Ocarina script I've seen here somewhere. But, combined with eventing, there is so much you could do to make a Zelda-esque game with what's available. This 'Hearts System' is pretty much the only thing I need to make my project feel more like an authentic Zelda game. But that's not to say it could only be used for a Zelda game. I suppose it could be altered in so many ways to fit any kind of game. Edited April 20, 2013 by The Welsh Paddy Share this post Link to post Share on other sites
PyrO17 17 Posted April 21, 2013 module Cache #-------------------------------------------------------------------------- # * Get Hud Graphic #-------------------------------------------------------------------------- def self.hud(filename, hue=0) load_bitmap("Graphics/System/Hud/", filename, hue) end end class ZeldaHearts < Window_Base #-------------------------------------------------------------------------- # * Changeable Area #-------------------------------------------------------------------------- def hud_width 400 end def hud_height 240 end def heart_file "hearts.png" end def heart_width 24 end def heart_padding -10 end def heart_rowheight -10 end def heart_row 5 end def hp_per_heart 4 end def heart_pieces 4 end #-------------------------------------------------------------------------- # * Fixed Area #-------------------------------------------------------------------------- def initialize super(0, 0, hud_width, hud_height) self.windowskin = nil @bitmap = Cache.hud(heart_file) draw_hearts end def draw_hearts @lhearts = @hearts @lmaxHearts = @maxHearts @hearts = calc_hearts(get_hp) @maxHearts = calc_hearts(get_maxhp).to_i fullHearts = @hearts.to_i partHearts = @hearts - fullHearts i = 0 if fullHearts for i in 0..@maxHearts-1 do if i < fullHearts get_heart_image(i, heart_pieces) elsif i == fullHearts get_heart_image(i, (partHearts*heart_pieces).round(0)) else get_heart_image(i,0) end end end end def get_heart_image(heartIndex, fileIndex) rect = Rect.new(fileIndex * heart_width, 0, @bitmap.width/(heart_pieces+1), @bitmap.height) contents.blt(heartIndex.modulo(heart_row)*(heart_width+heart_padding), (heartIndex/heart_row)*(@bitmap.height+heart_rowheight), @bitmap, rect, 255) end def get_hp $game_party.members[0].hp end def get_maxhp $game_party.members[0].mhp end def calc_hearts(hp) Float hearts = hp.to_f / hp_per_heart hearts.round(2) end def refresh self.contents.clear contents.clear draw_hearts end def update super refresh end def change if @lhearts == @hearts && @lmaxHearts == @maxHearts return else update end end def dispose super @bitmap.dispose end end class Scene_Map < Scene_Base alias start_window start alias term_window terminate alias update_window update def start start_window @hearthud = ZeldaHearts.new update end def terminate @hearthud.dispose term_window end def update update_window @hearthud.change end end Here it is with a example heart file. The file should go into Graphics/System/Hud/ . I wish everyone fun with it 4 Share this post Link to post Share on other sites
Paddy 77 Posted April 21, 2013 Dude, this is fantastic. It's exactly what I needed. Thanks very much! Share this post Link to post Share on other sites
Ariel Schnee 7 Posted April 22, 2013 module Cache #-------------------------------------------------------------------------- # * Get Hud Graphic #-------------------------------------------------------------------------- def self.hud(filename, hue=0) load_bitmap("Graphics/System/Hud/", filename, hue) end end class ZeldaHearts < Window_Base #-------------------------------------------------------------------------- # * Changeable Area #-------------------------------------------------------------------------- def hud_width 400 end def hud_height 240 end def heart_file "hearts.png" end def heart_width 24 end def heart_padding -10 end def heart_rowheight -10 end def heart_row 5 end def hp_per_heart 4 end def heart_pieces 4 end #-------------------------------------------------------------------------- # * Fixed Area #-------------------------------------------------------------------------- def initialize super(0, 0, hud_width, hud_height) self.windowskin = nil @bitmap = Cache.hud(heart_file) draw_hearts end def draw_hearts @lhearts = @hearts @lmaxHearts = @maxHearts @hearts = calc_hearts(get_hp) @maxHearts = calc_hearts(get_maxhp).to_i fullHearts = @hearts.to_i partHearts = @hearts - fullHearts i = 0 if fullHearts for i in 0..@maxHearts-1 do if i < fullHearts get_heart_image(i, heart_pieces) elsif i == fullHearts get_heart_image(i, (partHearts*heart_pieces).round(0)) else get_heart_image(i,0) end end end end def get_heart_image(heartIndex, fileIndex) rect = Rect.new(fileIndex * heart_width, 0, @bitmap.width/(heart_pieces+1), @bitmap.height) contents.blt(heartIndex.modulo(heart_row)*(heart_width+heart_padding), (heartIndex/heart_row)*(@bitmap.height+heart_rowheight), @bitmap, rect, 255) end def get_hp $game_party.members[0].hp end def get_maxhp $game_party.members[0].mhp end def calc_hearts(hp) Float hearts = hp.to_f / hp_per_heart hearts.round(2) end def refresh self.contents.clear contents.clear draw_hearts end def update super refresh end def change if @lhearts == @hearts && @lmaxHearts == @maxHearts return else update end end def dispose super @bitmap.dispose end end class Scene_Map < Scene_Base alias start_window start alias term_window terminate alias update_window update def start start_window @hearthud = ZeldaHearts.new update end def terminate @hearthud.dispose term_window end def update update_window @hearthud.change end end Here it is with a example heart file. The file should go into Graphics/System/Hud/ . I wish everyone fun with it It keeps conflicting with this : RMXP Windowskin Converter. =begin RMXP to RMVX (Ace) Windowskin Converter v1.0.4 by PK8 Created: 5/1/2012 Modified: 6/12/2012 ────────────────────────────────────────────────────────────────────────────── ■Author's Notes I was in yet another experimental kind of mood and decided to script this. Mainly inspired by a web-based windowskin converter I wanted to do for my old site. ────────────────────────────────────────────────────────────────────────────── ■Introduction This script will take whatever XP windowskin you give it and mould it into a windowskin that would fit right in with RPG Maker VX in-game. ────────────────────────────────────────────────────────────────────────────── ■Features o Very plug and play. Add this script in, change your windowskin to an XP windowskin, edit a couple of settings, and there you go! ────────────────────────────────────────────────────────────────────────────── ■Methods Aliased o Window_Base.initialize o Window_Base.update ────────────────────────────────────────────────────────────────────────────── ■Changelog (MM/DD/YYYY) v1 (05/01/2012): Initial release. v1.0.1 (05/02/2012): I removed a setting. Instead of setting which area would the script copy over to the bitmap, it would copy certain areas depending on the filename. (Applies to XP) v1.0.2 (05/03/2012): Disposes the new_windowskin bitmap after it's done generating the converted skin. v1.0.3 (05/05/2012): Added a compatibility setting for my windowskin script, took out the compatibility flag setting, and added a switch setting. v1.0.4 (06/12/2012): Reduced the code by a couple of lines. ────────────────────────────────────────────────────────────────────────────── ■Importing RPG Maker XP Windowskins o This script has been made to be used along with other windowskin changing scripts. To allow this script to be used along with other windowskin changers, set the Compatibility setting to anything other than false. o If the windowskin doesn't have a "$" or a "!" in its filename... It will apply the windowskin's wallpaper onto the background. o If the windowskin has a "$" in its filename It will apply the windowskin's wallpaper onto the background and pattern. o If the windowskin has a "!" in its filename It will apply the windowskin's wallpaper onto the pattern. =end #============================================================================== # ** Configuration #============================================================================== module PK8 class Windowskin_Conversion #-------------------------------------------------------------------------- # * Do not modify #-------------------------------------------------------------------------- Colors = [] #-------------------------------------------------------------------------- # * General Settings #-------------------------------------------------------------------------- # Enable/Disable the script. Switch = true # 0/"Top"/"Stretch"/"Background"/"BG" # 1/"Bottom"/"Tile"/"Tiled"/"Pattern" # 2/"Whole"/"All" Apply = 0 # Which windowskin changer are you using? # Values allowed: "woratana", "dervvulfman", "pk8", false Compatibility = false #-------------------------------------------------------------------------- # * Colors #-------------------------------------------------------------------------- Colors[0] = [255, 255, 255] # Normal Text Color Colors[1] = [32 , 160, 214] Colors[2] = [255, 120, 76] Colors[3] = [102, 204, 64] Colors[4] = [153, 204, 255] Colors[5] = [204, 192, 255] Colors[6] = [255, 255, 160] Colors[7] = [128, 128, 128] Colors[8] = [192, 192, 192] Colors[9] = [32 , 128, 204] Colors[10] = [255, 56 , 16] Colors[11] = [0 , 160, 16] Colors[12] = [64 , 154, 222] Colors[13] = [160, 152, 255] Colors[14] = [255, 204, 32] Colors[15] = [0 , 0 , 0] Colors[16] = [132, 170, 255] # System Text Color Colors[17] = [255, 255, 64] # Crisis Color Colors[18] = [255, 32 , 32] # Knockout Color Colors[19] = [32 , 32 , 64] # Gauge Back Color Colors[20] = [224, 128, 64] # HP Gauge Color 1 Colors[21] = [240, 192, 64] # HP Gauge Color 2 Colors[22] = [64 , 128, 192] # MP Gauge Color 1 Colors[23] = [64 , 192, 240] # MP Gauge Color 2 / MP Cost Color Colors[24] = [128, 255, 128] # Power Up Color Colors[25] = [192, 128, 128] # Power Down Color Colors[26] = [128, 128, 255] Colors[27] = [255, 128, 255] Colors[28] = [0 , 160, 64] # TP Gauge Color 1 Colors[29] = [0 , 224, 96] # TP Gauge Color 2 / TP Cost Color Colors[30] = [160, 96 , 224] Colors[31] = [192, 128, 255] #-------------------------------------------------------------------------- # * Do not modify #-------------------------------------------------------------------------- Apply = Apply.downcase if Apply.is_a?(String) Compatibility = Compatibility.downcase if Compatibility.is_a?(String) end end #============================================================================== # ** Window_Base #------------------------------------------------------------------------------ # This class is for all in-game windows. #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- unless method_defined?(:pk8_xpwindowskin_initialize) alias_method(:pk8_xpwindowskin_initialize, :initialize) alias_method(:pk8_xpwindowskin_update, :update) end #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(*args) pk8_xpwindowskin_initialize(*args) if PK8::Windowskin_Conversion::Switch == true if self.windowskin.width == 192 and self.windowskin.height == 128 new_windowskin = Bitmap.new(128, 128) if PK8::Windowskin_Conversion::Compatibility != false case PK8::Windowskin_Conversion::Compatibility when "woratana", "wora", "worale" sign = $game_system.skin[/^[\!\$]./] when "dervvulfman", "dervv", "derv" sign = $game_system.windowskin[/^[\!\$]./] when "pk8", "punk", "punkid89" sign = $game_system.windowskin_name[/^[\!\$]./] end if sign == nil or (sign != nil and sign.include?("$")) # Converts XP's background to VX new_windowskin.stretch_blt(Rect.new(0, 0, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) end if sign != nil and (sign.include?("$") or sign.include?("!")) # Converts XP's background to VX pattern new_windowskin.stretch_blt(Rect.new(0, 64, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) end else case PK8::Windowskin_Conversion::Apply when 0, "top", "stretch", "background", "bg" # Converts XP's background to VX new_windowskin.stretch_blt(Rect.new(0, 0, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) when 1, "bottom", "tile", "tiled", "pattern" # Converts XP's background to VX pattern new_windowskin.stretch_blt(Rect.new(0, 64, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) when 2, "all", "whole" new_windowskin.stretch_blt(Rect.new(0, 0, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) new_windowskin.stretch_blt(Rect.new(0, 64, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) end end new_windowskin.blt(64, 0, self.windowskin, Rect.new(128, 0, 64, 96)) for i in 0...PK8::Windowskin_Conversion::Colors.size column, row = i*8%64, ((i/8).abs)*8 new_windowskin.fill_rect(64 + column, 96 + row, 8, 8, Color.new( *PK8::Windowskin_Conversion::Colors[i])) end self.windowskin = new_windowskin.clone new_windowskin.dispose end end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update pk8_xpwindowskin_update if PK8::Windowskin_Conversion::Switch == true if self.windowskin.width == 192 and self.windowskin.height == 128 if PK8::Windowskin_Conversion::Compatibility != false new_windowskin = Bitmap.new(128, 128) case PK8::Windowskin_Conversion::Compatibility when "woratana", "wora", "worale" sign = $game_system.skin[/^[\!\$]./] when "dervvulfman", "dervv", "derv" sign = $game_system.windowskin[/^[\!\$]./] when "pk8", "punk", "punkid89" sign = $game_system.windowskin_name[/^[\!\$]./] end if sign == nil or (sign != nil and sign.include?("$")) # Converts XP's background to VX new_windowskin.stretch_blt(Rect.new(0, 0, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) end if sign != nil and (sign.include?("$") or sign.include?("!")) # Converts XP's background to VX pattern new_windowskin.stretch_blt(Rect.new(0, 64, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) end new_windowskin.blt(64, 0, self.windowskin, Rect.new(128, 0, 64, 96)) for i in 0...PK8::Windowskin_Conversion::Colors.size column, row = i*8%64, ((i/8).abs)*8 new_windowskin.fill_rect(64 + column, 96 + row, 8, 8, Color.new( *PK8::Windowskin_Conversion::Colors[i])) end self.windowskin = new_windowskin.clone new_windowskin.dispose end end end end end Also two things... (1) I have my character start at 9999 HP, so is there a way to change how many hearts appear? (2) Is there a way to turn the hearts display on/off? Share this post Link to post Share on other sites
PyrO17 17 Posted April 22, 2013 (edited) 1) yes, with hp_per_heart, i set the default to 4 but you can change it to whatever you like. 2) atleast not yet. and i would have to see why that script conflicts with the hud the error occured because i set the windowskin to nil. =begin RMXP to RMVX (Ace) Windowskin Converter v1.0.4 by PK8 Created: 5/1/2012 Modified: 6/12/2012 ────────────────────────────────────────────────────────────────────────────── ■Author's Notes I was in yet another experimental kind of mood and decided to script this. Mainly inspired by a web-based windowskin converter I wanted to do for my old site. ────────────────────────────────────────────────────────────────────────────── ■Introduction This script will take whatever XP windowskin you give it and mould it into a windowskin that would fit right in with RPG Maker VX in-game. ────────────────────────────────────────────────────────────────────────────── ■Features o Very plug and play. Add this script in, change your windowskin to an XP windowskin, edit a couple of settings, and there you go! ────────────────────────────────────────────────────────────────────────────── ■Methods Aliased o Window_Base.initialize o Window_Base.update ────────────────────────────────────────────────────────────────────────────── ■Changelog (MM/DD/YYYY) v1 (05/01/2012): Initial release. v1.0.1 (05/02/2012): I removed a setting. Instead of setting which area would the script copy over to the bitmap, it would copy certain areas depending on the filename. (Applies to XP) v1.0.2 (05/03/2012): Disposes the new_windowskin bitmap after it's done generating the converted skin. v1.0.3 (05/05/2012): Added a compatibility setting for my windowskin script, took out the compatibility flag setting, and added a switch setting. v1.0.4 (06/12/2012): Reduced the code by a couple of lines. ────────────────────────────────────────────────────────────────────────────── ■Importing RPG Maker XP Windowskins o This script has been made to be used along with other windowskin changing scripts. To allow this script to be used along with other windowskin changers, set the Compatibility setting to anything other than false. o If the windowskin doesn't have a "$" or a "!" in its filename... It will apply the windowskin's wallpaper onto the background. o If the windowskin has a "$" in its filename It will apply the windowskin's wallpaper onto the background and pattern. o If the windowskin has a "!" in its filename It will apply the windowskin's wallpaper onto the pattern. =end #============================================================================== # ** Configuration #============================================================================== module PK8 class Windowskin_Conversion #-------------------------------------------------------------------------- # * Do not modify #-------------------------------------------------------------------------- Colors = [] #-------------------------------------------------------------------------- # * General Settings #-------------------------------------------------------------------------- # Enable/Disable the script. Switch = true # 0/"Top"/"Stretch"/"Background"/"BG" # 1/"Bottom"/"Tile"/"Tiled"/"Pattern" # 2/"Whole"/"All" Apply = 0 # Which windowskin changer are you using? # Values allowed: "woratana", "dervvulfman", "pk8", false Compatibility = false #-------------------------------------------------------------------------- # * Colors #-------------------------------------------------------------------------- Colors[0] = [255, 255, 255] # Normal Text Color Colors[1] = [32 , 160, 214] Colors[2] = [255, 120, 76] Colors[3] = [102, 204, 64] Colors[4] = [153, 204, 255] Colors[5] = [204, 192, 255] Colors[6] = [255, 255, 160] Colors[7] = [128, 128, 128] Colors[8] = [192, 192, 192] Colors[9] = [32 , 128, 204] Colors[10] = [255, 56 , 16] Colors[11] = [0 , 160, 16] Colors[12] = [64 , 154, 222] Colors[13] = [160, 152, 255] Colors[14] = [255, 204, 32] Colors[15] = [0 , 0 , 0] Colors[16] = [132, 170, 255] # System Text Color Colors[17] = [255, 255, 64] # Crisis Color Colors[18] = [255, 32 , 32] # Knockout Color Colors[19] = [32 , 32 , 64] # Gauge Back Color Colors[20] = [224, 128, 64] # HP Gauge Color 1 Colors[21] = [240, 192, 64] # HP Gauge Color 2 Colors[22] = [64 , 128, 192] # MP Gauge Color 1 Colors[23] = [64 , 192, 240] # MP Gauge Color 2 / MP Cost Color Colors[24] = [128, 255, 128] # Power Up Color Colors[25] = [192, 128, 128] # Power Down Color Colors[26] = [128, 128, 255] Colors[27] = [255, 128, 255] Colors[28] = [0 , 160, 64] # TP Gauge Color 1 Colors[29] = [0 , 224, 96] # TP Gauge Color 2 / TP Cost Color Colors[30] = [160, 96 , 224] Colors[31] = [192, 128, 255] #-------------------------------------------------------------------------- # * Do not modify #-------------------------------------------------------------------------- Apply = Apply.downcase if Apply.is_a?(String) Compatibility = Compatibility.downcase if Compatibility.is_a?(String) end end #============================================================================== # ** Window_Base #------------------------------------------------------------------------------ # This class is for all in-game windows. #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- unless method_defined?(:pk8_xpwindowskin_initialize) alias_method(:pk8_xpwindowskin_initialize, :initialize) alias_method(:pk8_xpwindowskin_update, :update) end #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(*args) pk8_xpwindowskin_initialize(*args) if PK8::Windowskin_Conversion::Switch == true if self.windowskin.width == 192 and self.windowskin.height == 128 new_windowskin = Bitmap.new(128, 128) if PK8::Windowskin_Conversion::Compatibility != false case PK8::Windowskin_Conversion::Compatibility when "woratana", "wora", "worale" sign = $game_system.skin[/^[\!\$]./] when "dervvulfman", "dervv", "derv" sign = $game_system.windowskin[/^[\!\$]./] when "pk8", "punk", "punkid89" sign = $game_system.windowskin_name[/^[\!\$]./] end if sign == nil or (sign != nil and sign.include?("$")) # Converts XP's background to VX new_windowskin.stretch_blt(Rect.new(0, 0, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) end if sign != nil and (sign.include?("$") or sign.include?("!")) # Converts XP's background to VX pattern new_windowskin.stretch_blt(Rect.new(0, 64, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) end else case PK8::Windowskin_Conversion::Apply when 0, "top", "stretch", "background", "bg" # Converts XP's background to VX new_windowskin.stretch_blt(Rect.new(0, 0, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) when 1, "bottom", "tile", "tiled", "pattern" # Converts XP's background to VX pattern new_windowskin.stretch_blt(Rect.new(0, 64, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) when 2, "all", "whole" new_windowskin.stretch_blt(Rect.new(0, 0, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) new_windowskin.stretch_blt(Rect.new(0, 64, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) end end new_windowskin.blt(64, 0, self.windowskin, Rect.new(128, 0, 64, 96)) for i in 0...PK8::Windowskin_Conversion::Colors.size column, row = i*8%64, ((i/8).abs)*8 new_windowskin.fill_rect(64 + column, 96 + row, 8, 8, Color.new( *PK8::Windowskin_Conversion::Colors[i])) end self.windowskin = new_windowskin.clone new_windowskin.dispose end end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update pk8_xpwindowskin_update if !windowskin return end if PK8::Windowskin_Conversion::Switch == true if self.windowskin.width == 192 and self.windowskin.height == 128 if PK8::Windowskin_Conversion::Compatibility != false new_windowskin = Bitmap.new(128, 128) case PK8::Windowskin_Conversion::Compatibility when "woratana", "wora", "worale" sign = $game_system.skin[/^[\!\$]./] when "dervvulfman", "dervv", "derv" sign = $game_system.windowskin[/^[\!\$]./] when "pk8", "punk", "punkid89" sign = $game_system.windowskin_name[/^[\!\$]./] end if sign == nil or (sign != nil and sign.include?("$")) # Converts XP's background to VX new_windowskin.stretch_blt(Rect.new(0, 0, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) end if sign != nil and (sign.include?("$") or sign.include?("!")) # Converts XP's background to VX pattern new_windowskin.stretch_blt(Rect.new(0, 64, 64, 64), self.windowskin, Rect.new(0, 0, 128, 128)) end new_windowskin.blt(64, 0, self.windowskin, Rect.new(128, 0, 64, 96)) for i in 0...PK8::Windowskin_Conversion::Colors.size column, row = i*8%64, ((i/8).abs)*8 new_windowskin.fill_rect(64 + column, 96 + row, 8, 8, Color.new( *PK8::Windowskin_Conversion::Colors[i])) end self.windowskin = new_windowskin.clone new_windowskin.dispose end end end end end this is now a fixed version that skips the update on the window if the window has no windowskin. Edited April 22, 2013 by PyrO17 Share this post Link to post Share on other sites
Sievnn 14 Posted April 22, 2013 Could you deliver one that does need a switch to enabled? Share this post Link to post Share on other sites
PyrO17 17 Posted April 22, 2013 module Cache #-------------------------------------------------------------------------- # * Get Hud Graphic #-------------------------------------------------------------------------- def self.hud(filename, hue=0) load_bitmap("Graphics/System/Hud/", filename, hue) end end class ZeldaHearts < Window_Base #-------------------------------------------------------------------------- # * Changeable Area #-------------------------------------------------------------------------- def switch 1 end def hud_x 0 end def hud_y 0 end def hud_width 400 end def hud_height 240 end def heart_file "hearts.png" end def heart_width 24 end def heart_padding -10 end def heart_rowheight -10 end def heart_row 10 end def hp_per_heart 4 end def heart_pieces 4 end #-------------------------------------------------------------------------- # * Fixed Area #-------------------------------------------------------------------------- def initialize super(hud_x, hud_y, hud_width, hud_height) self.windowskin = nil @bitmap = Cache.hud(heart_file) @switch = $game_switches[switch] if @switch draw_hearts end end def draw_hearts @lhearts = @hearts @lmaxHearts = @maxHearts @hearts = calc_hearts(get_hp) @maxHearts = calc_hearts(get_maxhp).to_i fullHearts = @hearts.to_i partHearts = @hearts - fullHearts i = 0 if fullHearts for i in 0..@maxHearts-1 do if i < fullHearts get_heart_image(i, heart_pieces) elsif i == fullHearts get_heart_image(i, (partHearts*heart_pieces).round(0)) else get_heart_image(i,0) end end end end def get_heart_image(heartIndex, fileIndex) rect = Rect.new(fileIndex * heart_width, 0, @bitmap.width/(heart_pieces+1), @bitmap.height) contents.blt(heartIndex.modulo(heart_row)*(heart_width+heart_padding), (heartIndex/heart_row)*(@bitmap.height+heart_rowheight), @bitmap, rect, 255) end def get_hp $game_party.members[0].hp end def get_maxhp $game_party.members[0].mhp end def calc_hearts(hp) Float hearts = hp.to_f / hp_per_heart hearts.round(2) end def refresh self.contents.clear contents.clear draw_hearts end def update super if @switch refresh end end def change if @switch != $game_switches[switch] if $game_switches[switch] update else contents.clear self.contents.clear end @switch = $game_switches[switch] end if @lhearts == @hearts && @lmaxHearts == @maxHearts return else update end end def dispose super @bitmap.dispose end end class Scene_Map < Scene_Base alias start_window start alias term_window terminate alias update_window update def start start_window @hearthud = ZeldaHearts.new update end def terminate @hearthud.dispose term_window end def update update_window @hearthud.change end end there you go now you can set a switch and you can set the position of the hud easily too. 1 Share this post Link to post Share on other sites
Deej 19 Posted April 23, 2013 module Cache #-------------------------------------------------------------------------- # * Get Hud Graphic #-------------------------------------------------------------------------- def self.hud(filename, hue=0) load_bitmap("Graphics/System/Hud/", filename, hue) end end class ZeldaHearts < Window_Base #-------------------------------------------------------------------------- # * Changeable Area #-------------------------------------------------------------------------- def hud_width 400 end def hud_height 240 end def heart_file "hearts.png" end def heart_width 24 end def heart_padding -10 end def heart_rowheight -10 end def heart_row 5 end def hp_per_heart 4 end def heart_pieces 4 end #-------------------------------------------------------------------------- # * Fixed Area #-------------------------------------------------------------------------- def initialize super(0, 0, hud_width, hud_height) self.windowskin = nil @bitmap = Cache.hud(heart_file) draw_hearts end def draw_hearts @lhearts = @hearts @lmaxHearts = @maxHearts @hearts = calc_hearts(get_hp) @maxHearts = calc_hearts(get_maxhp).to_i fullHearts = @hearts.to_i partHearts = @hearts - fullHearts i = 0 if fullHearts for i in 0..@maxHearts-1 do if i < fullHearts get_heart_image(i, heart_pieces) elsif i == fullHearts get_heart_image(i, (partHearts*heart_pieces).round(0)) else get_heart_image(i,0) end end end end def get_heart_image(heartIndex, fileIndex) rect = Rect.new(fileIndex * heart_width, 0, @bitmap.width/(heart_pieces+1), @bitmap.height) contents.blt(heartIndex.modulo(heart_row)*(heart_width+heart_padding), (heartIndex/heart_row)*(@bitmap.height+heart_rowheight), @bitmap, rect, 255) end def get_hp $game_party.members[0].hp end def get_maxhp $game_party.members[0].mhp end def calc_hearts(hp) Float hearts = hp.to_f / hp_per_heart hearts.round(2) end def refresh self.contents.clear contents.clear draw_hearts end def update super refresh end def change if @lhearts == @hearts && @lmaxHearts == @maxHearts return else update end end def dispose super @bitmap.dispose end end class Scene_Map < Scene_Base alias start_window start alias term_window terminate alias update_window update def start start_window @hearthud = ZeldaHearts.new update end def terminate @hearthud.dispose term_window end def update update_window @hearthud.change end end Here it is with a example heart file. The file should go into Graphics/System/Hud/ . I wish everyone fun with it Awesome! Nifty little script to learn from. It's a lot more simplistic then I first thought it would be. Good job Share this post Link to post Share on other sites
Devildimos 1 Posted June 1, 2013 Hey,I think the example heart file is missing. I can't see it atleast. Can some one send it to me or tell me how I should creat it with Gimp Thanks <3 Share this post Link to post Share on other sites
+ DarthVollis 59 Posted June 2, 2013 module Cache #-------------------------------------------------------------------------- # * Get Hud Graphic #-------------------------------------------------------------------------- def self.hud(filename, hue=0) load_bitmap("Graphics/System/Hud/", filename, hue) end end class ZeldaHearts < Window_Base #-------------------------------------------------------------------------- # * Changeable Area #-------------------------------------------------------------------------- def hud_width 400 end def hud_height 240 end def heart_file "hearts.png" end def heart_width 24 end def heart_padding -10 end def heart_rowheight -10 end def heart_row 5 end def hp_per_heart 4 end def heart_pieces 4 end #-------------------------------------------------------------------------- # * Fixed Area #-------------------------------------------------------------------------- def initialize super(0, 0, hud_width, hud_height) self.windowskin = nil @bitmap = Cache.hud(heart_file) draw_hearts end def draw_hearts @lhearts = @hearts @lmaxHearts = @maxHearts @hearts = calc_hearts(get_hp) @maxHearts = calc_hearts(get_maxhp).to_i fullHearts = @hearts.to_i partHearts = @hearts - fullHearts i = 0 if fullHearts for i in 0..@maxHearts-1 do if i < fullHearts get_heart_image(i, heart_pieces) elsif i == fullHearts get_heart_image(i, (partHearts*heart_pieces).round(0)) else get_heart_image(i,0) end end end end def get_heart_image(heartIndex, fileIndex) rect = Rect.new(fileIndex * heart_width, 0, @bitmap.width/(heart_pieces+1), @bitmap.height) contents.blt(heartIndex.modulo(heart_row)*(heart_width+heart_padding), (heartIndex/heart_row)*(@bitmap.height+heart_rowheight), @bitmap, rect, 255) end def get_hp $game_party.members[0].hp end def get_maxhp $game_party.members[0].mhp end def calc_hearts(hp) Float hearts = hp.to_f / hp_per_heart hearts.round(2) end def refresh self.contents.clear contents.clear draw_hearts end def update super refresh end def change if @lhearts == @hearts && @lmaxHearts == @maxHearts return else update end end def dispose super @bitmap.dispose end end class Scene_Map < Scene_Base alias start_window start alias term_window terminate alias update_window update def start start_window @hearthud = ZeldaHearts.new update end def terminate @hearthud.dispose term_window end def update update_window @hearthud.change end end Here it is with a example heart file. The file should go into Graphics/System/Hud/ . I wish everyone fun with it I know it says the heart file here, but where is it? Share this post Link to post Share on other sites
+ Novem 344 Posted June 3, 2013 There used to be a picture there, if someone else has downloaded the heart file, do you mind re-posting it? After all, something is obviously wrong with PyrO's account. I mean, I don't think he's banned, but I can't even click into his profile... Share this post Link to post Share on other sites
Grotaiche 9 Posted June 3, 2013 I found this script a couple weeks ago but the file was also missing. I have adapted it to my own needs (which differ a bit). What the original script does, in essence, is get the image and lays a transparent rectangle over it to build an "incomplete" heart. So all you need is a simple heart image (I'd recommend something very basic). I can post my own script and image files if you wish but it's less practical than Pyro's (there can only be 4 parts in a heart using my script, while it's variable using Pyro's). You can see how it looks like here. Share this post Link to post Share on other sites
Gambit. 84 Posted June 3, 2013 I don't know what image this script was intended for, but try this. It's from the link in the OP. It might be what the Ace script was based off of. Share this post Link to post Share on other sites
AeghtyAteKees 11 Posted June 3, 2013 I found this script a couple weeks ago but the file was also missing. I have adapted it to my own needs (which differ a bit). What the original script does, in essence, is get the image and lays a transparent rectangle over it to build an "incomplete" heart. So all you need is a simple heart image (I'd recommend something very basic). I can post my own script and image files if you wish but it's less practical than Pyro's (there can only be 4 parts in a heart using my script, while it's variable using Pyro's). You can see how it looks like here. Your screenshot looks great, and I'm only interested in hearts/4 anyway. I would love to use the script. Share this post Link to post Share on other sites
Grotaiche 9 Posted June 4, 2013 Sure, I'll post it later when I get back home Share this post Link to post Share on other sites
sirbilly 10 Posted June 4, 2013 There used to be a picture there, if someone else has downloaded the heart file, do you mind re-posting it? Here is the image file 2 Share this post Link to post Share on other sites
+ DarthVollis 59 Posted June 5, 2013 @sirbily - Thank you for posting the image!!! Share this post Link to post Share on other sites
Grotaiche 9 Posted June 5, 2013 OK, sorry for the delay, here's my script : http://pastebin.com/mjGGvD2d I use 5 files instead of only 1, that's because I didn't get how the original script worked. The images can be found here. Just name them hearts0,png, hearts1.png, etc... There's no real added value to use my script rather than Pyro17's but there you go. If you wish to use Pyro's script but with my images, simply merge the 5 files into 1 and adjust the values accordingly. Share this post Link to post Share on other sites
AeghtyAteKees 11 Posted June 6, 2013 There doesn't seem to be the switch feature here. Could you add that please? Share this post Link to post Share on other sites