07-11-2011, 06:48 PM
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)
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!
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)
Code:
#===============================================================================
# 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!