Jump to content
Cidiomar

VXAce HUD Designer/Generator

Recommended Posts

It would be nice if we can bind variables to the Rects, not just HP,MP or EXP.

Also, is there a way to turn the HUD script on and off?

Share this post


Link to post
Share on other sites

It would be nice if we can bind variables to the Rects, not just HP,MP or EXP.

Also, is there a way to turn the HUD script on and off?

Hum, yes... but we will need to variables, one for max value and one for current value.

About the enable/disable, I'll put it now!

Share this post


Link to post
Share on other sites

Hum, yes... but we will need to variables, one for max value and one for current value.

Oh, I forgot about that it needs a max values. So yeah, two variables are needed. But you can make that, right?

 

About the enable/disable, I'll put it now!

Thanks! There are times when I don't need the HUD to show, so being able to enable/disable the HUD would be useful.

Share this post


Link to post
Share on other sites

Hi! I just have a couple of quick questions:

 

1. You mention adding a method of terminating the script, what is the call used to do so?

 

2. What are your stances on using this in free/commercial games? Are you happy to just be credited... or what?

 

Thanks in advance!

Share this post


Link to post
Share on other sites

I just generated a HUD script, but I am getting an error,

 

error1.png

 

Any ideas? This is a clean install on VX Ace.



module HUDWidgets
  #----------
  class WidgetBase < Sprite
    def initialize(name, x, y, z)
      super()
      @name = name
      self.x, self.y, self.z = x, y, z
    end
    def z=(v)
      super(v + 60)
    end
    def z
      return super() - 60
    end
  end
  #----------
  class ImageWidget < WidgetBase
    attr_accessor :zoom_x, :zoom_y
    def initialize(name, x, y, z, w, h, a, param, text, idx)
      super(name, x, y, z)
      @iw, @ih = w, h
      self.opacity = a
      @param, @text, @idx = param, text, idx
      case @param
      when 0
        bmp = self.bitmap = Cache.picture(@text)
      when 1
        update_char
      end
      #-----
      @zoom_x_base = @iw.to_f / self.width
      @zoom_y_base = @ih.to_f / self.height
      self.zoom_x  = 1.0
      self.zoom_y  = 1.0
    end
    def zoom_x=(v)
      @zoom_x = v.to_f
      super(@zoom_x_base * @zoom_x)
    end
    def zoom_y=(v)
      @zoom_y = v.to_f
      super(@zoom_y_base * @zoom_y)
    end
    def update_char
      return unless @param == 1
      actor = $game_party.leader
      bmp   = self.bitmap = Cache.character(actor.character_name)
      sign  = actor.character_name[/^[!$]./]
      #-----
      if sign and sign.include?('$')
        cw, ch = bmp.width / 3, bmp.height / 4
      else
        cw, ch = bmp.width / 12, bmp.height / 8
      end
      n = actor.character_index
      self.src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
      self
    end
  end
  #----------
  class TextWidget < WidgetBase
    def initialize(name, x, y, z, param, text, id, fname, fsize, fbold, fitalic, fshadow, fcolor, foutline, foutline_color, tw, th, fix_from)
      super(name, x, y, z)
      #-----
@fsize             = fsize
      @fix_from          = fix_from
      @initial_width     = nil
      #-----
      @font              = Font.new(fname, fsize)
      @font.bold         = fbold
      @font.italic       = fitalic
      @font.shadow       = fshadow
      @font.outline      = foutline
      @font.out_color    = foutline_color
      @fbmp              = Bitmap.new(1, 1)
      @fbmp.font         = @font
      #-----
      @param, @text, @id = param, text, id
      @tw, @th           = tw, th
      #-----
      r           = @fbmp.text_size('Text')
      @font.size *=  (@tw.to_f / r.width)
      #-----
      @fbmp.font = @font
      #-----
      self.oy = (((r.height * (@tw.to_f / r.width)) * (1.0 - (r.width / @tw.to_f))) * 0.5).ceil
      #-----
      update
    end
    def update
      actor = $game_party.leader
      case @param
      when 0  # Text
        str = @text
      when 10 # LVL
        str = (@text % actor.level) rescue actor.level.to_s
      when 12 # Actor's Name
        str = (@text % actor.name) rescue ''
      when 13 # Actor's Class
        str = (@text % actor.class.name) rescue ''
      when 14 # Gold Amount
        str = (@text % $game_party.gold) rescue '0'
      else
        return
      end
      #-----
      self.bitmap.dispose if self.bitmap and not self.bitmap.disposed?
      return if str.empty?
      #-----
      r   = @fbmp.text_size(str)
      bmp = self.bitmap = Bitmap.new(r.width + 32, r.height)
      bmp.font = @font
      bmp.draw_text(bmp.rect, str, 0)
      #-----
      @initial_width ||= self.width
      #-----
      case @fix_from
      when 0
        self.ox = 0
      when 1
        self.ox = (self.width - @initial_width) / 2
      when 2
        self.ox = self.width - @initial_width
      end
    end
  end
end
class Scene_Map < Scene_Base
  #----------
  alias :hud_alias_start  :start
  alias :hud_alias_update :update
  alias :hud_alias_p_term :terminate
  #----------
  def start
    hud_alias_start
    start_hud
  end
  #-----
  def start_hud
    @actor_info_cache, @var_info_cache, @hud_widgets = {}, {}, {}
    @hud_widgets[1] = HUDWidgets::ImageWidget.new('Back', 165, 391, 0, 350, 95, 255, 0, 'Back.png', 1)
    @hud_widgets[2] = HUDWidgets::ImageWidget.new('HP', 257, 433, 1, 134, 8, 255, 0, 'HP.png', 1)
    @hud_widgets[3] = HUDWidgets::ImageWidget.new('MP', 257, 450, 2, 134, 8, 255, 0, 'MP.png', 1)
    @hud_widgets[5] = HUDWidgets::TextWidget.new('Char Level', 411, 437, 3, 10, '%d', 0, 'Arial', 17, true, false, true, Color.new(255, 255, 255, 255), false, Color.new(0, 0, 0, 255), 44, 17,0)
    @hud_widgets[6] = HUDWidgets::TextWidget.new('Char Name', 254, 415, 4, 12, '%s', 0, 'Arial', 12, true, false, true, Color.new(255, 255, 255, 255), false, Color.new(0, 0, 0, 255), 29, 12,0)
    @hud_widgets[7] = HUDWidgets::TextWidget.new('Char Class', 342, 415, 5, 13, '%s', 0, 'Arial', 12, true, false, true, Color.new(255, 255, 255, 255), false, Color.new(0, 0, 0, 255), 29, 12,0)
    @hud_widgets[8] = HUDWidgets::ImageWidget.new('Char Disp', 190, 417, 6, 32, 32, 255, 1, '', 0)
    @hud_widgets[10] = HUDWidgets::TextWidget.new('GÄ', 469, 452, 7, 0, 'GÄ', 0, 'Arial', 11, false, false, true, Color.new(255, 255, 255, 255), false, Color.new(0, 0, 0, 255), 28, 11,0)
    @hud_widgets[11] = HUDWidgets::TextWidget.new('Gold Value', 449, 428, 8, 14, '%d', 0, 'Arial', 15, true, false, true, Color.new(255, 255, 255, 255), false, Color.new(255, 255, 0, 255), 38, 15,2)
    update_hud
  end
  #----------
  def update
    hud_alias_update
    update_hud
  end
  #-----
  def update_hud
    actor = $game_party.leader
    if @actor_info_cache[:char_hp] != actor.hp or @actor_info_cache[:char_mhp] != actor.mhp
      @hud_widgets[2].zoom_x = (actor.hp.to_f / actor.mhp)
      @actor_info_cache[:char_hp],  @actor_info_cache[:char_mhp]     = actor.hp, actor.mhp
    end
    if @actor_info_cache[:char_mp] != actor.mp or @actor_info_cache[:char_mmp] != actor.mmp
      @hud_widgets[3].zoom_x = (actor.mp.to_f / actor.mmp)
      @actor_info_cache[:char_mp],  @actor_info_cache[:char_mmp]     = actor.mp, actor.mmp
    end
    if @actor_info_cache[:char_level] != actor.level
      @hud_widgets[5].update
      @actor_info_cache[:char_level] = actor.level
    end
    if @actor_info_cache[:char_name] != actor.name
      @hud_widgets[6].update
      @actor_info_cache[:char_name] = actor.name
    end
    if @actor_info_cache[:char_class] != actor.class.name
      @hud_widgets[7].update
      @actor_info_cache[:char_class] = actor.class.name
    end
    if @actor_info_cache[:char_name] != actor.character_name or @actor_info_cache[:char_idx] != actor.character_index
      @hud_widgets[8].update_char
      @actor_info_cache[:char_name] = actor.character_name
      @actor_info_cache[:char_idx] = actor.character_index
    end
    if @actor_info_cache[:party_gold] != $game_party.gold
      @hud_widgets[11].update
      @actor_info_cache[:party_gold] = $game_party.gold
    end
  end
  #----------
  def terminate
    hud_alias_p_term
    hud_dispose
  end
  #-----
  def hud_dispose
    @hud_widgets.each_value {|hw|  hw.dispose  }
  end
  #----------
end

 

 

Share this post


Link to post
Share on other sites

I can't do anything... I click on the widgets and nothing happens... Would be nice if there were instructions... The screens look easy enough to use and I give props to you for what you have done, I just wish I could use it.

 

Using Firefox

Share this post


Link to post
Share on other sites

Solaris, I can assist you in using this program. I spent a while (2 hours) playing around with it yesterday, and I think I understand it now.

Share this post


Link to post
Share on other sites

Today, I tried to use this, and when I tried dragging something to the game window, your name just kept jumping down the page, I couldn't do anything in the editor either, seems like something may have broken in it.

Share this post


Link to post
Share on other sites

This is also happening to me! i thought i was doing something wrong, is it still working? i would love to use this in my project.

 

Edit: For anyone having trouble with this too it doesn't seem to work using Firefox for me.

Edited by beaulamb

Share this post


Link to post
Share on other sites

Forgive me if this makes me seem stupid but how do you use this designer? I keep clicking/clicking and dragging the widgets on the page but nothing happens. Do I have to actually upload widgets or what? I even turned off my popup blocker thinking that it was considering that an ad of some sort but still nadda. Any help would be appreciated.

Share this post


Link to post
Share on other sites

I've just tested and the app isn't working, I don't why nor have the sources.

 

It's time to develop another app... After this and some other projects I become interested in web development and now I'm a pro web developer.

I'll start it tomorow, let me know if someone want a way to get feedbacks from the development.

Share this post


Link to post
Share on other sites

What about the function to design multiple types of HUDs for different situations (optional)

or the ability to turn off the HUD in certain situations?

Share this post


Link to post
Share on other sites

What about the function to design multiple types of HUDs for different situations (optional)

or the ability to turn off the HUD in certain situations?

 

Nice functions.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×