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.

NoMethodError, help on fixing it

I have a script that mimics psn/xbl Achievements. When trying to implement it to my game, i get a NoMethodError:

error.jpg


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!
 

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