Terrain Step Sound
Authors: game_guy
Version: 1.3
Type: Environment Add-on
Key Term: Environment Add-on
IntroductionCreate 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 to allow multiple sounds per terrain
ScreenshotsN/A
Screenshots can't produce sound.
DemoN/A
Links can't produce sound either.
Script#===============================================================================
# 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
#===============================================================================
# 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
InstructionsIn script.
CompatibilityNot tested with SDK.
Credits and Thanks- game_guy ~ For creating it
- Tuggernuts ~ For requesting it a long time ago
- Sase ~ For also requeseting it
Author's NotesEnjoy!
Is there a way to specify the volume and pitch of each sound effect?
*Updates*
Now at 1.1, you can now specify volume and pitch for each terrain.
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?
Fixed. Simple typo, sorry. >.<
Glad I gave the OK on this being released. It's much better now. :D
*levels up*
Perfect. Nice work, g_g.
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
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.
Oh god, thank you so much for trying it!
I wanted to ask again...
also, is it able to make stepsounds for the npcs?
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
I'll look into it Vexux. Gimme about a week. xD My to-do list is getting pretty big.
Sure np.
Thanks for adding it to the to-do list :)
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.
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.
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'
Do you know where are that sounds located? i cant find them anywhere :/
sorry im noob at rpg maker xp
In your project's folder. You place the sound effects in "Audio/SE/"
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?
They're not included. It was just an example of how to configure the script. You'll have to provide your own sound effects.
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
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.
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?
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.
Yes please :)
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.
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.
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
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.
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
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!
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.
Go to line 99 and change this
class Game_Player < Game_Character
to
class Game_Player < Map_Actor
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.
Can you paste your configuration please?
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
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 [ ]
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
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
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".
Thanks it worked.
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?
bumpy
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.
#===============================================================================
# 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)
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.
#===============================================================================
# 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.
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
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
I have a problem with the Tileset part, always makes me the error undefined method, ¿What happen?
Can you provide the full message of the error? And your configuration
#===============================================================================
# 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
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.
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.
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]
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'?
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?
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.
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:
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.
I send the "demo" in your inbox http://www.mediafire.com/file/ywkg6tups8sc0gn/prueba.rar/file
and the end the problem was one of the scripts I used, Bruh.
Does anyone know how to make events such as people walking heard with this script?
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.
It's possible to make this script compatible with Cogwheel's Pixel Movement script?
No.
The user before you (AmareusRedink) reported the same issue for the same pixel movement script.
is this avail for vx ace? its the easiest and simplest I can find but I need vx ace
Did you try Victor's step sound? It's the first thing that pops up in a google search.
Hi man, it requires his module which is a little annoying
Annoying how? This is pretty much your only option if google doesn't list any other results.
I will try it with his module, just wanted something simple without extras