I'm reposting this script, since there's a request around :]
This script lets you hear the steps sound for any character on the map (if you wish so). The sound is louder the closer the character is.
Place this code above "Main":
This line:
determines the default sound for every character. If you want to change it use the "Call script" event command:
Where "id" is the id of an event.
To enable the sound (which is disabled by default) also use a "Call script" command:
If id = 0 the command will refer to the event it's being called by, if it's -1 it's for the player. Any number greater than 0 stands for event id.
For turning the sound off use:
rather than:
It's said that it works better in the Game_Character class.
This script requires of course the sounds that are to be played.
You'll find them in the attached demo (don't bother different resolution).
Credits to me, and thanks to DerVVulfman for aliasing he methods and switching tips.
This script lets you hear the steps sound for any character on the map (if you wish so). The sound is louder the closer the character is.
Place this code above "Main":
Code:
#==============================================================================
# ** Hear_Steps
#------------------------------------------------------------------------------
# by arevulopapo
# 9.11.2006
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
attr_accessor :hear_steps
attr_accessor :step_sound
#--------------------------------------------------------------------------
alias hs_init initialize
def initialize
hs_init
@hear_steps = false
@step_sound = "Audio/SE/walk01"
end
alias hs_update update
def update
if self.moving? and self.hear_steps == true and (Graphics.frame_count + 2 * self.id) % (18 - @move_speed) == 0
if self.screen_x > 0 and self.screen_x < 640 and self.screen_y > 0 and self.screen_y < 480
volume = 100 - 5 * Math.sqrt((self.x - $game_player.x)**2 + (self.y - $game_player.y)**2)
Audio.se_play(@step_sound, volume, 100)
end
end
hs_update
end
end
This line:
Code:
@step_sound = "Audio/SE/walk01"
Code:
get_character(id).step_sound = "Audio/SE/walk03"
To enable the sound (which is disabled by default) also use a "Call script" command:
Code:
get_character(id).hear_steps = true
For turning the sound off use:
Code:
get_character(id).hear_steps = nil
Code:
get_character(id).hear_steps = false
This script requires of course the sounds that are to be played.
You'll find them in the attached demo (don't bother different resolution).
Credits to me, and thanks to DerVVulfman for aliasing he methods and switching tips.