Ragazzi mi servirebbe una piccolissima modifica a 2 script, i seguenti :
module Train_Actor class Game_Party_Actor < Game_Character def move_down(turn_enabled = true) if turn_enabled turn_down end if passable?(@x, @y, Input::DOWN) turn_down @y += 1 increase_steps end end def move_left(turn_enabled = true) if turn_enabled turn_left end if passable?(@x, @y, Input::LEFT) turn_left @x -= 1 increase_steps end end def move_right(turn_enabled = true) if turn_enabled turn_right end if passable?(@x, @y, Input::RIGHT) turn_right @x += 1 increase_steps end end def move_up(turn_enabled = true) if turn_enabled turn_up end if passable?(@x, @y, Input::UP) turn_up @y -= 1 increase_steps end end end end #---------------------------------------------------------------------- FP_FILE = "footprints_default" #---------------------------------------------------------------------- FP_DIRECTIONAL = false #---------------------------------------------------------------------- FP_TAG = 3 #---------------------------------------------------------------------- FP_BEFORE_FADE_TIME = 100 FP_FADE_TIME = 100 #---------------------------------------------------------------------- FP_DU = 384 FP_LR = 385 FP_DL = 386 FP_LU = 387 FP_UR = 388 FP_RD = 389 #---------------------------- FP_UD = 512 FP_RL = 513 FP_DR = 514 FP_RU = 515 FP_UL = 516 FP_LD = 517 #---------------------------------------------------------------------- class Spriteset_Map attr_accessor :footprints attr_accessor :fp_tilemap def initialize @viewport1 = Viewport.new(0, 0, 640, 480) @viewport2 = Viewport.new(0, 0, 640, 480) @viewport3 = Viewport.new(0, 0, 640, 480) @viewport2.z = 200 @viewport3.z = 5000 @tilemap = Tilemap.new(@viewport1) @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name) for i in 0..6 autotile_name = $game_map.autotile_names[i] @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name) end @tilemap.map_data = $game_map.data @tilemap.priorities = $game_map.priorities @panorama = Plane.new(@viewport1) @panorama.z = -1000 @fog = Plane.new(@viewport1) @fog.z = 3000 @character_sprites = [] for i in $game_map.events.keys.sort sprite = Sprite_Character.new(@viewport1, $game_map.events[i]) @character_sprites.push(sprite) end @character_sprites.push(Sprite_Character.new(@viewport1, $game_player)) @weather = RPG::Weather.new(@viewport1) @picture_sprites = [] for i in 1..50 @picture_sprites.push(Sprite_Picture.new(@viewport2, $game_screen.pictures[i])) end @timer_sprite = Sprite_Timer.new @footprints = [] fp_tileset = FP_DIRECTIONAL ? Bitmap.new(256,1024) : Bitmap.new(256,512) fp_tileset.blt(160, 0, RPG::Cache.tileset(FP_FILE), Rect.new(0, 0, 32, 32)) fp_tileset.blt(128, 0, RPG::Cache.tileset(FP_FILE), Rect.new(0, 32, 32, 32)) fp_tileset.blt(32, 0, RPG::Cache.tileset(FP_FILE), Rect.new(0, 64, 32, 32)) fp_tileset.blt(64, 0, RPG::Cache.tileset(FP_FILE), Rect.new(32, 0, 32, 32)) fp_tileset.blt(96, 0, RPG::Cache.tileset(FP_FILE), Rect.new(32, 32, 32, 32)) fp_tileset.blt(0, 0, RPG::Cache.tileset(FP_FILE), Rect.new(32, 64, 32, 32)) 0.step(5*32, 32) do |x| opacity = 255 0.step(15*32, 32) do |y| fp_tileset.blt(x, y, fp_tileset, Rect.new(x, 0, 32, 32), opacity) opacity -= 16 end end if FP_DIRECTIONAL fp_tileset.blt(160, 512, RPG::Cache.tileset(FP_FILE), Rect.new(64, 0, 32, 32)) fp_tileset.blt(128, 512, RPG::Cache.tileset(FP_FILE), Rect.new(64, 32, 32, 32)) fp_tileset.blt(32, 512, RPG::Cache.tileset(FP_FILE), Rect.new(64, 64, 32, 32)) fp_tileset.blt(64, 512, RPG::Cache.tileset(FP_FILE), Rect.new(96, 0, 32, 32)) fp_tileset.blt(96, 512, RPG::Cache.tileset(FP_FILE), Rect.new(96, 32, 32, 32)) fp_tileset.blt(0, 512, RPG::Cache.tileset(FP_FILE), Rect.new(96, 64, 32, 32)) 0.step(5*32, 32) do |x| opacity = 255 512.step(32*32, 32) do |y| fp_tileset.blt(x, y, fp_tileset, Rect.new(x, 512, 32, 32), opacity) opacity -= 16 end end end @fp_tilemap = Tilemap.new(@viewport1) @fp_tilemap.tileset = fp_tileset @fp_tilemap.map_data = Table.new($game_map.width, $game_map.height, 3) update end alias fp_dispose dispose def dispose @fp_tilemap.dispose fp_dispose end alias fp_update update def update @fp_tilemap.ox = $game_map.display_x / 4 @fp_tilemap.oy = $game_map.display_y / 4 @fp_tilemap.update unless FP_FADE_TIME == 0 for fp in @footprints if fp.time > 1 fp.time -= 1 if fp.fade and (FP_FADE_TIME - fp.time) % (FP_FADE_TIME/16.0) < 1 @fp_tilemap.map_data[fp.x,fp.y,fp.z] += 8 end else if not fp.fade fp.time = FP_FADE_TIME fp.fade = true else @fp_tilemap.map_data[fp.x,fp.y,fp.z] = 0 @footprints.delete(fp) end end end end fp_update end def show_footprints(fp_index,fp_x,fp_y) fp_z = 0 if @fp_tilemap.map_data[fp_x,fp_y,fp_z] == 0 @fp_tilemap.map_data[fp_x,fp_y,fp_z] = fp_index else fp_z = 1 if @fp_tilemap.map_data[fp_x,fp_y,fp_z] == 0 @fp_tilemap.map_data[fp_x,fp_y,fp_z] = fp_index else fp_z = 2 if @fp_tilemap.map_data[fp_x,fp_y,fp_z] != 0 for i in @footprints.reverse if i.x == fp_x and i.y == fp_y and i.z == fp_z @footprints.delete(i) break end end end @fp_tilemap.map_data[fp_x,fp_y,fp_z] = fp_index end end @footprints.push(Footprint.new(fp_x,fp_y,fp_z)) end end #------------------------------------------------------------------------------- class Game_Event < Game_Character alias fp_ge_init initialize def initialize(map_id, event) fp_ge_init(map_id, event) if @event.name.upcase.include?('<NOFP>') @fp_id = nil end end end #------------------------------------------------------------------------------- class Game_Character alias fp_gc_init initialize def initialize fp_gc_init @last_x = [0,0] @last_y = [0,0] @fp_id = 0 # default footprints end def footprints if terrain_tag(@last_x[1],@last_y[1]) != FP_TAG return end fp_index = nil if @x > @last_x[1] if @last_y[1] > @last_y[0] fp_index = FP_UR elsif @last_y[1] < @last_y[0] fp_index = FP_DIRECTIONAL ? FP_DR : FP_RD else fp_index = FP_LR end else if @x < @last_x[1] if @last_y[1] > @last_y[0] fp_index = FP_DIRECTIONAL ? FP_UL : FP_LU elsif @last_y[1] < @last_y[0] fp_index = FP_DL else fp_index = FP_DIRECTIONAL ? FP_RL : FP_LR end else if @y < @last_y[1] if @last_x[1] > @last_x[0] fp_index = FP_LU elsif @last_x[1] < @last_x[0] fp_index = FP_DIRECTIONAL ? FP_RU : FP_UR else fp_index = FP_DU end elsif @y > @last_y[1] if @last_x[1] > @last_x[0] fp_index = FP_DIRECTIONAL ? FP_LD : FP_DL elsif @last_x[1] < @last_x[0] fp_index = FP_RD else fp_index = FP_DIRECTIONAL ? FP_UD : FP_DU end end end end if fp_index != nil fp_x = @last_x[1] fp_y = @last_y[1] $scene.spriteset.show_footprints(fp_index,fp_x,fp_y) end end def moveto(x, y) @x = x @y = y @real_x = x * 128 @real_y = y * 128 if @fp_id != nil @last_x = [@x,@x] @last_y = [@y,@y] end end def increase_steps @stop_count = 0 if @fp_id != nil and $scene.is_a?(Scene_Map) footprints @last_x.shift @last_x.push(@x) @last_y.shift @last_y.push(@y) end end def terrain_tag(x=@x,y=@y) return $game_map.terrain_tag(x, y) end def update_jump @jump_count -= 1 @real_x = (@real_x * @jump_count + @x * 128) / (@jump_count + 1) @real_y = (@real_y * @jump_count + @y * 128) / (@jump_count + 1) if @fp_id != nil and @jump_count == 0 @last_x = [@x,@x] @last_y = [@y,@y] end end end #------------------------------------------------------------------------------- class Scene_Map attr_reader :spriteset def transfer_player $game_temp.player_transferring = false if $game_map.map_id != $game_temp.player_new_map_id $game_map.setup($game_temp.player_new_map_id) else # Dynamic Footprints fp = @spriteset.footprints md = @spriteset.fp_tilemap.map_data end $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y) case $game_temp.player_new_direction when 2 $game_player.turn_down when 4 $game_player.turn_left when 6 $game_player.turn_right when 8 $game_player.turn_up end $game_player.straighten $game_map.update @spriteset.dispose @spriteset = Spriteset_Map.new if fp != nil or md != nil @spriteset.footprints = fp @spriteset.fp_tilemap.map_data = md end if $game_temp.transition_processing $game_temp.transition_processing = false Graphics.transition(20) end $game_map.autoplay Graphics.frame_reset Input.update end end #------------------------------------------------------------------------------- class Footprint attr_reader :x attr_reader :y attr_reader :z attr_accessor :time attr_accessor :fade def initialize(x,y,z) @x = x @y = y @z = z @time = FP_BEFORE_FADE_TIME @fade = false end end
#===============================================================================
# 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] = [["062-Swing01", 40, 0],["062-Swing01", 40, 0]]
Terrains[2] = []
Terrains[3] = []
Terrains[4] = []
Terrains[5] = [["062-Swing01", 40, 0],["062-Swing01", 40, 0]]
Terrains[6] = [["062-Swing01", 40, 0],["062-Swing01", 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] = [["022-Dive02", 50, 0],["022-Dive02", 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
In pratica la modifica che mi occorre è solo assegnare ad entrambi una switch di attivazione.
Modificato da rizzuccio, 07 April 2016 - 12:24 PM.