#==============================================================================
# ■ Ryusa FootstepSE
#------------------------------------------------------------------------------
# 脚步声系统 v1.00 by Ryusa - Responced Footstep Sound Playback System
# ·实现了不同的地图标识响应不同的脚步声 - Multi-terrain ID with different sounds
# ·同类脚步声随机化 - Randomized sounds in every terrain type to make it more immersive!
# 未来计划改进: - Future update plant
# ·不同护甲类型(轻、重、魔法)反馈不同脚步声 - Playing back with different armor type: Light, Heavy and Magic
# ·层叠元件的脚步声区分(通过判断方向)
#------------------------------------------------------------------------------
# 素材来源申明 - WAV Resources Announcement
# 整合自《上古卷轴Ⅴ:天际》的 "IMMERSIVE SOUNDS - COMPENDIUM" MOD 资源包 by lazygecko
# 原素材(脚步声部分)来自 freesound.org 的如下贡献者:
# ABouch, Halleck, DasDeer, Corsica-S, ddunkley, nickb1608, mallement,
# Vosvoy, RutgerMuller, jwb4, cheeseheadburger, martinimeniscus
#==============================================================================
# Requirements
module RYUSA
FootstepSE_Version = "1.00 Alpha"
end
# Functions
class FootstepSE
include RYUSA
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
@enable_debug = true
@volum = 65 # Footstep Volum
@amount_of_grass = 6 # 1 - Sounds Amount of Grass
@amount_of_sand = 6 # 2 - Sounds Amount of Sand
@amount_of_snow = 6 # 3 - Sounds Amount of Snow
@amount_of_wood = 6 # 4 - Sounds Amount of Wood
@amount_of_water = 3 # 5 - Sounds Amount of Water
@amount_of_stone = 3 # 6 - Sounds Amount of Stone
@amount_of_metal = 6 # 7 - Sounds Amount of Metal
@sets = [1, @amount_of_grass, @amount_of_sand, @amount_of_snow, @amount_of_wood, @amount_of_water, @amount_of_stone, @amount_of_metal]
@terrain_mark = 0
end
#--------------------------------------------------------------------------
# ● Pre-process
#--------------------------------------------------------------------------
def play
process if enable? && $game_player.moving?
debug if @enable_debug
end
#--------------------------------------------------------------------------
# ● Process
#--------------------------------------------------------------------------
def process
play_se
end
#--------------------------------------------------------------------------
# ● Play SE
#--------------------------------------------------------------------------
def play_se
@terrain_mark = get_terrain_mark
@dice = get_dice
case @terrain_mark
when 0 # No Sound
when 1 # Glass
Audio.se_play("Audio/SE/fst_grass_light_walk_00" + @dice.to_s,@volum)
when 2 # Sand
Audio.se_play("Audio/SE/fst_sand_light_walk_00" + @dice.to_s,@volum)
when 3 # snow
Audio.se_play("Audio/SE/fst_snow_light_walk_00" + @dice.to_s,@volum)
when 4 # wood
Audio.se_play("Audio/SE/fst_wood_light_walk_00" + @dice.to_s,@volum)
when 5 # water
Audio.se_play("Audio/SE/fst_water_heavy_run_00" + @dice.to_s,@volum)
when 6 # stone
Audio.se_play("Audio/SE/fst_stone_light_walk_00" + @dice.to_s,@volum)
when 7 # metal
Audio.se_play("Audio/SE/fst_metal_light_walk_00" + @dice.to_s,@volum)
else return 0
end
end
#--------------------------------------------------------------------------
# ● Get Flag
#--------------------------------------------------------------------------
def enable?
return $game_switches[1]
end
#--------------------------------------------------------------------------
# ● Get Terrain Mark
#--------------------------------------------------------------------------
def get_terrain_mark
return $game_map.terrain_tag($game_player.x, $game_player.y)
end
#--------------------------------------------------------------------------
# ● Get Dice
#--------------------------------------------------------------------------
def get_dice
if enable?
return rand(@sets[@terrain_mark] - 1) + 1 # Not include zero!
else
return 0
end
end
#--------------------------------------------------------------------------
# ● Debug
#--------------------------------------------------------------------------
def debug
puts "-----------------------"
puts "Footstep SE " + (enable? ? "Enable" : "Suspended")
puts ($game_player.moving? ? "Moving..." : "Standby")
puts "Player are " + ($game_player.dash? ? "dashing" : ($game_player.moving? ? "walking" : "standing"))
puts "terrain Mark: " + @terrain_mark.to_s
puts "Random Sound Index: " + get_dice.to_s
end
end
#==============================================================================
# ■ Game_Player
#------------------------------------------------------------------------------
# Overwrite
#==============================================================================
class Game_Player
alias FSSE_move_by_input move_by_input
def move_by_input
return if !movable? || $game_map.interpreter.running?
move_straight(Input.dir4) if Input.dir4 > 0
footstepse = FootstepSE.new
footstepse.play
end
end