LAVALORD96'S PROFILE

Search

Filter

RPG Maker VX Ace: Erase Picture command error

Wait hold on, something doesn't seem right, Marrend, can you send me the full script that you have for rpg maker? I need to check something, I think I don't have the same lines of code that you have.

RPG Maker VX Ace: Erase Picture command error

If I can't fix this, me and my team are going to have a major problem, as we are gonna heavily use pictures in our game.

RPG Maker VX Ace: Erase Picture command error

I've been looking all over the internet for this problem, but seemingly coming up short, I can't find really anyone else who encountered this problem, well, except for one guy that had the exact same problem and made a steam post, and another guy commented on it saying: "Add the Missing Script"
So I think we are on to something.

RPG Maker VX Ace: Erase Picture command error

author=Marrend
I'm not really sure, but, the scenario in my head is that you had multiple pictures, had already erased at least one of them, and simply forgot the one you're trying to erase was already erased?

That aside, I did a bit of cross-referencing to see what line 54 of Sprite_Picture was at, what method it was in, and what all was supposed to be happening. We're looking at...

class Sprite_Picture < Sprite
  #--------------------------------------------------------------------------
  # * Update Origin
  #--------------------------------------------------------------------------
  def update_origin
    if @picture.origin == 0
      self.ox = 0
      self.oy = 0
    else
      self.ox = bitmap.width / 2 # <-this is line 54
      self.oy = bitmap.height / 2
    end
  end
end

...this function. Perhaps there is interference from...

class Sprite_Picture < Sprite
  #--------------------------------------------------------------------------
  # * Update Transfer Origin Bitmap
  #--------------------------------------------------------------------------
  def update_bitmap
    if @picture.name.empty?
      self.bitmap = nil
    else
      self.bitmap = Cache.picture(@picture.name)
    end
  end
end

...this function, too? I also looked up what the Erase Picture event-command does...

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Erase Picture
  #--------------------------------------------------------------------------
  def command_235
    screen.pictures[@params[0]].erase
  end
end

...for the sake of reference. I believe the "screen" variable, in that case, is an instance of Game_Screen. Meaning that the function call there would (eventually) call...

class Game_Picture
  #--------------------------------------------------------------------------
  # * Erase Picture
  #--------------------------------------------------------------------------
  def erase
    @name = ""
    @origin = 0
  end
end

...this function?

I dunno. Now that I think on it, even if you pointed to a picture that didn't exist, I feel it would not generate that particular error. If there was an error message regarding that, I would expect more an error about "erase" being an undefined method.
From the looks of it, it says that width is undefined I suppose, but what would I put in those quotations to fix this?Hmm...

RPG Maker VX Ace: Erase Picture command error

author=Sgt M
Are you sure it is the Erase Picture command giving you this error and not Move Picture? I have gotten this exact error with the Move Picture command if you try to move a picture that isn't there. i.e.: You have only Picture 1 active, but tried to move Picture 2 instead.

I'm sure of it, I tested it out, and sure enough, it was the "Erase Picture" command causing problems

RPG Maker VX Ace: Erase Picture command error

Alright, so here's my problem, I have had a picture be put on screen, then I used the erase picture command to remove it, sound simple enough? Well, not for me unfortuantly...You see every time I add the erase picture command, this error pops up: Sprite_picture line 54: NoMethodError occured undefined method for 'width' nil:Nilclass. So yeah, if anyone would be kind enough to help me figure out how to fix this, it would be GREATLY appreciated.

EDIT: I FIXED THE PROBLEM! Unfortunately I don't know EXACTLY what happened, but I replaced the "Game_picture" and "Sprite_Picture" scripts with ones from a NEW project I made, my guess is that something accidentally was deleted from the old scripts. My brain is fried after this mess. Thank you for your help guys. You gave me the idea after all.
Pages: 1