Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Simple ? Graphic Request

Can someone make mea tiny script that fits neatly into Window_Savefile, and this script replaces any missing character graphics with this: http://img224.imageshack.us/img224/3738 ... arkvw4.png[/img] and this graphicis located at: C:\Program Files\Common Files\RPG Maker Saves\Data
So basicly, if the game can't find the character graphic file in window_savefile, instead of coming up with the error, it replaces the graphic with my question mark.
Thanks.
 
Don't know why you would want to do this, but here is the script

Code:
module RPG
module Cache
  #--------------------------------------------------------------------------
  # * Constants
  #--------------------------------------------------------------------------
  NOT_FOUND = 'Graphics/Icons/001-Weapon01'
  #--------------------------------------------------------------------------
  # * Load Bitmap
  #--------------------------------------------------------------------------
  def self.load_bitmap(folder_name, filename, hue = 0)
    path = folder_name + filename
    if not @cache.include?(path) or @cache[path].disposed?
      if filename != ""
        begin
          @cache[path] = Bitmap.new(path)
        rescue Errno::ENOENT
          @cache[path] = Bitmap.new(NOT_FOUND)
        end
      else
        @cache[path] = Bitmap.new(32, 32)
      end
    end
    if hue == 0
      @cache[path]
    else
      key = [path, hue]
      if not @cache.include?(key) or @cache[key].disposed?
        @cache[key] = @cache[path].clone
        @cache[key].hue_change(hue)
      end
      @cache[key]
    end
  end
end
end


just replace the constant NOT_FOUND to the path of the image you want to use

Untested but it should work reply if it gives you any trouble
 
Where does this go?
Before I use this, does this do what I want to do for every character graphic that might be missing? And how do I change the location of the ? graphic. And does this go into window_savefile? <---That's all the requirements. I wouldn't mind if it went into main, but this really needs to affect window_savefile only.
Just at a glance it looks all wrong. Where did you find it?
Sorry for being picky, but I'm really excited about a new script i'm making.
EDIT: Looks like it's absolutely perfect. I'll test it out a bit more. Many, many thanks.

EDIT2: It seems to work on scene map aswell. Can you give me a script for scene_map that disables this, but instead of showing the usual error, it say: "Oops!" (I'll change the oops! later)
thanks for the help.
Can someone please help, I'm 1% away from an entirely new amazing script.
 
Ahh, oops went a little overboard with that, you should only for Window_SaveFile, and the code I posted does that for all not found graphics I'll edit this post with the script momentarily

(Also assume if someone just posts code and doesn't tell where It belongs that it goes in a new script above main)
Code:
class Window_SaveFile
#--------------------------------------------------------------------------
  # * Constants
  #--------------------------------------------------------------------------
  NOT_FOUND = 'Path to File'
#--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    # Draw file number
    self.contents.font.color = normal_color
    name = "File#{@file_index + 1}"
    self.contents.draw_text(4, 0, 600, 32, name)
    @name_width = contents.text_size(name).width
    # If save file exists
    if @file_exist
      # Draw character
      for i in 0...@characters.size
[b]
        begin
          bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
        rescue Errno::ENOENT
          bitmap = Bitmap.new(NOT_FOUND)
        end[/b]
        cw = bitmap.rect.width / 4
        ch = bitmap.rect.height / 4
        src_rect = Rect.new(0, 0, cw, ch)
        x = 300 - @characters.size * 32 + i * 64 - cw / 2
        self.contents.blt(x, 68 - ch, bitmap, src_rect)
      end
      # Draw play time
      hour = @total_sec / 60 / 60
      min = @total_sec / 60 % 60
      sec = @total_sec % 60
      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 8, 600, 32, time_string, 2)
      # Draw timestamp
      self.contents.font.color = normal_color
      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
      self.contents.draw_text(4, 40, 600, 32, time_string, 2)
    end
  end
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top