The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: IXFURU on July 13, 2011, 07:15:54 PM

Title: HUD script I editted
Post by: IXFURU on July 13, 2011, 07:15:54 PM
I saw today where ModernAlgebra suggested I post this as a script topic a LONG time ago.  So, it's late as heck, but I'm gonna add it.   Basically, it's a script written by Jens009.  I didn't write it, I repeat, I didn't write this script!   But, I did edit it so that a party of 6 could be displayed using it.  I also did away with the original 'states' inclusion in the HUD.   Here's the script:


Code: [Select]
#============================================================================
# Jens009 Simple HP/SP/State HUD
# Version 2.0
# Release Date: August 11,2008
# Description: Display an HP/SP and State HUD information in map.
# Compatibility: Should be compatible with any system
# Configuration:
#   I. Turning off the HUD in game
#       use the call script $game_system.show_hud = true/false
#           true = show HUD, false = disable HUD
#   II. Changing maximum information shown
#        look at SHOW_MAX under JCONFIG, you can change the value to show
#        how many of the actors in the party to display their information
#        by default, it is set to show only 2 actors.
#   III. Changing maximum information shown in game
#        use the call script JCONFIG::SHOW_MAX = *integer*
#        You can change the amount of actors displayed in the HUD in game.
#        simply change integer to the value you want.
#   IV.  Changing Update methods
#        if you want the HUD to always update, set ALWAYS_UPDATE_HUD to true
#        but if you want to only update the HUD whenever you want to, set
#        this to false.
#        When $game_sysyem.always_update is false, you can update the hud
#        manually in game using the call script $game_system.refresh_hud = true.
#        this will refresh the hud information once.
#        However, you can also switch between always updating the HUD and
#        only updating the hud once during in game.
#        Simply use the call script:
#           $game_sysyem.always_update = true/false
#        and to reupdate once
#           $game_system.refresh_hud = true
#
# Optimization to achieve higher FPS
#    1) Set SHOW_MAX to a low value
#    You can also:
#    2) Set $game_sysyem.always_update = false
#      2.1) Use $game_temp.refresh_hud = true to reupdate the hud manually.
#============================================================================
module JCONFIG
  SHOW_MAX = 6 # By default, show 4 actor's information
end

#======================================
# Game_System edit
#=====================================
class Game_System
  # Add new instance
  attr_accessor :refresh_hud
  attr_accessor :show_hud
  attr_accessor :always_update
  alias jens009_initialize_hud initialize
  def initialize
    # Initialize instances
    @show_hud = true
    @always_update = true
    @refresh_hud = false
    # Call default methods
    jens009_initialize_hud
  end
 
end

#=============================================================================
# Window Hud < Window_Base
# Description: Handles Information to be shown in HUD
#=============================================================================

class Window_Hud < Window_Base
#==========================
# Initialize Values
#==========================
  def initialize
    super(0,0,544,110)
    self.opacity = 0
    self.visible = false if $game_system.show_hud == false
    refresh
  end
#=========================
# Create Information
#===========================
 
  def refresh
    self.contents.clear
    @item_max = JCONFIG::SHOW_MAX
    @party_size = $game_party.members.size
      for actor in $game_party.members
        x = actor.index * 80
        y = 0
        if actor.index < @item_max
          draw_actor_information(actor, x, y)
        end
      end
    end
 
  def draw_actor_information(actor, x, y)
    draw_actor_name (actor, x, y + 0)
    draw_actor_graphic(actor, x + 15, y + 60)
    draw_actor_hp_gauge(actor, x + 30, y + 16, 38)
    draw_actor_mp_gauge(actor, x + 30, y + 26, 38)
  end
   
#================================= 
# Define Update
#====================================
  def update
    refresh
  end

end
#===============================
# Start Scene_Map edit
#===============================
class Scene_Map
  # Alias methods main, update and terminate
  alias jens009_hud_main main
  alias jens009_hud_update update
  alias jens009_hud_terminate terminate
  # Edit Main
  def main
    # Call HUD
    @hud = Window_Hud.new
    # Call previous Methods
    jens009_hud_main
  end

  # Edit Update
  def update
    # Update hud only if $game_system.show_hud is true
    if $game_system.show_hud and $game_system.always_update
      @hud.update
    end
   
    if $game_system.refresh_hud == true
        @hud.update
       $game_system.refresh_hud = false
    end
   
    if $game_system.show_hud == true
      @hud.visible = true
    else
      @hud.visible = false
    end
    # Call previous methods
    jens009_hud_update
  end

  # Edit Terminate
  def terminate
    # Call previous methods, dispose of other windows first before HUD
    jens009_hud_terminate
    # Dispose HUD
    @hud.dispose
  end
#========================
# End of Scene_Map edit
#========================
end


http://i16.photobucket.com/albums/b38/Dwiguitar/Screenshot1.png

Tried to do a screenshot deal, but I guess I need to have the image somewhere other than Photobucket.  For some reason, the best I could do is this direct link.  Feel free to copy it and paste it below with some html code, if you can.   As you can see, it would be wise to shorten the names of the actors for this script to about 10 characters tops.  Or you could just go down and edit the fonts in the script somehow.  Hope you guys like it and someone out there can use it. 
Title: Re: HUD script I editted
Post by: modern algebra on July 13, 2011, 07:26:30 PM
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi16.photobucket.com%2Falbums%2Fb38%2FDwiguitar%2FScreenshot1.png&hash=85dd4a98b2aad94e90dc8924bc55b96636be11ae)

It seems to work fine with image tags :) (you can quote this post to see the tags)

Anyway, it looks pretty. I haven't looked at the code but will if I get the time.
Title: Re: HUD script I editted
Post by: Brandobscure001 on November 01, 2011, 12:20:48 PM
Hello I'm french
I want to know how to remove the name of the hero
And the helm of HP in red?
thank you in advance :D
Title: Re: HUD script I editted
Post by: IXFURU on November 02, 2011, 08:59:49 AM
Not really sure about what you mean by "Helm of HP", but you can remove the actor graphic by deleting this part:

Code: [Select]
draw_actor_graphic(actor, x + 15, y + 60)

And you can delete the HP bar itself by deleting this part:

Code: [Select]
draw_actor_hp_gauge(actor, x + 30, y + 16, 38)

Just find those lines in the script and take them out.  It should be as simple as that.  Hope that answers your questions!
Title: Re: HUD script I editted
Post by: Brandobscure001 on November 02, 2011, 06:53:15 PM
No that's not it.
I want to know how to remove the name of the Hero
and change the color of the bar for what life is red
Title: Re: HUD script I editted
Post by: IXFURU on November 03, 2011, 07:28:16 AM
Code: [Select]
draw_actor_name (actor, x, y + 0)

That should clear the name.  As far as the color of the hp gauge.  I think you will have to change that in a default script, or add a part to change it.  The reason for this is that this particular script just calls the HP and MP gauges into the scene.  It doesn't control the color of it.  Maybe you could add to it.  In fact, I'm fairly certain you could.  Plus, if you have already set your HP gauge to red in the menu, perhaps, it should already be red when you call it into the scene here.

Sorry for my initial response.  I mis-read the post.  That's what I get for answering posts when I first wake up.  Hope this helps you.
Title: Re: HUD script I editted
Post by: Brandobscure001 on November 03, 2011, 09:29:13 AM
Thank you very much for your help. :D
Title: Re: HUD script I editted
Post by: Infinate X on November 30, 2011, 10:36:38 PM
I like this script.

To change the colour of the HP and MP bars, can't you just add in a line of code below the line that generates the HP Bar itself? I know it works that way for text.
Title: Re: HUD script I editted
Post by: IXFURU on December 01, 2011, 03:48:03 AM
I'm not really sure.  But you could just try it and see what happens.  Let us know if it works.