hello i need i script for a HUD.
i have the template and the hud destighn i just need the script.
here is the HUD template
http://www.sendspace.com/file/c9oeqj
there should be a HP and MP bar now.
i would be greatful if some one could do this for me.
Ookay. That's a lot of work you did there, but do I use the same images for SP too?
sorry i uploaded the wrong forlder :^_^':
iv add the correct download link now in the last post
Okay, here's the script:
class HUD < Sprite
def initialize(vp=nil)
@hp = @mp = 0
@hp_sprite = Sprite.new(vp)
@mp_sprite = Sprite.new(vp)
@hp_sprite.bitmap = RPG::Cache.picture("HUD Folder/HP #{@hp}%")
@hp_sprite.bitmap = RPG::Cache.picture("HUD Folder/MP #{@mp}%")
super(vp)
self.bitmap = RPG::Cache.picture('HUD Folder/HUD')
self.x = 10 # Change x position here
self.y = 10 # Change y position here
end
def x=(xx)
super(x)
@hp_sprite.x = @mp_sprite.x = xx
end
def y=(yy)
super(y)
@hp_sprite.y = @mp_sprite.y = yy
end
def z=(zz)
@hp_sprite.z = @mp_sprite.z = zz - 0.1
super(z)
end
def opacity=(oo)
super(oo)
@hp_sprite.opacity = @mp_sprite.opacity = oo
end
def visible=(val)
super(val)
@hp_sprite.visible = @mp_sprite.visible = val
end
def update
super
@hp_sprite.update
@mp_sprite.update
return unless $game_party.actors.size > 0
lead_actor = $game_party.actors[0]
hp_percent = lead_actor.hp * 100 / lead_actor.maxhp
mp_percent = lead_actor.sp * 100 / lead_actor.maxsp
if @hp != hp_percent
@hp = hp_percent
@hp_sprite.bitmap = RPG::Cache.picture("HUD Folder/HP #{@hp}%")
end
if @mp != mp_percent
@mp = mp_percent
@mp_sprite.bitmap = RPG::Cache.picture("HUD Folder/MP #{@mp}%")
end
end
def dispose
super
@hp_sprite.dispose
@mp_sprite.dispose
end
end
class Spriteset_Map
alias fts_shadonking_hud_spriteset_map_init initialize
def initialize
fts_shadonking_hud_spriteset_map_init
@hud = HUD.new(@viewport2)
end
alias fts_shadonking_hud_spriteset_map_upd update
def update
fts_shadonking_hud_spriteset_map_upd
@hud.update if @hud
end
alias fts_shadonking_hud_spriteset_map_dispose dispose
def dispose
fts_shadonking_hud_spriteset_map_dispose
@hud.dispose if @hud
end
end
The pictures you provided couldn't be used because of the pink BG. The pink part should be transparent. So unless you want to import every image through RMXP, you should make the pics transparent. I did that for you, here are the new pics (http://www.sendspace.com/file/afh1er). You should place the pictures in this directory:
"Graphics/Pictures/HUD Folder"
ok thanks just one last thing, the bars do not line up with the hud. where is the part of the script that can change there location
edit
its ok i found it and it looks great. thanks
powersup
Quoteok thanks just one last thing, the bars do not line up with the hud. where is the part of the script that can change there location
You can change the whole HUD's position by:
Quote
class HUD < Sprite
def initialize(vp=nil)
@hp = @mp = 0
@hp_sprite = Sprite.new(vp)
@mp_sprite = Sprite.new(vp)
@hp_sprite.bitmap = RPG::Cache.picture("HUD Folder/HP #{@hp}%")
@hp_sprite.bitmap = RPG::Cache.picture("HUD Folder/MP #{@mp}%")
super(vp)
self.bitmap = RPG::Cache.picture('HUD Folder/HUD')
self.x = 10 # Change x position here
self.y = 10 # Change y position here
end
Oops, I just spotted a typo. Here's the corrected version:
class HUD < Sprite
def initialize(vp=nil)
@hp = @mp = 0
@hp_sprite = Sprite.new(vp)
@mp_sprite = Sprite.new(vp)
@hp_sprite.bitmap = RPG::Cache.picture("HUD Folder/HP #{@hp}%")
@hp_sprite.bitmap = RPG::Cache.picture("HUD Folder/MP #{@mp}%")
super(vp)
self.bitmap = RPG::Cache.picture('HUD Folder/HUD')
self.x = 10 # Change x position here
self.y = 10 # Change y position here
end
def x=(xx)
super(xx)
@hp_sprite.x = @mp_sprite.x = xx
end
def y=(yy)
super(yy)
@hp_sprite.y = @mp_sprite.y = yy
end
def z=(zz)
super(zz)
@hp_sprite.z = @mp_sprite.z = zz - 0.1
end
def opacity=(oo)
super(oo)
@hp_sprite.opacity = @mp_sprite.opacity = oo
end
def visible=(val)
super(val)
@hp_sprite.visible = @mp_sprite.visible = val
end
def update
super
@hp_sprite.update
@mp_sprite.update
return unless $game_party.actors.size > 0
lead_actor = $game_party.actors[0]
hp_percent = lead_actor.hp * 100 / lead_actor.maxhp
mp_percent = lead_actor.sp * 100 / lead_actor.maxsp
if @hp != hp_percent
@hp = hp_percent
@hp_sprite.bitmap = RPG::Cache.picture("HUD Folder/HP #{@hp}%")
end
if @mp != mp_percent
@mp = mp_percent
@mp_sprite.bitmap = RPG::Cache.picture("HUD Folder/MP #{@mp}%")
end
end
def dispose
super
@hp_sprite.dispose
@mp_sprite.dispose
end
end
class Spriteset_Map
alias fts_shadonking_hud_spriteset_map_init initialize
def initialize
fts_shadonking_hud_spriteset_map_init
@hud = HUD.new(@viewport2)
end
alias fts_shadonking_hud_spriteset_map_upd update
def update
fts_shadonking_hud_spriteset_map_upd
@hud.update if @hud
end
alias fts_shadonking_hud_spriteset_map_dispose dispose
def dispose
fts_shadonking_hud_spriteset_map_dispose
@hud.dispose if @hud
end
end
Enjoy ^_^
QuoteOops, I just spotted a typo.
Thank you for saying that Fantasist. I thought I had contracted some rare kind of bug that makes me screw up anything I script thanks to a few letters being wrong or forgotten. Nice to know that it's not uncommon!
Also, nice HUD.
lol! Check the version histories of Bliz's scripts, there are many typos, errors are common ^.^
yeh every one makes mistakes no mater how good they are at what they do
A professor of mine said once "You are an expert in your area when you know all the mistakes that can be made and when you know how to fix them immediately or even avoid them." Well, not many people are experts in typing aka dactylography. :xD:
also the only way to become an expert is to learn from your mistakes.