#===============================================================================
# ** Player & Event Step Sound Effects
#-------------------------------------------------------------------------------
# Written by   : Kain Nobel
# Version    : 1.0
# Last Updated  : 7/20/2008
# Date Created  : 6/20/2008
#===============================================================================
################################################################################
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
# ~** Â Â Â Â Â Â Â Â CUSTOMIZABLE CONSTANTS - BEGIN Â Â Â Â Â Â Â Â Â Â Â **~ #
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
################################################################################
module StepSFX
 #-----------------------------------------------------------------------------
 # * Is this script active and enabled?
 #-----------------------------------------------------------------------------
 Enabled   = true
 #-----------------------------------------------------------------------------
 # * Horizontal Limit before event is out of range.
 #-----------------------------------------------------------------------------
 Arg_Dist_X  = 6
 #-----------------------------------------------------------------------------
 # * Vertical Limit before event is out of range.
 #-----------------------------------------------------------------------------
 Arg_Dist_Y  = 4
 #-----------------------------------------------------------------------------
 # * The master volume of the step sound effects.
 #-----------------------------------------------------------------------------
 Volume    = 50
 #-----------------------------------------------------------------------------
 # * The modifier for the step sound effect volume (for events vs player dist)
 #-----------------------------------------------------------------------------
 Adjust    = 2.5
 #-----------------------------------------------------------------------------
 # * Step sounds based on terrain tag ID
 #-----------------------------------------------------------------------------
 Tag = {
  # Default tag for no terrain
  0 => "Steps-00-Default",
  # Special Terrains such as grass, water, etc...
  1 => "Steps-01-Grass",
  2 => "Steps-02-Cement",
  3 => "Steps-03-Dirt",
  4 => "Steps-07-Snow",
  5 => "Steps-05-Wood",
  6 => "Steps-06-Metal",
  7 => "step in water"
 }
end
################################################################################
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
# ~** Â Â Â Â Â Â Â Â Â CUSTOMIZABLE CONSTANTS - END Â Â Â Â Â Â Â Â Â Â Â Â **~ #
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
################################################################################
#===============================================================================
# ** Game_Character
#-------------------------------------------------------------------------------
# Â This class has been enhanced to use step sounds with player/events based on
# terrain tags.
#===============================================================================
class Game_Character
 #-----------------------------------------------------------------------------
 # * Alias Listing
 #-----------------------------------------------------------------------------
 alias_method  :kn_step_sounds_game_character_update,   :update
 #-----------------------------------------------------------------------------
 # * Update Method (Aliased)
 #-----------------------------------------------------------------------------
 def update
  if StepSFX::Enabled && self.moving? && arg_frames
   if arg_screen_x && arg_screen_y
    if within_x && within_y
     play_step_sounds
    end
   end
  end
  kn_step_sounds_game_character_update
 end
 #-----------------------------------------------------------------------------
 # * Play Step Sounds
 #-----------------------------------------------------------------------------
 def play_step_sounds
  sound_effect = "Audio/SE/"+StepSFX::Tag[self.terrain_tag]
  if StepSFX::Tag.has_key?(self.terrain_tag)
   begin
    Audio.se_play(sound_effect, walk_volume, 75)
   rescue
   end
  end
 end
 #-----------------------------------------------------------------------------
 # * Frame Count Argument
 #-----------------------------------------------------------------------------
 def arg_frames
  unless @move_speed.nil?
   return ((Graphics.frame_count + 2 * self.id) % (18 - @move_speed)).zero?
  end
 end
 #-----------------------------------------------------------------------------
 # * Screen X Argument
 #-----------------------------------------------------------------------------
 def arg_screen_x
  return (self.screen_x > 0 && self.screen_x < 640)
 end
 #-----------------------------------------------------------------------------
 # * Screen Y Argument
 #-----------------------------------------------------------------------------
 def arg_screen_y
  return (self.screen_y > 0 && self.screen_y < 480)
 end
 #-----------------------------------------------------------------------------
 # * Distance X Argument
 #-----------------------------------------------------------------------------
 def arg_distance_x
  return ((self.x + $game_player.x) / 2)
 end
 #-----------------------------------------------------------------------------
 # * Distance Y Argument
 #-----------------------------------------------------------------------------
 def arg_distance_y
  return ((self.y + $game_player.y) / 2)
 end
 #-----------------------------------------------------------------------------
 # * Within Distance X
 #-----------------------------------------------------------------------------
 def within_x
  return arg_distance_x < (StepSFX::Arg_Dist_X * 32)
 end
 #-----------------------------------------------------------------------------
 # * Within Distance Y
 #-----------------------------------------------------------------------------
 def within_y
  return arg_distance_y < (StepSFX::Arg_Dist_Y * 32)
 end
 #-----------------------------------------------------------------------------
 # * Define Walk Volume
 #-----------------------------------------------------------------------------
 def walk_volume
  return StepSFX::Volume+(StepSFX::Adjust*(arg_distance_x+arg_distance_y)/2)
 end
end
Â
#===============================================================================
# ** Game_Player
#-------------------------------------------------------------------------------
# Â Game_Player's walk volume doesn't have to be measured against anything, so
# this class's volume is constantly a certain value * 2. This overrides the
# 'walk_volume' method in Game_Character.
#===============================================================================
Â
class Game_Player < Game_Character
 #-----------------------------------------------------------------------------
 # * Define Walk Volume
 #-----------------------------------------------------------------------------
 def walk_volume
  return StepSFX::Volume * 2
 end
end
Â