[RESOLVED]HUD script request

Started by Shadonking, August 26, 2008, 06:26:43 pm

Previous topic - Next topic

Shadonking

August 26, 2008, 06:26:43 pm Last Edit: August 28, 2008, 05:18:55 am by shadonking
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.





Creator Of Music And Games
Spoiler: ShowHide
]

keywords: ShowHide
rmxp rmvx blizz-abs rpg maker xp vx abs cbs cms script tons of addons charsets autotiles HUD


come here if you have a ps3
http://forum.chaos-project.com/index.php?topic=1952.0

Fantasist

Ookay. That's a lot of work you did there, but do I use the same images for SP too?
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Shadonking

sorry i uploaded the wrong forlder :^_^':

iv add the correct download link now in the last post





Creator Of Music And Games
Spoiler: ShowHide
]

keywords: ShowHide
rmxp rmvx blizz-abs rpg maker xp vx abs cbs cms script tons of addons charsets autotiles HUD


come here if you have a ps3
http://forum.chaos-project.com/index.php?topic=1952.0

Fantasist

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. You should place the pictures in this directory:
"Graphics/Pictures/HUD Folder"
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Shadonking

August 27, 2008, 10:11:06 am #4 Last Edit: August 27, 2008, 10:20:28 am by shadonking
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





Creator Of Music And Games
Spoiler: ShowHide
]

keywords: ShowHide
rmxp rmvx blizz-abs rpg maker xp vx abs cbs cms script tons of addons charsets autotiles HUD


come here if you have a ps3
http://forum.chaos-project.com/index.php?topic=1952.0

Fantasist

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 ^_^
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




shdwlink1993

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.
Stuff I've made:




"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

Fantasist

lol! Check the version histories of Bliz's scripts, there are many typos, errors are common ^.^
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Shadonking

yeh every one makes mistakes no mater how good they are at what they do





Creator Of Music And Games
Spoiler: ShowHide
]

keywords: ShowHide
rmxp rmvx blizz-abs rpg maker xp vx abs cbs cms script tons of addons charsets autotiles HUD


come here if you have a ps3
http://forum.chaos-project.com/index.php?topic=1952.0

Blizzard

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:
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Shadonking

also the only way to become an expert is to learn from your mistakes.





Creator Of Music And Games
Spoiler: ShowHide
]

keywords: ShowHide
rmxp rmvx blizz-abs rpg maker xp vx abs cbs cms script tons of addons charsets autotiles HUD


come here if you have a ps3
http://forum.chaos-project.com/index.php?topic=1952.0