HUD

By Rmxp

HUD

A HUD is a couple of message boxes that show you your Health, Sp etc..

Here is the script! Insert in a new section above main called ‘HUD’

class Scene_Map

alias raz_hud_main main
alias raz_hud_update update

def main
@size = $game_party.actors.size
raz_hud_main
@hud_window.dispose
@hud_dummy[0].dispose
@hud_dummy[1].dispose
@hud_dummy[2].dispose
@hud_dummy[3].dispose
end

def update
if @size != $game_party.actors.size
@hud_window.refresh
show_window
end
if @hud == true
else
main_window
end

@hud_window.update
raz_hud_update
end

def show_window
@size = $game_party.actors.size
if $game_party.actors[0] == nil
@hud_dummy[0].visible = false
else
@hud_dummy[0].visible = true
end

if $game_party.actors[1] == nil
@hud_dummy[1].visible = false
else
@hud_dummy[1].visible = true
end

if $game_party.actors[2] == nil
@hud_dummy[2].visible = false
else
@hud_dummy[2].visible = true
end

if $game_party.actors[3] == nil
@hud_dummy[3].visible = false
else
@hud_dummy[3].visible = true
end
end

def main_window
@opacity = 200
@hud_dummy = []
@hud_dummy[0] = Window_Base.new(0, 372,160, 108)
@hud_dummy[1] = Window_Base.new(160, 372,160, 108)
@hud_dummy[2] = Window_Base.new(320, 372,160, 108)
@hud_dummy[3] = Window_Base.new(480, 372,160, 108)
@hud_dummy[0].opacity = @opacity
@hud_dummy[1].opacity = @opacity
@hud_dummy[2].opacity = @opacity
@hud_dummy[3].opacity = @opacity
@hud_window = Window_HUD.new
if $game_party.actors[0] == nil
@hud_dummy[0].visible = false
else
@hud_dummy[0].visible = true
end

if $game_party.actors[1] == nil
@hud_dummy[1].visible = false
else
@hud_dummy[1].visible = true
end

if $game_party.actors[2] == nil
@hud_dummy[2].visible = false
else
@hud_dummy[2].visible = true
end

if $game_party.actors[3] == nil
@hud_dummy[3].visible = false
else
@hud_dummy[3].visible = true
end
@hud = true
end

def turn_hud_off
for i in 0…$game_party.actors.size
@hud_window.visible, @hud_dummy[i].visible = false, false
end
return
end

def turn_hud_on
for i in 0…$game_party.actors.size
@hud_window.visible, @hud_dummy[i].visible = true, true
end
return
end

end

class Window_HUD < Window_Base
def initialize
super(0, 0, 800, 600)
self.contents = Bitmap.new(width – 32, height – 32)
self.opacity = 0
unless $game_party.actors[0] == nil
@old_hp1 = $game_party.actors[0].hp
@old_sp1 = $game_party.actors[0].sp
@old_exp1 = $game_party.actors[0].now_exp
end
unless $game_party.actors[1] == nil
@old_hp2 = $game_party.actors[1].hp
@old_sp2 = $game_party.actors[1].sp
@old_exp2 = $game_party.actors[1].now_exp
end
unless $game_party.actors[2] == nil
@old_hp3 = $game_party.actors[2].hp
@old_sp3 = $game_party.actors[2].sp
@old_exp3 = $game_party.actors[2].now_exp
end
unless $game_party.actors[3] == nil
@old_hp4 = $game_party.actors[3].hp
@old_sp4 = $game_party.actors[3].sp
@old_exp4 = $game_party.actors[3].now_exp
end

refresh
end

def refresh
self.contents.clear
for i in 0…$game_party.actors.size
actor = $game_party.actors[i]
x = 25 + i * 160
self.contents.font.size = 21
draw_actor_graphic(actor, x – 15, 445)
self.contents.font.color = normal_color
self.contents.draw_text(x – 25, 360, 100, 32, actor.name)
draw_slant_bar(x + 8, 396, actor.hp, actor.maxhp, width = 100, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(155, 155, 60, 255))
draw_slant_bar(x + 8, 416, actor.sp, actor.maxsp, width = 100, height = 6, bar_color = Color.new(0, 0, 150, 255), end_color = Color.new(60, 155, 155, 255))
unless actor.level == 99
draw_slant_bar(x + 8, 436, actor.now_exp, actor.next_exp, width = 100, height = 6, bar_color = Color.new(0, 150, 0, 255), end_color = Color.new(60, 255, 60, 255))
else
draw_slant_bar(x + 8, 436, 1, 1, width = 100, height = 6, bar_color = Color.new(0, 150, 0, 255), end_color = Color.new(60, 255, 60, 255))
end
self.contents.font.size = 16
draw_actor_state(actor, x + 45, 360)
self.contents.font.color = normal_color
self.contents.font.bold = true
self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(x + 16, 382, 100, 32, “#{actor.hp}” + “/” + “#{actor.maxhp}”, 1)
self.contents.font.color = actor.sp == 0 ? crisis_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(x + 16, 402, 100, 32, “#{actor.sp}” + “/” + “#{actor.maxsp}”, 1)
self.contents.font.color = system_color
self.contents.font.size = 20
self.contents.font.bold = false
self.contents.draw_text(x, 384, 50, 32, $data_system.words.hp)
self.contents.draw_text(x, 404, 50, 32, $data_system.words.sp)
self.contents.draw_text(x, 424, 50, 32, “Exp”)
end
end

def update
super
unless $game_party.actors[0] == nil
if @old_hp1 != $game_party.actors[0].hp or @old_sp1 != $game_party.actors[0].sp or @old_exp1 != $game_party.actors[0].now_exp
refresh
@old_hp1 = $game_party.actors[0].hp
@old_sp1 = $game_party.actors[0].sp
@old_exp1 = $game_party.actors[0].now_exp
end
end
unless $game_party.actors[1] == nil
if @old_hp2 != $game_party.actors[1].hp or @old_sp2 != $game_party.actors[1].sp or @old_exp2 != $game_party.actors[1].now_exp
refresh
@old_hp2 = $game_party.actors[1].hp
@old_sp2 = $game_party.actors[1].sp
@old_exp2 = $game_party.actors[1].now_exp
end
end
unless $game_party.actors[2] == nil
if @old_hp3 != $game_party.actors[2].hp or @old_sp3 != $game_party.actors[2].sp or @old_exp3 != $game_party.actors[2].now_exp
refresh
@old_hp3 = $game_party.actors[2].hp
@old_sp3 = $game_party.actors[2].sp
@old_exp3 = $game_party.actors[2].now_exp
end
end
unless $game_party.actors[3] == nil
if @old_hp4 != $game_party.actors[3].hp or @old_sp4 != $game_party.actors[3].sp or @old_exp4 != $game_party.actors[3].now_exp
refresh
@old_hp4 = $game_party.actors[3].hp
@old_sp4 = $game_party.actors[3].sp
@old_exp4 = $game_party.actors[3].now_exp
end
end

end
end

class Window_Base 0 ? @exp_list[@level+1] – @exp_list[@level] : 0
end
end


25 Responses to “HUD”


  1. 1 Anonymous
    January 5, 2008 at 1:32 am

    i get errors

  2. January 7, 2008 at 12:50 am

    What kind of errors? What does it say?

  3. 3 Anonymous
    January 25, 2008 at 8:42 pm

    Line 96 error for i in 0 $game_party.actors.size

  4. February 4, 2008 at 10:06 pm

    Is it possible to turn it on/off during in game?
    ~RMXP’s Reply
    Maybe with a little editing…..

  5. 5 TehN00bz
    April 13, 2008 at 8:41 pm

    Still an error in line 96…

  6. 6 A maddie which is also a saddie!
    May 22, 2008 at 6:19 pm

    I got an error on line 69. Also, fix the frigging intenting! I wager it might help to get past some of these errors you got (no offense, I’m not trying to hurt you ;))

  7. 7 man who is new in rpgxp
    October 29, 2008 at 5:02 pm

    line 96 error…
    what do i have to do?
    just delete?
    or do i have to change it???

  8. December 13, 2008 at 9:23 pm

    With the syntax errors, take all characters that are three dots in one space and make them actually three dots. Code doesn’t normally show properly with some document writers. … change to … (or three times . )
    Also, some double quotes are messed up. Replace “ and ” with ” (replace slanted quotes with straight quotes)

    Although, I still get an error on the third line from the bottom

    class Window_Base 0 ? @exp_list[@level+1] – @exp_list[@level] : 0

    the compiler claims that there is a syntax error in that line

  9. 9 Overlord
    May 9, 2009 at 11:37 am

    Lol (NOT!)
    got error in:

    self.contents = Bitmap.new(width – 32, height – 32)

  10. 10 Overlord
    May 9, 2009 at 11:40 am

    ok srry for double but fixed my prob: change the – after width and height into =.
    mayb on other lines this happens also

  11. 11 Overlord
    May 9, 2009 at 11:42 am

    darn now i got 1 in
    self.contents.font.color = actor.sp == 0 ? crisis_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color

  12. 12 turnawayplz
    July 27, 2009 at 2:14 pm

    i fixed most myself, but now i cant fix the prob overlord has

    self.contents.font.color = actor.sp == 0 ? crisis_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color

  13. 13 martin
    August 17, 2009 at 5:48 am

    eror in line 96, what i must dooo???

  14. 14 Night_Runner
    October 25, 2009 at 7:59 am

    If anyone is still interested, I’ve got it working, looks good :)

    http://www.4shared.com/file/143451335/c4f01322/Map_HUD.html

  15. 15 Jymaru
    March 10, 2010 at 11:29 am

    Broken link

  16. 16 DT3
    March 13, 2010 at 12:49 am

    Get error at line 162:
    self.contents.font.color = actor.sp == 0 ? crisis_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    Someway to fix this?

  17. April 18, 2013 at 2:57 am

    That was both of those exciting at the same time as insightful!
    Thanks for sharing your feelings with us.

  18. June 27, 2013 at 6:04 am

    You never know when you find out what caused it in a
    confused state of mind in deciding, which equipment will suit him the best.

    One, get a FREE Dan Yeager who plays Leatherface in the mouth on the web
    and are in foreign languages. If this is to plan ahead.

  19. July 29, 2013 at 4:33 am

    Riot Points may unlock rune pages, champions along with various boosts (experience and influence points).
    Nonetheless, Riot Points cannot be spent on runes.

    Riot Points may possibly be acquired for free by various routines (like as mentioning friends to League of Legends).

    The actual League of Legends Store permits Summoners to
    obtain more selections thru Riot Points (RP) and also Influence Points (IP).
    Riot Points must often be obtained utilizing real money, although Influence Points are usually earned by participating in the video
    game.

    Champions need to become revealed to you using Riot Points
    or Influence Points just before that they may always be
    played out. However, there usually are a
    number involving absolutely free champions accessible to be able to perform every full week to present summoners
    the option to test champs prior to buying them. Presently there usually are
    several champion types readily available which includes assassins, bruisers, supports, casters, junglers plus tanks.

    Comparable to masteries, runes influence gameplay in insignificant
    techniques. Runes are usually classified into Marks (offensive), Seals (shielding), Glyphs (secret) and Quintessences (utility).
    Runes ought to be revealed to you within typically the Shop and also
    it will be possible that will have more than 1 backup of a rune.
    Summoners have to organise their own runes on the exact Runebook to help advantage by these folks.
    The actual Runebook provides restricted number of slots
    for each rune type, but more rune pages can be purchased from
    sometimes Influence Points or Riot Points. Incorporating a couple of equal-tier runes provides
    a randomly rune of often the exact tier, even though merging 5
    equal-tier runes provides a higher-tier rune.
    Presently there are usually also numerous activities just
    like League of Legends in the event people are usually
    curious in attempting a various MOBA practical experience.
    If people would like for you to find out even more around just how towards attain Riot Points for League of Legends then visit, exactly how to get
    free Riot Points with regard to League of Legends.

  20. October 29, 2013 at 12:16 am

    You have made some good points there. I looked on the web to find out more about
    the issue and found most individuals will go along with
    your views on this web site.

  21. January 30, 2014 at 12:23 am

    I used to Ƅe able to fiind good iոformatiоո frօm yiur articles.

  22. January 31, 2014 at 1:10 am

    Hello there! Would you mind if I share your blog with my zynga group?
    There’s a lot of people that I think would really appreciate your
    content. Please let me know. Thanks

  23. July 7, 2014 at 9:49 am

    Hey! This is my first visit to your blog! We are a collection of volunteers and starting a new initiative in a community in the same niche.
    Your blog provided us beneficial information to work on. You have done a outstanding
    job!

  24. July 15, 2014 at 8:13 am

    If you want to get a great deal from this piece of writing then you have to apply these techniques to your won website.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.

%d bloggers like this: