Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: G_G on April 26, 2011, 08:42:09 pm

Title: [XP] Terrain Step Sound
Post by: G_G on April 26, 2011, 08:42:09 pm
Terrain Step Sound
Authors: game_guy
Version: 1.3
Type: Environment Add-on
Key Term: Environment Add-on

Introduction

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


Screenshots

N/A
Screenshots can't produce sound.

Demo

N/A
Links can't produce sound either.

Script

v1.2: ShowHide

#===============================================================================
# Terrain Step Sound
# Version 1.2
# 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
# Specify an array of sounds for each terrain, allowing random sounds for each step
#
# Instructions:
# Setup the config below, its pretty self explanatory, more instructions
# with config.
#
# You can now change the sound rate in game using a script call.
# $game_map.rate = X
# X = sound rate (the lower the value, the more frequent the sounds)
#
# 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 = 10
  # 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.
  # Each terrain must now be an array. This allows you to define multiple
  # sound effects for each terrain.
  #===========================================================================
  Terrains[0] = ['001-System01', '002-System02', '003-System03']
  Terrains[1] = ['fs_wood_hard1']
  Terrains[2] = ['fs_grass03']
  Terrains[3] = ['fs_stone_hoof2']
  Terrains[4] = ['as_na_grassmove2']
  Terrains[5] = ['fs_water_hard1']
  Terrains[6] = ['fs_dirt_hard1']
  #===========================================================================
  # 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.
  # You can also define multiple sound effects with pitch and volume.
  #===========================================================================
  Terrains[7] = [["sound", 80, 10], "sound2", ["sound3", 50, 0]]
  #===========================================================================
  # 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", "sound file2", etc...]
  # 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[2] = []
  Tilesets[2][0] = ["Sound"]
  Tilesets[2][1] = [["sound", 75, 50]]
end
class Game_Map
 
  attr_accessor :rate
 
  alias gg_init_terrain_sounds_map_lat initialize
  def initialize
    @rate = TSS::Wait
    return gg_init_terrain_sounds_map_lat
  end
 
  def terrain_sound
    if TSS::Tilesets[@map.tileset_id] != nil
      sounds = TSS::Tilesets[@map.tileset_id][$game_player.terrain_tag]
    else
      sounds = TSS::Terrains[$game_player.terrain_tag]
    end
    return nil if sounds == nil || !sounds.is_a?(Array) || sounds.size < 1
    sound = sounds[rand(sounds.size)]
    if sound.is_a?(Array)
      return [sound[0], sound[1], sound[2]]
    else
      return [sound, 100, 0]
    end
  end
 
end

class Game_Player < Game_Character
 
  def update_move
    @timer = $game_map.rate if @timer == nil
    @timer -= 1
    if @timer < 1
      terrain = $game_map.terrain_sound
      if terrain != nil
        vol = terrain[1]
        pit = terrain[2]
        son = terrain[0]
        Audio.se_play('Audio/SE/' + son, vol, pit)
      end
      @timer = $game_map.rate
    end
    super
  end
 
end


Zexion added a few more features: https://forum.chaos-project.com/index.php/topic,9460.msg192088.html#msg192088
v1.3: ShowHide

#===============================================================================
# Terrain Step Sound + Events
# Version 1.3
# Author game_guy
# New Features by Zexion
#-------------------------------------------------------------------------------
# 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
# Specify an array of sounds for each terrain, allowing random sounds for each step
# Specify events that can play these sounds.
#
# Instructions:
# Setup the config below, its pretty self explanatory, more instructions
# with config.
#
# You can now change the sound rate in game using a script call.
# $game_map.rate = X
# X = sound rate (the lower the value, the more frequent the sounds)
#
# Add the Name_Tag ("steps" by default) to the event page name (without quotes)
# to add dynamic footstep sounds to that event.
#
# Credits:
# game_guy ~ For creating it
# Tuggernuts ~ For requesting it a long time ago
# Sase ~ For also requeseting it
# Zex - For the Event & move_speed edit
# kk20 - for listening to zex's complaints
#===============================================================================
module TSS
  # Adjust this to your liking
  Wait = 20
  Name_Tag = "steps"
  # Ignore this
  Terrains, Tilesets = [], []
  #===========================================================================
  # Enter in sounds for each terrain tag
  # Goes from 0-8. Set as nil to disable that terrain or delete the line.
  # Each terrain must now be an array. This allows you to define multiple
  # sound effects for each terrain.
  #===========================================================================
  Terrains[0] = []
  Terrains[1] = [["FS - 03 - Wood", 40, 0],["FS - 04 - Wood", 40, 0]]
  Terrains[2] = ['FS - 05 - Metal']
  Terrains[3] = ['FS - 07 - Hollow Metal']
  Terrains[4] = [["FS - 09 - Concrete", 40, 0]]
  Terrains[5] = [["FS - 11 - Dirt", 40, 0],["FS - 11 - Dirt", 40, 0]]
  Terrains[6] = [["FS - 13 - Grass", 40, 0], ["FS - 14 - Grass", 40, 0]]
  #===========================================================================
  # 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.
  # You can also define multiple sound effects with pitch and volume.
  #===========================================================================
  Terrains[7] = [["FS - 01 - Water", 50, 0],["FS - 02 - Water", 50, 0]]
  #===========================================================================
  # 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", "sound file2", etc...]
  # 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.
  #===========================================================================
end
#-------------------------------------------------------------------------------
# Game_Map
#-------------------------------------------------------------------------------
class Game_Map
  attr_accessor :map          # make public
end
#-------------------------------------------------------------------------------
# Game_Character
#-------------------------------------------------------------------------------
# Adds Gameus's terrain_sound method to game_character.
#-------------------------------------------------------------------------------
class Game_Character
  attr_accessor :move_speed  # make public
  #-----------------------------------------------------------------------------
  # Initialize ss_index
  #-----------------------------------------------------------------------------
  alias g_c_sfe_init initialize
  def initialize
    g_c_sfe_init
    @ss_index = 0
    @timer = 0
    @tss_speed = @move_speed
    set_tss_offset
  end
  #-----------------------------------------------------------------------------
  # Updates the timer when needed
  #-----------------------------------------------------------------------------
  alias g_c_sfe_update update
  def update
    g_c_sfe_update
    @timer -= 1 if @timer > 0
    if @tss_speed != self.move_speed
      set_tss_offset
    end
  end
  #-----------------------------------------------------------------------------
  # Sets the sound offset
  #-----------------------------------------------------------------------------
  def set_tss_offset   
    # Timer offset by movespeed
    case self.move_speed
    when 0..2
      @tss_offset = TSS::Wait + self.move_speed
    when 3
      @tss_offset = TSS::Wait
    else
      @tss_offset = TSS::Wait - self.move_speed * 2
    end
  end
  #-----------------------------------------------------------------------------
  # Returns the array to be used later
  #-----------------------------------------------------------------------------
  def terrain_sound
    if TSS::Tilesets[$game_map.map.tileset_id] != nil
      sounds = TSS::Tilesets[$game_map.map.tileset_id][self.terrain_tag]
    else
      sounds = TSS::Terrains[self.terrain_tag]
    end
    return nil if sounds == nil || !sounds.is_a?(Array) || sounds.size < 1
    index_max = sounds.size - 1
    @ss_index = (@ss_index < index_max) ? (@ss_index + 1) : 0
    sound = sounds[@ss_index]
    if sound.is_a?(Array)
      return [sound[0], sound[1], sound[2]]
    else
      return [sound, 100, 0]
    end
  end
end
#-------------------------------------------------------------------------------
# Game_Player
#-------------------------------------------------------------------------------
Tss_Parent = $BlizzABS ? (Map_Actor) : (Game_Character)
class Game_Player < Tss_Parent
  #-----------------------------------------------------------------------------
  # Adds step sounds to the player
  #-----------------------------------------------------------------------------
  def update_move
    # Make sure this is the player
    if self != $game_event && @timer == 0
      # Play the sound effect
      terrain = self.terrain_sound
      if terrain != nil
        vol = terrain[1]
        pit = terrain[2]
        son = terrain[0]
        Audio.se_play('Audio/SE/' + son, vol, pit)
      end
      # Set timer
      @timer = @tss_offset
    end
    # Call original code
    super
  end
end
#-------------------------------------------------------------------------------
# Game_Event
#-------------------------------------------------------------------------------
class Game_Event < Game_Character
  #-----------------------------------------------------------------------------
  # Set the variable for checking if the event should make a sound
  #-----------------------------------------------------------------------------
  alias g_e_sfe_init initialize
  def initialize(map_id, event)
    g_e_sfe_init(map_id, event)
    @tss = self.name.include?(TSS::Name_Tag) ? true : false
  end
  #--------------------------------------------------------------------------
  # * Returns the event's name
  #--------------------------------------------------------------------------
  def name
    return @event.name
  end
  #-----------------------------------------------------------------------------
  # Returns the distance of this event from the player
  #-----------------------------------------------------------------------------
  def range?
    if $BlizzABS && BlizzABS::Config::PIXEL_MOVEMENT_RATE == 1
      player_x = $game_player.x / 2 # Adjusted for 1.0 pixel movement rate
      player_y = $game_player.y / 2 # Adjusted for 1.0 pixel movement rate
    else
      player_x = $game_player.x
      player_y = $game_player.y
    end
    radius = (Math.hypot((self.x - player_x), (self.y - player_y))).abs.floor
    return (radius)
  end
  #-----------------------------------------------------------------------------
  # Adds step sounds to the event with dynamic volume
  #-----------------------------------------------------------------------------
  def update_move
    # Check if the event should play a sound
    if @tss
      # Make sure it's an event
      if self != $game_player
        # Check if the event is anywhere near the player
        if range? <= 6 && @timer == 0
          # The amount to subtract from the normal volume
          sub_vol = 4 * range?
          # Play the sound effect
          terrain = self.terrain_sound
            if terrain != nil
              vol = terrain[1]
              pit = terrain[2]
              son = terrain[0]
              # Dynamic sound edit
              vol = vol - sub_vol
              vol = 0 if vol < 0
              Audio.se_play('Audio/SE/' + son, vol, pit)
            end
            # Set timer
            @timer = @tss_offset
          end
        end
      end
      # Call original code
      super
    end
end


Instructions

In script.

Compatibility

Not tested with SDK.

Credits and Thanks


Author's Notes

Enjoy!
Title: Re: [XP] Terrain Step Sound
Post by: Cid on April 27, 2011, 04:32:53 am
Is there a way to specify the volume and pitch of each sound effect?
Title: Re: [XP] Terrain Step Sound
Post by: G_G on April 27, 2011, 08:47:32 am
*Updates*

Now at 1.1, you can now specify volume and pitch for each terrain.
Title: Re: [XP] Terrain Step Sound
Post by: Cid on April 27, 2011, 09:43:41 am
Hmm, I get this error (upon moving the character) whenever I make use of the volume/pitch adjuster:

QuoteScript 'Terrain Sound' line 90: TypeError occured.
cannot convert nil into String


Have I missed something during set-up?
Title: Re: [XP] Terrain Step Sound
Post by: G_G on April 27, 2011, 05:25:31 pm
Fixed. Simple typo, sorry. >.<
Title: Re: [XP] Terrain Step Sound
Post by: Spaceman McConaughey on April 27, 2011, 05:27:35 pm
Glad I gave the OK on this being released. It's much better now. :D

*levels up*
Title: Re: [XP] Terrain Step Sound
Post by: Cid on April 28, 2011, 06:21:48 am
Perfect. Nice work, g_g.
Title: Re: [XP] Terrain Step Sound
Post by: Stray on September 08, 2011, 07:46:25 am
Is there a way to make it with 4-8 sounds for each terrain?
Because always the same sound on a terrain is very annoying. As example: If there is a big area with the same terrain.

Annoying:
http://www.2shared.com/audio/OnpreM-G/Step_H1.html

Not so annoying:
http://www.2shared.com/audio/jAtsh7UX/Step_H2.html
Title: Re: [XP] Terrain Step Sound
Post by: G_G on September 08, 2011, 08:17:29 am
Its possible. But it'd take a bit to do it. If I have the time after school today I'll try and do it.
Title: Re: [XP] Terrain Step Sound
Post by: Stray on September 08, 2011, 08:17:08 pm
Oh god, thank you so much for trying it!
Title: Re: [XP] Terrain Step Sound
Post by: Stray on September 18, 2011, 05:42:51 pm
I wanted to ask again...

also, is it able to make stepsounds for the npcs?
Title: Re: [XP] Terrain Step Sound
Post by: Vexus on June 10, 2012, 06:31:41 am
Sorry for necropost but I'm having a small problem with this script.

I made a small event that makes your character move forward twice, play a sound effect and jump backwards and till there it works but when I move after the event the terrain no longer makes sounds when walking till I open/close menu or enter new map.

Anything I can do to fix it?

Also would be it too hard to have a script call that let's me change the wait for the sound so when your running the stepping sound goes faster and when your walking it goes back to what you write on the script?

Thanks
Title: Re: [XP] Terrain Step Sound
Post by: G_G on June 10, 2012, 12:25:38 pm
I'll look into it Vexux. Gimme about a week. xD My to-do list is getting pretty big.
Title: Re: [XP] Terrain Step Sound
Post by: Vexus on June 10, 2012, 12:57:57 pm
Sure np.

Thanks for adding it to the to-do list :)
Title: Re: [XP] Terrain Step Sound
Post by: toni112007 on June 27, 2012, 11:58:33 am
Hi all im new i have rpg maker xp and this does not work for me as i make this script and do what it says whenever i choose from 0-7 it says cannot find audio/se/fs "name of sound " when in game and game shuts down.
Title: Re: [XP] Terrain Step Sound
Post by: Landith on June 27, 2012, 05:38:40 pm
That means you need that file in your audio folder. So whatever 'name of sound' is put it in that folder 'GAME NAME/Audio/Se/Fs/' or whatever it specifies and you won't get that error anymore.
Title: Re: [XP] Terrain Step Sound
Post by: Blizzard on June 27, 2012, 05:46:42 pm
Just change them in the config.


  Terrains[0] = '001-System01'
 Terrains[1] = 'fs_wood_hard1'
 Terrains[2] = 'fs_grass03'
 Terrains[3] = 'fs_stone_hoof2'
 Terrains[4] = 'as_na_grassmove2'
 Terrains[5] = 'fs_water_hard1'
 Terrains[6] = 'fs_dirt_hard1'
Title: Re: [XP] Terrain Step Sound
Post by: toni112007 on June 28, 2012, 05:53:57 am
Do you know where are that sounds located? i cant find them anywhere :/
sorry im noob at rpg maker xp
Title: Re: [XP] Terrain Step Sound
Post by: G_G on June 28, 2012, 11:20:33 am
In your project's folder. You place the sound effects in "Audio/SE/"
Title: Re: [XP] Terrain Step Sound
Post by: toni112007 on June 28, 2012, 11:35:44 am
I know that but i dont know where are these sound located
001-System01
fs_wood_hard1
fs_grass03
fs_stone_hoof2
as_na_grassmove2
fs_water_hard1
fs_dirt_hard1

I found only 001-system01,but i dont have others where can i get them?
Title: Re: [XP] Terrain Step Sound
Post by: G_G on June 28, 2012, 11:50:18 am
They're not included. It was just an example of how to configure the script. You'll have to provide your own sound effects.
Title: Re: [XP] Terrain Step Sound
Post by: toni112007 on June 28, 2012, 11:55:45 am
ow so i can use my sounds and change name in script of these?

and one more thing sorry for offtop but i need to know how to make light effect
because im making dark horror game and i need light effect for lantern
Title: Re: [XP] Terrain Step Sound
Post by: G_G on June 28, 2012, 12:00:44 pm
Yes, you can use your own sounds. As for the light effect, you're going to have to post that in the Tutorials Request (http://forum.chaos-project.com/index.php/board,28.0.html) board.
Title: Re: [XP] Terrain Step Sound
Post by: toni112007 on June 28, 2012, 02:16:23 pm
Hi again how can i set more sounds for one terrain? because with only one sound for fs it sounds like typewriter.
is there any way to make more sounds for one terrain.etc like i have 3 sounds for one terrain and sound change on each tile/footstep(more realistic) you know what i mean?
Title: Re: [XP] Terrain Step Sound
Post by: G_G on June 28, 2012, 02:37:06 pm
It's not possible with this version of the script, but I could add that possibility in there. I have to update the script anyways to fix the issue Vexus was having.
Title: Re: [XP] Terrain Step Sound
Post by: toni112007 on June 28, 2012, 03:49:27 pm
Yes please :)
Title: Re: [XP] Terrain Step Sound
Post by: Blizzard on June 28, 2012, 04:47:22 pm
Quick idea: You could use an array of strings (instead of just a string) as config. Then you simply pick a string randomly for the sound effect. This can be implemented in, like, 5 minutes.
Title: Re: [XP] Terrain Step Sound
Post by: G_G on June 28, 2012, 09:11:24 pm
That's actually what I had planned. xD I have a job now so I don't just sit at my computer 24/7 like usual. I'll get to it this Saturday, I have it off.
Title: Re: [XP] Terrain Step Sound
Post by: toni112007 on June 29, 2012, 12:58:48 pm
How can i change in game menu when press X
like in this video http://www.youtube.com/watch?v=owgpKA9r-Bg&lc=cOCw26w7YViHrOZ9Z0tgKV2KlNUlev1Mcxgvz38ZLXQ&feature=inbox
Title: Re: [XP] Terrain Step Sound
Post by: ForeverZer0 on June 29, 2012, 01:02:23 pm
Quote from: Blizzard on June 28, 2012, 04:47:22 pm
Quick idea: You could use an array of strings (instead of just a string) as config. Then you simply pick a string randomly for the sound effect. This can be implemented in, like, 5 minutes.


Thats how I did the "Ambient SFX" script I made a long time ago.
Title: Re: [XP] Terrain Step Sound
Post by: toni112007 on July 05, 2012, 10:19:08 am
Could you make script that includes for when left leg moves plays one sound and when right leg moves plays other sound.that way it would be good footstep sound.thx
Title: Re: [XP] Terrain Step Sound
Post by: G_G on July 15, 2012, 06:46:46 pm
Updated to 1.2.

Play rate is now checked through Game_Player's "update_move" method so sounds should always work.
Every terrain must now be an array. Within the array, you can define sounds as a single "string" or as an array with volume and pitch options.
Terrain[0] = ["sound1", "sound2", ["sound3", 100, 0]]

If you only want one sound per terrain, you have the option to only put one sound in. If you don't want any sounds for the terrain, leave it empty.

You can also change the sound rate in game by using a script call.
$game_map.rate = X
X = value (the lower, the more frequent the sounds, 5-10 works weel)


Enjoy!
Title: Re: [XP] Terrain Step Sound
Post by: Vexus on July 15, 2012, 07:14:41 pm
Thanks for updating the script but now I get an error on Blizz Abs Part 2 on line 2219: NoMethodError occurred.

undefined method 'refresh' for #<Game_Player:0x8df1060>

Placing script over Blizz Abs scripts removes the error but no sound plays.
Title: Re: [XP] Terrain Step Sound
Post by: G_G on July 15, 2012, 07:29:48 pm
Go to line 99 and change this
class Game_Player < Game_Character

to
class Game_Player < Map_Actor
Title: Re: [XP] Terrain Step Sound
Post by: Vexus on July 16, 2012, 05:17:02 am
Ok that fixed the first error now I'm getting another when I make a step on a terrain which has a sound.

line 115: TypeError occurred.

cannot convert fixnum into string.

Title: Re: [XP] Terrain Step Sound
Post by: G_G on July 16, 2012, 05:25:29 am
Can you paste your configuration please?
Title: Re: [XP] Terrain Step Sound
Post by: Vexus on July 16, 2012, 05:35:03 am
Sure:

#===============================================================================
# Terrain Step Sound
# Version 1.2
# 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
# Specify an array of sounds for each terrain, allowing random sounds for each step
#
# Instructions:
# Setup the config below, its pretty self explanatory, more instructions
# with config.
#
# You can now change the sound rate in game using a script call.
# $game_map.rate = X
# X = sound rate (the lower the value, the more frequent the sounds)
#
# 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 = 18
  # 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.
  # Each terrain must now be an array. This allows you to define multiple
  # sound effects for each terrain.
  #===========================================================================
  #Terrains[0] = ['001-System01', '002-System02', '003-System03']
  Terrains[1] = 'Wood'
  Terrains[2] = 'Floor'
  Terrains[3] = ''
  Terrains[4] = ''
  Terrains[5] = ''
  Terrains[6] = ''
  #===========================================================================
  # 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.
  # You can also define multiple sound effects with pitch and volume.
  #===========================================================================
  #Terrains[7] = [["sound", 80, 10], "sound2", ["sound3", 50, 0]]
  Terrains[2] = ["Floor", 70, 100]
  #===========================================================================
  # 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", "sound file2", etc...]
  # 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] = "Floor"
  Tilesets[1][1] = ["Floor", 50, 100]
  #
  Tilesets[54] = []
  #Tilesets[54][1] = "Metal Step"
  Tilesets[54][1] = ["Metal Step", 80, 100]
end
class Game_Map
 
  attr_accessor :rate
 
  alias gg_init_terrain_sounds_map_lat initialize
  def initialize
    @rate = TSS::Wait
    return gg_init_terrain_sounds_map_lat
  end
 
  def terrain_sound
    if TSS::Tilesets[@map.tileset_id] != nil
      sounds = TSS::Tilesets[@map.tileset_id][$game_player.terrain_tag]
    else
      sounds = TSS::Terrains[$game_player.terrain_tag]
    end
    return nil if sounds == nil || !sounds.is_a?(Array) || sounds.size < 1
    sound = sounds[rand(sounds.size)]
    if sound.is_a?(Array)
      return [sound[0], sound[1], sound[2]]
    else
      return [sound, 100, 0]
    end
  end
 
end

class Game_Player < Map_Actor
 
  def update_move
    @timer = $game_map.rate if @timer == nil
    @timer -= 1
    if @timer < 1
      terrain = $game_map.terrain_sound
      if terrain != nil
        vol = terrain[1]
        pit = terrain[2]
        son = terrain[0]
        Audio.se_play('Audio/SE/' + son, vol, pit)
      end
      @timer = $game_map.rate
    end
    super
  end
 
end
Title: Re: [XP] Terrain Step Sound
Post by: G_G on July 16, 2012, 06:28:08 am
This is your issue. Each sound or sound array, needs to be in an array itself.
Tilesets[54][1] = ["Metal Step", 80, 100]

To
Tilesets[54][1] = [["Metal Step", 80, 100]]


Along with these options as well.
Terrains[1] = 'Wood'
  Terrains[2] = 'Floor'
  Terrains[3] = ''
  Terrains[4] = ''
  Terrains[5] = ''
  Terrains[6] = ''
Terrains[2] = ["Floor", 70, 100]

Tilesets[1][0] = "Floor"
  Tilesets[1][1] = ["Floor", 50, 100]


All need to be wrapped in  [ ]
Title: Re: [XP] Terrain Step Sound
Post by: Vexus on July 16, 2012, 08:59:18 am
Ok that fixed it thanks :)

Now I'll try the feature you implemented for me to see if it's how I wanted it. (I'll update post if it gives me problems or whatever.)

[Edit]

Works perfectly, your awesome :)

+1
Title: Re: [XP] Terrain Step Sound
Post by: Vexus on August 06, 2012, 02:03:36 pm
Anyway I can disable/enable this script?

In the beginning of my game your bare footed and I don't want to have the stepping sounds I have produced by shoes.

Thanks
Title: Re: [XP] Terrain Step Sound
Post by: ForeverZer0 on August 06, 2012, 07:30:39 pm
Place this below G_G's script.

class Game_Map
 
 SOUND_SWITCH_ID = 1
 
 alias toggle_sound terrain_sound
 def terrain_sound
   if $game_switches[SOUND_SWITCH_ID]
     toggle_sound
   end
 end
end


Set the ID of the switch for controlling the script. When the switch is false, the script is "off".
Title: Re: [XP] Terrain Step Sound
Post by: Vexus on August 07, 2012, 08:49:04 am
Thanks it worked.
Title: Re: [XP] Terrain Step Sound
Post by: Stray on February 12, 2013, 09:30:51 pm
Thanks for giving this script. I think the ABS correcting from page 2 is important to mention it on the page 1, because many people want to use both I guess.

Is there a chance to have a second waiting time/rate between steps for Blizz-ABS-running?
Title: Re: [XP] Terrain Step Sound
Post by: Stray on March 07, 2013, 11:45:37 am
bumpy
Title: Re: [XP] Terrain Step Sound
Post by: Zexion on June 26, 2015, 04:30:58 pm
So I use this in my project and I needed to add a few things to get the effects i wanted. I figured I'd post this here. It works exactly as the original but with a few extra features.
Spoiler: ShowHide
#===============================================================================
# Terrain Step Sound + Events
# Version 1.3
# Author game_guy
# New Features by Zexion
#-------------------------------------------------------------------------------
# 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
# Specify an array of sounds for each terrain, allowing random sounds for each step
# Specify events that can play these sounds.
#
# Instructions:
# Setup the config below, its pretty self explanatory, more instructions
# with config.
#
# You can now change the sound rate in game using a script call.
# $game_map.rate = X
# X = sound rate (the lower the value, the more frequent the sounds)
#
# Add the Name_Tag ("steps" by default) to the event page name (without quotes)
# to add dynamic footstep sounds to that event.
#
# Credits:
# game_guy ~ For creating it
# Tuggernuts ~ For requesting it a long time ago
# Sase ~ For also requeseting it
# Zex - For the Event & move_speed edit
# kk20 - for listening to zex's complaints
#===============================================================================
module TSS
 # Adjust this to your liking
 Wait = 20
 Name_Tag = "steps"
 # Ignore this
 Terrains, Tilesets = [], []
 #===========================================================================
 # Enter in sounds for each terrain tag
 # Goes from 0-8. Set as nil to disable that terrain or delete the line.
 # Each terrain must now be an array. This allows you to define multiple
 # sound effects for each terrain.
 #===========================================================================
 Terrains[0] = []
 Terrains[1] = [["FS - 03 - Wood", 40, 0],["FS - 04 - Wood", 40, 0]]
 Terrains[2] = ['FS - 05 - Metal']
 Terrains[3] = ['FS - 07 - Hollow Metal']
 Terrains[4] = [["FS - 09 - Concrete", 40, 0]]
 Terrains[5] = [["FS - 11 - Dirt", 40, 0],["FS - 11 - Dirt", 40, 0]]
 Terrains[6] = [["FS - 13 - Grass", 40, 0], ["FS - 14 - Grass", 40, 0]]
 #===========================================================================
 # 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.
 # You can also define multiple sound effects with pitch and volume.
 #===========================================================================
 Terrains[7] = [["FS - 01 - Water", 50, 0],["FS - 02 - Water", 50, 0]]
 #===========================================================================
 # 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", "sound file2", etc...]
 # 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.
 #===========================================================================
end
#-------------------------------------------------------------------------------
# Game_Map
#-------------------------------------------------------------------------------
class Game_Map
 attr_accessor :map          # make public
end
#-------------------------------------------------------------------------------
# Game_Character
#-------------------------------------------------------------------------------
# Adds Gameus's terrain_sound method to game_character.
#-------------------------------------------------------------------------------
class Game_Character
 attr_accessor :move_speed   # make public
 #-----------------------------------------------------------------------------
 # Initialize ss_index
 #-----------------------------------------------------------------------------
 alias g_c_sfe_init initialize
 def initialize
   g_c_sfe_init
   @ss_index = 0
   @timer = 0
   @tss_speed = @move_speed
   set_tss_offset
 end
 #-----------------------------------------------------------------------------
 # Updates the timer when needed
 #-----------------------------------------------------------------------------
 alias g_c_sfe_update update
 def update
   g_c_sfe_update
   @timer -= 1 if @timer > 0
   if @tss_speed != self.move_speed
     set_tss_offset
   end
 end
 #-----------------------------------------------------------------------------
 # Sets the sound offset
 #-----------------------------------------------------------------------------
 def set_tss_offset    
   # Timer offset by movespeed
   case self.move_speed
   when 0..2
     @tss_offset = TSS::Wait + self.move_speed
   when 3
     @tss_offset = TSS::Wait
   else
     @tss_offset = TSS::Wait - self.move_speed * 2
   end
 end
 #-----------------------------------------------------------------------------
 # Returns the array to be used later
 #-----------------------------------------------------------------------------
 def terrain_sound
   if TSS::Tilesets[$game_map.map.tileset_id] != nil
     sounds = TSS::Tilesets[$game_map.map.tileset_id][self.terrain_tag]
   else
     sounds = TSS::Terrains[self.terrain_tag]
   end
   return nil if sounds == nil || !sounds.is_a?(Array) || sounds.size < 1
   index_max = sounds.size - 1
   @ss_index = (@ss_index < index_max) ? (@ss_index + 1) : 0
   sound = sounds[@ss_index]
   if sound.is_a?(Array)
     return [sound[0], sound[1], sound[2]]
   else
     return [sound, 100, 0]
   end
 end
end
#-------------------------------------------------------------------------------
# Game_Player
#-------------------------------------------------------------------------------
Tss_Parent = $BlizzABS ? (Map_Actor) : (Game_Character)
class Game_Player < Tss_Parent
 #-----------------------------------------------------------------------------
 # Adds step sounds to the player
 #-----------------------------------------------------------------------------
 def update_move
   # Make sure this is the player
   if self != $game_event && @timer == 0
     # Play the sound effect
     terrain = self.terrain_sound
     if terrain != nil
       vol = terrain[1]
       pit = terrain[2]
       son = terrain[0]
       Audio.se_play('Audio/SE/' + son, vol, pit)
     end
     # Set timer
     @timer = @tss_offset
   end
   # Call original code
   super
 end
end
#-------------------------------------------------------------------------------
# Game_Event
#-------------------------------------------------------------------------------
class Game_Event < Game_Character
 #-----------------------------------------------------------------------------
 # Set the variable for checking if the event should make a sound
 #-----------------------------------------------------------------------------
 alias g_e_sfe_init initialize
 def initialize(map_id, event)
   g_e_sfe_init(map_id, event)
   @tss = self.name.include?(TSS::Name_Tag) ? true : false
 end
  #--------------------------------------------------------------------------
  # * Returns the event's name
  #--------------------------------------------------------------------------
  def name
    return @event.name
  end
 #-----------------------------------------------------------------------------
 # Returns the distance of this event from the player
 #-----------------------------------------------------------------------------
 def range?
   if $BlizzABS && BlizzABS::Config::PIXEL_MOVEMENT_RATE == 1
     player_x = $game_player.x / 2 # Adjusted for 1.0 pixel movement rate
     player_y = $game_player.y / 2 # Adjusted for 1.0 pixel movement rate
   else
     player_x = $game_player.x
     player_y = $game_player.y
   end
   radius = (Math.hypot((self.x - player_x), (self.y - player_y))).abs.floor
   return (radius)
 end
 #-----------------------------------------------------------------------------
 # Adds step sounds to the event with dynamic volume
 #-----------------------------------------------------------------------------
 def update_move
   # Check if the event should play a sound
   if @tss
     # Make sure it's an event
     if self != $game_player
       # Check if the event is anywhere near the player
       if range? <= 6 && @timer == 0
         # The amount to subtract from the normal volume
         sub_vol = 4 * range?
         # Play the sound effect
         terrain = self.terrain_sound
           if terrain != nil
             vol = terrain[1]
             pit = terrain[2]
             son = terrain[0]
             # Dynamic sound edit
             vol = vol - sub_vol
             vol = 0 if vol < 0
             Audio.se_play('Audio/SE/' + son, vol, pit)
           end
           # Set timer
           @timer = @tss_offset
         end
       end
     end
     # Call original code
     super
   end
end

New Features:

To make an event have step sounds add "steps" to the event page name.
The whole system is now compatible with blizz-abs, but only with a pixel move rate of 0 or 1. (Couldn't figure out the player coords at the higher values)
Title: Re: [XP] Terrain Step Sound
Post by: danleon950410 on August 26, 2016, 09:29:10 am
Quote from: Zexion on June 26, 2015, 04:30:58 pm
So I use this in my project and I needed to add a few things to get the effects i wanted. I figured I'd post this here. It works exactly as the original but with a few extra features.
Spoiler: ShowHide
#===============================================================================
# Terrain Step Sound + Events
# Version 1.3
# Author game_guy
# New Features by Zexion
#-------------------------------------------------------------------------------
# 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
# Specify an array of sounds for each terrain, allowing random sounds for each step
# Specify events that can play these sounds.
#
# Instructions:
# Setup the config below, its pretty self explanatory, more instructions
# with config.
#
# You can now change the sound rate in game using a script call.
# $game_map.rate = X
# X = sound rate (the lower the value, the more frequent the sounds)
#
# Add the Name_Tag ("steps" by default) to the event page name (without quotes)
# to add dynamic footstep sounds to that event.
#
# Credits:
# game_guy ~ For creating it
# Tuggernuts ~ For requesting it a long time ago
# Sase ~ For also requeseting it
# Zex - For the Event & move_speed edit
# kk20 - for listening to zex's complaints
#===============================================================================
module TSS
  # Adjust this to your liking
  Wait = 20
  Name_Tag = "steps"
  # Ignore this
  Terrains, Tilesets = [], []
  #===========================================================================
  # Enter in sounds for each terrain tag
  # Goes from 0-8. Set as nil to disable that terrain or delete the line.
  # Each terrain must now be an array. This allows you to define multiple
  # sound effects for each terrain.
  #===========================================================================
  Terrains[0] = []
  Terrains[1] = [["FS - 03 - Wood", 40, 0],["FS - 04 - Wood", 40, 0]]
  Terrains[2] = ['FS - 05 - Metal']
  Terrains[3] = ['FS - 07 - Hollow Metal']
  Terrains[4] = [["FS - 09 - Concrete", 40, 0]]
  Terrains[5] = [["FS - 11 - Dirt", 40, 0],["FS - 11 - Dirt", 40, 0]]
  Terrains[6] = [["FS - 13 - Grass", 40, 0], ["FS - 14 - Grass", 40, 0]]
  #===========================================================================
  # 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.
  # You can also define multiple sound effects with pitch and volume.
  #===========================================================================
  Terrains[7] = [["FS - 01 - Water", 50, 0],["FS - 02 - Water", 50, 0]]
  #===========================================================================
  # 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", "sound file2", etc...]
  # 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.
  #===========================================================================
end
#-------------------------------------------------------------------------------
# Game_Map
#-------------------------------------------------------------------------------
class Game_Map
  attr_accessor :map          # make public
end
#-------------------------------------------------------------------------------
# Game_Character
#-------------------------------------------------------------------------------
# Adds Gameus's terrain_sound method to game_character.
#-------------------------------------------------------------------------------
class Game_Character
  attr_accessor :move_speed   # make public
  #-----------------------------------------------------------------------------
  # Initialize ss_index
  #-----------------------------------------------------------------------------
  alias g_c_sfe_init initialize
  def initialize
    g_c_sfe_init
    @ss_index = 0
    @timer = 0
    @tss_speed = @move_speed
    set_tss_offset
  end
  #-----------------------------------------------------------------------------
  # Updates the timer when needed
  #-----------------------------------------------------------------------------
  alias g_c_sfe_update update
  def update
    g_c_sfe_update
    @timer -= 1 if @timer > 0
    if @tss_speed != self.move_speed
      set_tss_offset
    end
  end
  #-----------------------------------------------------------------------------
  # Sets the sound offset
  #-----------------------------------------------------------------------------
  def set_tss_offset   
    # Timer offset by movespeed
    case self.move_speed
    when 0..2
      @tss_offset = TSS::Wait + self.move_speed
    when 3
      @tss_offset = TSS::Wait
    else
      @tss_offset = TSS::Wait - self.move_speed * 2
    end
  end
  #-----------------------------------------------------------------------------
  # Returns the array to be used later
  #-----------------------------------------------------------------------------
  def terrain_sound
    if TSS::Tilesets[$game_map.map.tileset_id] != nil
      sounds = TSS::Tilesets[$game_map.map.tileset_id][self.terrain_tag]
    else
      sounds = TSS::Terrains[self.terrain_tag]
    end
    return nil if sounds == nil || !sounds.is_a?(Array) || sounds.size < 1
    index_max = sounds.size - 1
    @ss_index = (@ss_index < index_max) ? (@ss_index + 1) : 0
    sound = sounds[@ss_index]
    if sound.is_a?(Array)
      return [sound[0], sound[1], sound[2]]
    else
      return [sound, 100, 0]
    end
  end
end
#-------------------------------------------------------------------------------
# Game_Player
#-------------------------------------------------------------------------------
Tss_Parent = $BlizzABS ? (Map_Actor) : (Game_Character)
class Game_Player < Tss_Parent
  #-----------------------------------------------------------------------------
  # Adds step sounds to the player
  #-----------------------------------------------------------------------------
  def update_move
    # Make sure this is the player
    if self != $game_event && @timer == 0
      # Play the sound effect
      terrain = self.terrain_sound
      if terrain != nil
        vol = terrain[1]
        pit = terrain[2]
        son = terrain[0]
        Audio.se_play('Audio/SE/' + son, vol, pit)
      end
      # Set timer
      @timer = @tss_offset
    end
    # Call original code
    super
  end
end
#-------------------------------------------------------------------------------
# Game_Event
#-------------------------------------------------------------------------------
class Game_Event < Game_Character
  #-----------------------------------------------------------------------------
  # Set the variable for checking if the event should make a sound
  #-----------------------------------------------------------------------------
  alias g_e_sfe_init initialize
  def initialize(map_id, event)
    g_e_sfe_init(map_id, event)
    @tss = self.name.include?(TSS::Name_Tag) ? true : false
  end
  #--------------------------------------------------------------------------
  # * Returns the event's name
  #--------------------------------------------------------------------------
  def name
    return @event.name
  end
  #-----------------------------------------------------------------------------
  # Returns the distance of this event from the player
  #-----------------------------------------------------------------------------
  def range?
    if $BlizzABS && BlizzABS::Config::PIXEL_MOVEMENT_RATE == 1
      player_x = $game_player.x / 2 # Adjusted for 1.0 pixel movement rate
      player_y = $game_player.y / 2 # Adjusted for 1.0 pixel movement rate
    else
      player_x = $game_player.x
      player_y = $game_player.y
    end
    radius = (Math.hypot((self.x - player_x), (self.y - player_y))).abs.floor
    return (radius)
  end
  #-----------------------------------------------------------------------------
  # Adds step sounds to the event with dynamic volume
  #-----------------------------------------------------------------------------
  def update_move
    # Check if the event should play a sound
    if @tss
      # Make sure it's an event
      if self != $game_player
        # Check if the event is anywhere near the player
        if range? <= 6 && @timer == 0
          # The amount to subtract from the normal volume
          sub_vol = 4 * range?
          # Play the sound effect
          terrain = self.terrain_sound
            if terrain != nil
              vol = terrain[1]
              pit = terrain[2]
              son = terrain[0]
              # Dynamic sound edit
              vol = vol - sub_vol
              vol = 0 if vol < 0
              Audio.se_play('Audio/SE/' + son, vol, pit)
            end
            # Set timer
            @timer = @tss_offset
          end
        end
      end
      # Call original code
      super
    end
end

New Features:

  • Rate between sounds is now tied with move_speed

  • Events can now have step sounds aswell. These are dynamic (get louder as they approach the player)


To make an event have step sounds add "steps" to the event page name.
The whole system is now compatible with blizz-abs, but only with a pixel move rate of 0 or 1. (Couldn't figure out the player coords at the higher values)


Thank you so much, Zexion! It's an amazing modification to an amazing script and it sure brings ambientation to a deeper level!
Only flaw i've seen so far is that after using the running and sneaking functions of the Blizz ABS System the rate between sounds gets stuck and won't return to walking/normal speed rate. Sure it changes between the running and sneaking rates flawlessly, but when you release the key to just walk at normal speed there's no change, you're stuck in the previous rate.
I've been trying to solve it for a week but i can't seem to figure it out.
Title: Re: [XP] Terrain Step Sound
Post by: KK20 on August 27, 2016, 08:32:51 pm
Find this part in the script and replace it:

  #-----------------------------------------------------------------------------
  # Updates the timer when needed
  #-----------------------------------------------------------------------------
  alias g_c_sfe_update update
  def update
    g_c_sfe_update
    @timer -= 1 if @timer > 0
    if @tss_speed != self.move_speed
      @tss_speed = self.move_speed
      set_tss_offset
    end
  end
Title: Re: [XP] Terrain Step Sound
Post by: danleon950410 on August 28, 2016, 06:52:50 pm
Quote from: KK20 on August 27, 2016, 08:32:51 pm
Find this part in the script and replace it:

  #-----------------------------------------------------------------------------
  # Updates the timer when needed
  #-----------------------------------------------------------------------------
  alias g_c_sfe_update update
  def update
    g_c_sfe_update
    @timer -= 1 if @timer > 0
    if @tss_speed != self.move_speed
      @tss_speed = self.move_speed
      set_tss_offset
    end
  end


I can't thank you enough, it works flawlessly!!! You saved my life!
Thank you, thank you very much! This makes me extremely happy!
You have my infinite gratitude
Title: Re: [XP] Terrain Step Sound
Post by: AmareusRedink on September 08, 2019, 12:46:29 am
I have a problem with the Tileset part, always makes me the error undefined method, ¿What happen?
Title: Re: [XP] Terrain Step Sound
Post by: KK20 on September 08, 2019, 01:08:56 am
Can you provide the full message of the error? And your configuration
Title: Re: [XP] Terrain Step Sound
Post by: AmareusRedink on September 08, 2019, 01:13:59 am
#===============================================================================
# Terrain Step Sound
# Version 1.2
# 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
# Specify an array of sounds for each terrain, allowing random sounds for each step
#
# Instructions:
# Setup the config below, its pretty self explanatory, more instructions
# with config.
#
# You can now change the sound rate in game using a script call.
# $game_map.rate = X
# X = sound rate (the lower the value, the more frequent the sounds)
#
# 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 = 10
  # 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.
  # Each terrain must now be an array. This allows you to define multiple
  # sound effects for each terrain.
  #===========================================================================
  Terrains
[li]= ['001-System01', '002-System02', '003-System03'][/li]
  Terrains[1] = ['TalkAngryBirds']
  Terrains[2] = ['fs_grass03']
  Terrains[3] = ['fs_stone_hoof2']
  Terrains[4] = ['as_na_grassmove2']
  Terrains[5] = ['fs_water_hard1']
  Terrains[6] = ['fs_dirt_hard1']
  #===========================================================================
  # 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.
  # You can also define multiple sound effects with pitch and volume.
  #===========================================================================
  Terrains[1] = ["TalkAngryBirds", 100, 0]
  #===========================================================================
  # 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", "sound file2", etc...]
  # 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]
[li]= "Floor"[/li]
  Tilesets[1][1] = ["Floor", 50, 100]
  #
  Tilesets[1]
[li]= "TalkAngryBirds"[/li]
  Tilesets[52][1] = ["TalkAngryBirds", 100, 0]
end
class Game_Map
 
  attr_accessor :rate
 
  alias gg_init_terrain_sounds_map_lat initialize
  def initialize
    @rate = TSS::Wait
    return gg_init_terrain_sounds_map_lat
  end
 
  def terrain_sound
    if TSS::Tilesets[@map.tileset_id] != nil
      sounds = TSS::Tilesets[@map.tileset_id][$game_player.terrain_tag]
    else
      sounds = TSS::Terrains[$game_player.terrain_tag]
    end
    return nil if sounds == nil || !sounds.is_a?(Array) || sounds.size < 1
    sound = sounds[rand(sounds.size)]
    if sound.is_a?(Array)
      return [sound
[li], sound[1], sound[2]][/li]
    else
      return [sound, 100, 0]
    end
  end
 
end

class Game_Player < Game_Character
 
  def update_move
    @timer = $game_map.rate if @timer == nil
    @timer -= 1
    if @timer < 1
      terrain = $game_map.terrain_sound
      if terrain != nil
        vol = terrain[1]
        pit = terrain[2]
        son = terrain        Audio.se_play('Audio/SE/' + son, vol, pit)
      end
      @timer = $game_map.rate
    end
    super
  end
 
end
And the error says: Script "floorstepsxd" line 73:NoMethodError ocurred.

                   undefined method '[]=' for nil:NilClass
Title: Re: [XP] Terrain Step Sound
Post by: KK20 on September 08, 2019, 02:04:10 am
Your configuration is wrong clearly. Pointing out this in particular:
  Tilesets[1] = []
  Tilesets[1][0] = "Floor"
  Tilesets[1][1] = ["Floor", 50, 100]
  #
  Tilesets[1][0] = "TalkAngryBirds"
  Tilesets[52][1] = ["TalkAngryBirds", 100, 0]
So the first set is almost correct: You just need to put "Floor" in an array like the example showed.
Tilesets[1][0] = ["Floor"]

The "TalkAngryBirds" section is completely wrong. First off, you're overwriting the value stored in Tilesets[1][0], which originally contained "Floor", to "TalkAngryBirds". Not to mention, you need to put it in an array too.

Secondly, you forgot to initialize Tilesets[52] to an empty array like the first set did.
Tilesets[52] = []
That is the reason why you are getting the error.

From the looks of things, I believe you don't really know what you're doing. Please explain and I can point you to the right direction in configuring it properly.
Title: Re: [XP] Terrain Step Sound
Post by: AmareusRedink on September 08, 2019, 12:45:59 pm
In fact, I don't even know what I do, I even say that I lasted almost all day on this. ejem, I already "fix" and I reorganized it, and the game has already started, but it happens that the sound that is supposed to be heard should not be heard, ¿I missed something?

Tilesets[52] = []
  Tilesets[52][0] = ["TalkAngryBirds"]
  Tilesets[52][1] = ["TalkAngryBirds", 100, 0]
Title: Re: [XP] Terrain Step Sound
Post by: KK20 on September 08, 2019, 04:33:42 pm
I also forgot to mention in the previous post that if you specify a volume and pitch, you need to wrap those around an array too. Otherwise you'll get some Fixnum conversion error.
Tilesets[1][1] = [["Floor", 50, 100]]

Tilesets[52][1] = [["TalkAngryBirds", 100, 0]]

So you're saying that you have made an entry in your Tileset Database with an ID of 52, changed the Terrain Tag for some of those tiles to either 0 or 1, and there is a sound effect in your Audio/SE folder named 'TalkAngryBirds'?
Title: Re: [XP] Terrain Step Sound
Post by: AmareusRedink on September 08, 2019, 04:45:31 pm
The 1 and 0 that I put is just a test, they are not the same sound to see which one works, I regret my ignorance, ¿but is it necessary to put the "Floor" or is a example?
Title: Re: [XP] Terrain Step Sound
Post by: KK20 on September 08, 2019, 04:52:09 pm
I thought "Floor" was your doing :O.o: . In the original script, it's "Sound":
  Tilesets[2] = []
  Tilesets[2][0] = ["Sound"]
  Tilesets[2][1] = [["sound", 75, 50]]
If you're not using "Floor" then remove it.
Title: Re: [XP] Terrain Step Sound
Post by: AmareusRedink on September 08, 2019, 05:06:40 pm
 sorry for doing this hard with this subject, but this is how I have the configuration now:

 Terrains[0] = ['001-System01', '002-System02', '003-System03']
  Terrains[1] = ['TalkAngryBirds']
  Terrains[2] = ['fs_grass03']
  Terrains[3] = ['fs_stone_hoof2']
  Terrains[4] = ['as_na_grassmove2']
  Terrains[5] = ['fs_water_hard1']
  Terrains[6] = ['fs_dirt_hard1']
  #===========================================================================
  # 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.
  # You can also define multiple sound effects with pitch and volume.
  #===========================================================================
  Terrains[1] = [['TalkAngryBirds', 50, 100]]
  #===========================================================================
  # 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", "sound file2", etc...]
  # 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[52] = []
  Tilesets[52][1] = [["TalkAngryBirds", 50, 100]]
  #
the problem that does not start has been resolved, thanks, but it happens that the test sound I try to make is not heard sorry, but this is the first time I handle this type of scripts (I am a Beginner) :wacko:
Title: Re: [XP] Terrain Step Sound
Post by: KK20 on September 08, 2019, 05:21:12 pm
Please use code tags when pasting large blocks of code. [ code ] and [ /code ] without the spaces

At this point I'd need you to upload a demo of your project. This doesn't problem does not appear to be script related.
Title: Re: [XP] Terrain Step Sound
Post by: AmareusRedink on September 08, 2019, 06:09:53 pm
I send the "demo" in your inbox http://www.mediafire.com/file/ywkg6tups8sc0gn/prueba.rar/file
Title: Re: [XP] Terrain Step Sound
Post by: AmareusRedink on September 13, 2019, 01:42:33 am
and the end the problem was one of the scripts I used, Bruh.
Title: Re: [XP] Terrain Step Sound
Post by: AmareusRedink on October 25, 2019, 03:48:50 pm
Does anyone know how to make events such as people walking heard with this script?
Title: Re: [XP] Terrain Step Sound
Post by: KK20 on October 25, 2019, 03:58:14 pm
Did you look at https://forum.chaos-project.com/index.php/topic,9460.msg192088.html#msg192088

Sounds like all you need to do is open the event you want to play sounds, and at the top left where you can name your event, just put steps somewhere in it.
Title: Re: [XP] Terrain Step Sound
Post by: Pelip on January 05, 2020, 12:59:25 pm
It's possible to make this script compatible with Cogwheel's Pixel Movement script?
Title: Re: [XP] Terrain Step Sound
Post by: KK20 on January 05, 2020, 10:18:37 pm
No.

The user before you (AmareusRedink) reported the same issue for the same pixel movement script.
Title: Re: [XP] Terrain Step Sound
Post by: whitespirits on September 21, 2020, 05:07:19 am
is this avail for vx ace? its the easiest and simplest I can find but I need vx ace
Title: Re: [XP] Terrain Step Sound
Post by: KK20 on September 21, 2020, 01:04:26 pm
Did you try Victor's step sound? It's the first thing that pops up in a google search.
Title: Re: [XP] Terrain Step Sound
Post by: whitespirits on September 22, 2020, 12:33:38 pm
Hi man, it requires his module which is a little annoying
Title: Re: [XP] Terrain Step Sound
Post by: KK20 on September 22, 2020, 01:04:52 pm
Annoying how? This is pretty much your only option if google doesn't list any other results.
Title: Re: [XP] Terrain Step Sound
Post by: whitespirits on September 22, 2020, 01:09:44 pm
I will try it with his module, just wanted something simple without extras