Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: G_G on May 12, 2009, 05:34:41 pm

Title: Need Help With Hud Please
Post by: G_G on May 12, 2009, 05:34:41 pm
Ok so anyways I wanted to add another bar to the HUD. Its the actors Energy. I have the energy setup, when you attack it takes away some, skills and items etc even when you're running it takes away energy. Thats all setup now my only problem is actually adding a bar now.

The only time you get energy is restoring is when you're just walking.

Now I tried doing it but I failed miserably  :^_^':

Ok so I need help please just help me get started on doing it please?
Title: Re: Need Help With Hud Please
Post by: Aqua on May 12, 2009, 05:41:33 pm
Post the HUD script you're using for the other stats.

Unless... you just want the HUD to be only the energy...
Then give dimensions and specifics on the layout.
Title: Re: Need Help With Hud Please
Post by: G_G on May 12, 2009, 05:44:52 pm
First of all I deleted the script after it was a complete failure. But heres the method I have for drawing the energy

I just copied the draw_hp and replaced all the .hp with energy


def draw_energy
    # set current variables
    @energy, @maxenergy = actor.energy, actor.maxenergy
    # set fill rate
    rate = (@maxenergy > 0 ? @energy.to_f / @maxhp : 0)
    # draw gradient bar
    self.bitmap.gradient_bar_hud(@energy_x+32, @energy_y+3, 114, rate, 'hud_green_bar', 1)
    # set font color depending on how many HP left
    self.bitmap.font.color = @hp == 0 ? knockout_color :
        @energy <= @maxenergy / 4 ? crisis_color : normal_color
    # draw HP
    self.bitmap.draw_text_full(@energy_x+38, @energy_y, 48, 20, @energy.to_s, 2)
    # set color
    self.bitmap.font.color = normal_color
    # draw "/"
    self.bitmap.draw_text_full(@energy_x+86, @energy_y, 12, 20, '/', 1)
    # draw max HP
    self.bitmap.draw_text_full(@energy_x+98, @energy_y, 48, 20, @maxenergy.to_s)
  end


This is the new method I made I havent changed the x and y locations is all.
Title: Re: Need Help With Hud Please
Post by: Aqua on May 12, 2009, 05:48:13 pm
I'm guessing this is Blizz-ABS Hud... since... you didn't say...

Anyway... did you make a new class when you tried or editted the Blizz-ABS's HUD class?
Title: Re: Need Help With Hud Please
Post by: G_G on May 12, 2009, 05:49:57 pm
What I did was copy the class HUD < Sprite

and pasted it in a new slot below babs part 3. What I was able to do was change the height of the hud and the Outline draw for the bar but I couldnt get the bar to show.
Title: Re: Need Help With Hud Please
Post by: Aqua on May 12, 2009, 05:52:14 pm
Line 5

rate = (@maxenergy > 0 ? @energy.to_f / @maxhp : 0)


Should be
rate = (@maxenergy > 0 ? @energy.to_f / @maxenergy : 0)


Mmm... if that doesn't work... then I dunno without having to open up RMXP XD
Title: Re: Need Help With Hud Please
Post by: G_G on May 12, 2009, 06:09:14 pm
WEll if I only hadnt deleted that other script. Do you have to call the method in order for it to draw it? Pretty sure you do just not sure where.