Save-Point

Full Version: Save-Point
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Board Message
Sorry, you do not have permission to access this resource.
Save-Point - [Resolved] Display Gold - Hud maybe?

Save-Point

Full Version: [Resolved] Display Gold - Hud maybe?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
It'd would be better to use a sprite instead, less lag would be a plus here I guess.
displaying a gold window doesn't make lag. A picture can't show gold.
if micko's way worked, then this case is resolved. :D
It didn't.
I'm still getting an error. ^^' About the sprite idea...I'm not exactly sure what you mean by that.
I am fine with the window, I think as long as I'll get it to work. So far, only the first version actually showed up, but since it won't change if I earn or lose money unless I go to the menu, that's no option. (And since the jump won't work, I can't use it anyway XD)
Everything else made the game crash befor I coulr really start, so it's not compatible with the things I'm using, I guess.

As I said earlier: I would also be fine if the working script would constantly show the number stored in a variable, it doesn't NEED to be the gold. I just suggested that because I felt that'd be easier to do.

I bet many of you have played platformgames like Mario. Where you earn points when collection certain items or losing some if you touch enemys. Or something along that way.
That's what I want to be able to do.
And since said Platformgame is more of a minigame, I asked for the display of Gold/Points/Whatever to be able to switched on and off.
I see, I bet you also want the platform thing to be switches on/off? am i right?
Well, yeah.
But that's included in the platformscript. You can add the IDs of the maps you want to be platformlike there, every other map works normal. So I don't think that has to be redone.
Valdred Wrote:displaying a gold window doesn't make lag. A picture can't show gold.
if micko's way worked, then this case is resolved. :D
Believe me, it's really possible to show both text and pictures in a single sprite.
A sprite can show a variable? You'll have to explain this to me.
Okay, no idea why it didn't work for you yamina-chan, but with the scripts used file you provided it works fine for me. Anyway, copy/paste this below the scripts you posted, still above main. If it doesn't work properly then you didn't post all the scripts you are using, I tried it with the scripts you posted and I can see the window, run and jump.
Code:
module Gold_Window
  # Window's horizontal position
  WINDOW_X = 0
  # Window's vertical position
  WINDOW_Y = 0
  # Window's width
  WINDOW_WIDTH = 160
  # Window's height
  WINDOW_HEIGHT = 64
  # Default hide status of the window (true = hidden, false = visible)
  DEFAULT_HIDE = false
  
  @hide = DEFAULT_HIDE
  def self.hidden?
    return @hide
  end
  def self.hide
    @hide = !@hide
  end
end
#==============================================================================
# ** Window_Gold_HUD
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================
class Window_Gold_HUD < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :text_opacity                                  # Text opacity
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(Gold_Window::WINDOW_X, Gold_Window::WINDOW_Y,
    Gold_Window::WINDOW_WIDTH, Gold_Window::WINDOW_HEIGHT)
    self.contents = Bitmap.new(width - 32, height - 32)
    @old_gold = -1
    @text_opacity = Gold_Window.hidden? ? 0 : 255
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if @old_gold != $game_party.gold
      self.contents.clear
      color_normal = Color.new(255, 255, 255, @text_opacity)
      color_system = Color.new(192, 224, 255, @text_opacity)
      cx = contents.text_size($data_system.words.gold).width
      self.contents.font.color = color_normal
      self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
      self.contents.font.color = color_system
      self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
      @old_gold = $game_party.gold
    end
  end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================
class Scene_Map
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias gold_hud_main main
  def main
    @gold_window = Window_Gold_HUD.new
    @gold_window.opacity = Gold_Window.hidden? ? 0 : 255
    @gold_window.text_opacity = Gold_Window.hidden? ? 0 : 255
    gold_hud_main
    @gold_window.dispose    
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias gold_hud_update update
  def update
    @gold_window.refresh
    @gold_window.opacity = Gold_Window.hidden? ? 0 : 255
    @gold_window.text_opacity = Gold_Window.hidden? ? 0 : 255
    gold_hud_update
  end
end

EDIT : Oh yeah, if you want to hide/unhide this window, just make a call script with "Gold_Window.hide" in it. It will hide it if it's visible, or unhide it if it's hidden.

Also, Valdred :
Code:
sprite = Sprite.new
sprite.bitmap = Bitmap.new(width, height)
sprite.bitmap.draw_text(x, y, width, height, $game_variables[variable_id].to_s[, align])
I believe that's what kyonides means.
@MicKo Thanks, it's working now ^^ Or mostly...
If I hide the gold window, it's just hiding the window itself, the points still stay on screen. Untill I get some more, then they'll dissapear. And if I want to unhide it, the window shows up again, but the points won't XD'
Yep sorry, was pretty obvious but I only tested it with a parallel process giving gold so didn't see it. Here you go :
Code:
module Gold_Window
  # Window's horizontal position
  WINDOW_X = 0
  # Window's vertical position
  WINDOW_Y = 0
  # Window's width
  WINDOW_WIDTH = 160
  # Window's height
  WINDOW_HEIGHT = 64
  # Default hide status of the window (true = hidden, false = visible)
  DEFAULT_HIDE = false
  
  @hide = DEFAULT_HIDE
  def self.hidden?
    return @hide
  end
  def self.hide
    @hide = !@hide
  end
end
#==============================================================================
# ** Window_Gold_HUD
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================
class Window_Gold_HUD < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(Gold_Window::WINDOW_X, Gold_Window::WINDOW_Y,
    Gold_Window::WINDOW_WIDTH, Gold_Window::WINDOW_HEIGHT)
    self.contents = Bitmap.new(width - 32, height - 32)
    @old_gold = -1
    @old_hide = Gold_Window.hidden?
    self.opacity = Gold_Window.hidden? ? 0 : 255
    @text_opacity = Gold_Window.hidden? ? 0 : 255
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if @old_gold != $game_party.gold || @old_hide != Gold_Window.hidden?
      self.contents.clear
      self.opacity = Gold_Window.hidden? ? 0 : 255
      @text_opacity = Gold_Window.hidden? ? 0 : 255
      color_normal = Color.new(255, 255, 255, @text_opacity)
      color_system = Color.new(192, 224, 255, @text_opacity)
      cx = contents.text_size($data_system.words.gold).width
      self.contents.font.color = color_normal
      self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
      self.contents.font.color = color_system
      self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
      @old_gold = $game_party.gold
      @old_hide = Gold_Window.hidden?
    end
  end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================
class Scene_Map
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias gold_hud_main main
  def main
    @gold_window = Window_Gold_HUD.new
    gold_hud_main
    @gold_window.dispose    
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias gold_hud_update update
  def update
    @gold_window.refresh
    gold_hud_update
  end
end
Pages: 1 2 3