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.

System Stack Error in RPG Maker XP

I implemented Game Guy's Terrain Step Sound script and I noticed whenever I reset the game with F12 and load the Scene_Map class this error message comes up.

2h804ty.png


I understand there's some kind of infinite loop involved, but I don't know how to fix it.

Here's the entired code. The error is in line 76.

Ruby:
#===============================================================================

# Terrain Step Sound

# Version 1.1

# Author game_guy

#-------------------------------------------------------------------------------

# Intro:

# Create nice aesthetics with terrain noise. As you walk across grass or sand,

# let it play a beautiful noise to add to the atmosphere and realism of the

# game.

#

# Features:

# Specific Sound for Each Terrain

# Specific Sounds for Each Tileset

# Specify Volume and Pitch

#

# Instructions:

# Setup the config below, its pretty self explanatory, more instructions

# with config.

#

# Credits:

# game_guy ~ For creating it

# Tuggernuts ~ For requesting it a long time ago

# Sase ~ For also requeseting it

#===============================================================================

module TSS

  # In Frames Recommended 5-10

  Wait = 16

  # Ignore the next 2 lines

  Terrains = []

  Tilesets = []

  #===========================================================================

  # Enter in sounds for each terrain tag

  # Goes from 0-8. Set as nil to disable that terrain or delete the line.

  #===========================================================================

  #===========================================================================

  # If you would like to specifiy a volume and pitch, simply set the

  # terrain as an array.

  # Terrains[7] = ["sound", volume, pitch]

  # Just set it as a string if you would like the volume to be at 100 and

  # pitch at 0.

  # This also applies for tilesets below.

  #===========================================================================

  Terrains[0] = 'grass-1'

  Terrains[1] = 'gravel-1'

  Terrains[2] = 'wood-1'

  Terrains[3] = 'snow-1'

  Terrains[4] = 'gravel-2'

  #===========================================================================

  # With tilesets, you can set specific sounds for each tileset so you don't

  # have the same sounds. Add a new line and put

  # Tilesets[tileset id] = []

  # Then for each terrain put

  # Tilesets[tileset id][terrain id] = "sound file"

  # If a sound doesn't exist for a tileset, it will play a default sound,

  # if a default doesn't exist, no sound at all.

  #===========================================================================

  Tilesets[1] = []

  Tilesets[1][0] = ['gravel-1', 20, 100]

  Tilesets[1][1] = ['grass-1',  20, 100]

  Tilesets[1][2] = ['gravel-2', 20, 100]

end

class Game_Map

  def terrain_sound

    if TSS::Tilesets[@map.tileset_id] != nil

      return TSS::Tilesets[@map.tileset_id][$game_player.terrain_tag]

    else

      return TSS::Terrains[$game_player.terrain_tag]

    end

    return nil

  end

end

class Scene_Map

  alias gg_init_terrain_sounds_lat initialize

  def initialize

    @tsswait = TSS::Wait

    gg_init_terrain_sounds_lat

  end

  alias gg_update_terrain_sounds_lat update

  def update

    if $game_player.moving?

      @tsswait -= 1

      terrain = $game_map.terrain_sound

      if terrain != nil

        if @tsswait == 0

          vol = terrain.is_a?(Array) ? terrain[1] : 100

          pit = terrain.is_a?(Array) ? terrain[2] : 0

          son = terrain.is_a?(Array) ? terrain[0] : terrain

          Audio.se_play('Audio/SE/' + son, vol, pit)

          @tsswait = TSS::Wait

        end

      end

    end

    gg_update_terrain_sounds_lat

  end

end
 
Im not that familiar with Scripts but isn't it due that 76 & 93 are exactly the same but 92 ends that line?
* A shot in the dark, but might be resolved by removing either 76 or 93... Be sure to make a backup from the script though!
 

Ares

Member

I believe it is because when you press F12 the already aliased methods will be aliased again, but i'm not 100% sure. You could try adding "unless $@" behind each alias, that seems to solve the problem.
 
Stack Level to Deep, when only after restart, is the aliasing issue. Due as Ares had suggested and update EVERY SINGLE LINE that has an alias to include the 'unless $@' at the end of it so as to prevent it from re-aliasing.
 

Atoa

Member

Just an additional info:
Stack error when press F12 happens when you alias an method that exist only on the parent class, instead of a super (except by a few built-in method, like draw_text)

It's like class Game_Player < Game_Character. It don't have it's own initialize, so if you alias the initialize, everything will work, but you will get stack errors with F12.

On you case, Scene_Map DON'T have it's own initialize, so it's call Object.initialize, since Object is the parent class of all classes, and it have it's own def initialize. (if wasn't by that, it would return an nomethod error)
 

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