Juan J. Sánchez
Sponsor
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.
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.
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