Error : Failed to Create Bitmap

"Script 'Window Message' line 102: RGSSError occurred


Failed to Create Bitmap"


Okay, so the past few times I have loaded up my game in development, I have received this error. This, for my, is confusing because I do not know what is causing it. It just...appeared.


Now, first, before anyone asks, yes, I am tampering (seriously tampering) with the script of the game.


My issue is that the error is completely unrelated to anything I have done scripting wise.


From preliminary googling, I have discovered other people have had this issue as well and it has to do with corrupted images or game files. But which file specifically is corrupted? I can't freaking figure it out. Help please? (Oh I have replaced and re-employed the defaults for the window, so it can't be that) 


Help is much appreciated! :-D
Try to think back about what you've recently tampered with. Create a new project, then use diffchecker.com to see what things you'd changed.


I doubt it's a corrupt image issue, more likely, it's due to you erasing a variable that contained an image name, or moved an image, or just erased a definition somewhere. I'm not too sure the cause, but it would be more helpful to be able to see what changes you've made, since many, many, things can cause that error.
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


What's on line 102 of Window_Message?  Copy the whole method that contains that line, then paste it here, so we can see it in context, and highlight which line is 102.
mjshi - okay, I'll try that. Thanks. Oh, and thanks a bunch. I went back and replaced new script with the old then re-did it to find the error.


Although, what I was tampering with was the Window_EquipSlot, Window_EquipCommand, Scene_Equip.


[Edit] - YES! FOUND IT! It was in the Base_Item script component that was causing the error, for some reason.


All of this in the name of renaming/excluding options/choices in the game. If anyone can think of any better way to rename equip slots or change options that would also be appreciated. -> This still stands if anyone wants to help. :-D
This is that method from the default script:

Code:
  def create_back_bitmap
    @back_bitmap = Bitmap.new(width, height)     <<<< this is line 102
    rect1 = Rect.new(0, 0, width, 12)
    rect2 = Rect.new(0, 12, width, height - 24)
    rect3 = Rect.new(0, height - 12, width, 12)
    @back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true)
    @back_bitmap.fill_rect(rect2, back_color1)
    @back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true)
  end



With all your tinkering, have you been changing the default scripts, or adding new scripts?


If you haven't made any changes to that, and that's what you see on line 102, then it's likely that either width or height are 0.  To test, change the method so it looks like this:

Code:
  def create_back_bitmap
    p width
    p height
    @back_bitmap = Bitmap.new(width, height)
    rect1 = Rect.new(0, 0, width, 12)
    rect2 = Rect.new(0, 12, width, height - 24)
    rect3 = Rect.new(0, height - 12, width, 12)
    @back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true)
    @back_bitmap.fill_rect(rect2, back_color1)
    @back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true)
  end

and play with the console turned on.  


When the game crashes, see what's been output in the console.  I expect there'll be a 0 or null value in there.  If you can't decipher it, get a screenshot of the console at that point and post it here.


Did you look to see if there were existing scripts that do what you want to do?  In fact, to rename slots you should just have to make some minor modifications in the Vocab script.


But those scripts you mentioned don't have anything to do with the message window.

Original thread: https://forums.rpgmakerweb.com/threads/error-failed-to-create-bitmap.57124/