gRaViJa 4 Report post Posted July 11, 2011 (edited) I have a script that mimics psn/xbl Achievements. When trying to implement it to my game, i get a NoMethodError: The method that causes this error is the part that will show an alert when the player gets a new achievement. (Here's that part of the code that produces the error, exact line of error: if $game_system.queue.size > 0 && @frame < 1) #=============================================================================== # Graphics #------------------------------------------------------------------------------- # **added method to control and draw all queued achievements. #=============================================================================== module Graphics class << self alias gg_upd_awards_queue_lat update end def self.update @frame = 0 if @frame == nil if $game_system.queue.size > 0 && @frame < 1 award = Awards::Award[$game_system.queue[0]] if award != nil @sprite = Sprite_Award.new(award) @frame = Awards::Popup_Time Audio.se_play("Audio/SE/#{Awards::Popup_Sound[0]}", Awards::Popup_Sound[1], Awards::Popup_Sound[2]) end end if @frame > 0 @frame -= 1 if @frame < 1 @sprite.dispose $game_system.queue.shift end end gg_upd_awards_queue_lat end end If i understand it right, this adds a method to module graphics to let it draw achievements. I have other scripts that possibly make edits to Graphics Module as well, so i think that causes the error? If so, is it possible to edit this script to fix the error without changing other scripts? Because then a tidal wave of other errors might occure. Full script here: http://www.text-upload.com/read.php?id=102621&c=7454606 Help is appreciated! Edited July 11, 2011 by gRaViJa Share this post Link to post Share on other sites
kellessdee 48 Report post Posted July 11, 2011 Based on what I can see, I *think* the issue is that the Graphics module (specifically the update method) is called before the Game_System object is created; therefore when checking if $game_system.queue.size > 0, you get a nil class error (as $game_system hasn't been initialized, and thus is nil and there is no method called queue) try replacing the script section you posted here with this: (it should stop that error at least; I guess we'll find out if it fixes everything too haha) #=============================================================================== # Graphics #------------------------------------------------------------------------------- # **added method to control and draw all queued achievements. #=============================================================================== module Graphics class << self alias gg_upd_awards_queue_lat update end def self.update unless $game_system == nil @frame = 0 if @frame == nil if $game_system.queue.size > 0 && @frame < 1 award = Awards::Award[$game_system.queue[0]] if award != nil @sprite = Sprite_Award.new(award) @frame = Awards::Popup_Time Audio.se_play("Audio/SE/#{Awards::Popup_Sound[0]}", Awards::Popup_Sound[1], Awards::Popup_Sound[2]) end end if @frame > 0 @frame -= 1 if @frame < 1 @sprite.dispose $game_system.queue.shift end end end gg_upd_awards_queue_lat end end All i did, was put all the code that dealt with the game_system class inside an unless statement, so that the code ONLY executes when $game_system is not nil. :o randomly i just realized something as well: the issue is probably within a script you have that uses the graphics module prior to the title screen opening... (as one of the first things the default title screen script does, is create the $game_system object...) So this error is probably caused by some kind of graphical scene that occurs prior to the Scene_Title; perhaps a splash screen or a title skipping script? (not sure) Eitherway, this fix *SHOULD* fix this error. Lemme know how it works. Share this post Link to post Share on other sites
gRaViJa 4 Report post Posted July 11, 2011 1 try, 1 fix! Awesome job once again Kellesdee :) And i have a splashscreen script indeed. Your info also made sense, i understand what the error was. I've said it before and i'll say it again: if i needed a (paid) scripter for my project you would be the first person i'd ask ^^ But 99% of the scripting is done expect for a small error like this once in a while :) Aaanyway, thanks! Share this post Link to post Share on other sites