I was reading this thread here
http://www.rmxp.org/forums/index.php?topic=12980
And I thought it would be pretty cool to script different sounds for different terrain tags. But so far I haven't gotten any luck of how to do this right.
Here's the edit I've made so far. But no matter what I do. It either makes the same sound play for every terrain, or it doesn't play a sound at all
Any pointers?
http://www.rmxp.org/forums/index.php?topic=12980
And I thought it would be pretty cool to script different sounds for different terrain tags. But so far I haven't gotten any luck of how to do this right.
Here's the edit I've made so far. But no matter what I do. It either makes the same sound play for every terrain, or it doesn't play a sound at all
#==============================================================================
# ** Hear_Steps
#------------------------------------------------------------------------------
# by arevulopapo
# 9.11.2006
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
attr_accessor :hear_steps
attr_accessor :step_sound
attr_accessor :water_sound
#--------------------------------------------------------------------------
alias hs_init initialize
def initialize
hs_init
@hear_steps = false
@step_sound = "Audio/SE/Walk"
@water_sound = "Audio/SE/splash"
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
if terrain_tag = 1
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
if terrain_tag = 2
volume = 100 - 5 * Math.sqrt((self.x - $game_player.x)**2 + (self.y - $game_player.y)**2)
Audio.se_play(@water_sound, volume, 100)
end
end
end
hs_update
end
end
# ** Hear_Steps
#------------------------------------------------------------------------------
# by arevulopapo
# 9.11.2006
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
attr_accessor :hear_steps
attr_accessor :step_sound
attr_accessor :water_sound
#--------------------------------------------------------------------------
alias hs_init initialize
def initialize
hs_init
@hear_steps = false
@step_sound = "Audio/SE/Walk"
@water_sound = "Audio/SE/splash"
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
if terrain_tag = 1
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
if terrain_tag = 2
volume = 100 - 5 * Math.sqrt((self.x - $game_player.x)**2 + (self.y - $game_player.y)**2)
Audio.se_play(@water_sound, volume, 100)
end
end
end
hs_update
end
end