Le Deal du moment :
Cdiscount : -30€ dès 300€ ...
Voir le deal

Aller en bas
Korndor
Korndor
Staffeux retraité

Nombre de messages : 4959
Age : 110
Localisation : Erem Vehyx
Distinction : Champion de boxe et au lit ! :O [Wax]
Être Mythique [Mister]
Papi Korndor qui a l'ostéoporose [Skillo]
Soldat Ikéa [Coco']
Un bonhomme, un vrai ! [Neresis]
Vieillard acariâtre [Didier Gustin]
Date d'inscription : 16/12/2007
https://www.rpgmakervx-fr.com/

Bruits de pas Empty Bruits de pas

Sam 2 Fév 2008 - 20:39
Voici un autre script déniché sur internet...

Nom:Footsteps
Auteur: DeadlyDan.
Voici un script qui fonctionne sur projet vierge mais à modifier je pense.
Télécharger l'archive de son. Télécharger
Placez la dans le dossier SE.

Placez ce script au dessus de Main.
Le mode d'emplois et dans le script pour les modifications. Mais en anglais.

Code:
#===============================================================
#                         
#                rpgmakervx.1fr1.net                                         
#     
#===============================================================
#==============================================================================
# ■ DeadlyDan_Footsteps by DeadlyDan
#------------------------------------------------------------------------------
#  Enables ability to "sound" footsteps when walking over specific tiles
#==============================================================================
# Usage:
=begin
 
  Simple, place the audio files in your SE directory, and try the game.
 
  There are some known bugs in this, if anyone has any fixes just let me know:)
 
  To add custom sounds for custom tiles you can do for example:
 
  FOOTSTEP_WOOD = [15] # The tilenumber ID that you get with debug_tileid function
  FOOTSTEP_WOOD_FILE = "Audio/SE/stepwood" # The filename for the sound
 
  then add underneath the # Insert custom sounds here line:
 
  footstep_check ( FOOTSTEP_WOOD, FOOTSTEP_WOOD_FILE, 0 )
 
  The last number in that function stands for the layer, since the wood tile i
  selected is on the ground layer, it's layer is 0. 
 
  (NOTE)
  There is a problem that when you go on carpet it makes dirt and snow sounds,
  i currently can't find a way to fix this, so, the best thing to do is to call
  the command $game_player.footsteps_enabled = false.
 
  To enable footsteps while stopping the carpet and tables from making the snow
  and dirt sounds, there's an uneasy solution of placing a touch event which
  calls $game_player.footsteps_enabled = false.
 
  Sorry about this inconvenience.

=end

class Game_Player < Game_Character
 
  FOOTSTEP_GRASS = [28, 29, 30]
  FOOTSTEP_GRASS_LONG = [29, 30]
  FOOTSTEP_GRASS_FILE = "Audio/SE/stepgrass"
 
  FOOTSTEP_DIRT = [32, 33, 34]
  FOOTSTEP_DIRT_LONG = [32 ,34]
  FOOTSTEP_DIRT_FILE = "Audio/SE/stepdirt"
 
  FOOTSTEP_SAND = [36, 37, 38]
  FOOTSTEP_SAND_LONG = [36, 38]
  FOOTSTEP_SAND_FILE = "Audio/SE/stepdirt"
 
  FOOTSTEP_SNOW = [39, 41]
  FOOTSTEP_SNOW_LONG = [40, 41]
  FOOTSTEP_SNOW_FILE = "Audio/SE/stepsnow"
 
  FOOTSTEP_WOOD = [15]
  FOOTSTEP_WOOD_FILE = "Audio/SE/stepwood"
 
  FOOTSTEP_PITCH = 100
  FOOTSTEP_PITCH2 = 90

  attr_accessor :last_foot
  attr_accessor :footsteps_enabled
 
  alias foot_initialize initialize
  def initialize
    foot_initialize
    @last_foot = 0
    @last_foot_pitch = FOOTSTEP_PITCH2
    @next_foot_pitch = FOOTSTEP_PITCH
    @footsteps_enabled = true
  end
 
  alias foot_move_left move_left
  def move_left ( turn_ok = true )
    foot_move_left ( turn_ok )
    if ( @move_failed == false )
      sound_foot
    end
  end
   
  alias foot_move_right move_right
  def move_right ( turn_ok = true )
    foot_move_right ( turn_ok )
    if ( @move_failed == false )
      sound_foot
    end
  end
 
  alias foot_move_up move_up
  def move_up ( turn_ok = true )
    foot_move_up ( turn_ok )
    if ( @move_failed == false and @footsteps_enabled )
      sound_foot
    end
  end
 
  alias foot_move_down move_down
  def move_down ( turn_ok = true )
    foot_move_down ( turn_ok )
    if ( @move_failed == false and @footsteps_enabled )
      sound_foot
    end
  end
 
  def no_layer_tile? ( layer )
    result = [false, false, false]
    for i in 0..2
      if ( @map_tile_id[i] == 0 )
        result[i] = true
      end
    end
    if ( layer == 0 )   
      if ( result[1] and result[2] )
        return true
      else
        return false
      end
    end
    else if ( layer == 1 )
      if ( result[2] )
        return true
      else
        return false
      end
    else
      return true
    end
  end
 
  def debug_tileid
    $game_message.texts[0] = @map_tile_tex[0]
    $game_message.texts[1] = @map_tile_tex[1]
    $game_message.texts[2] = @map_tile_tex[2]
  end
 
  def footstep_check ( footstep, file, layer )
    for i in 0..footstep.length
      if ( ( @map_tile_tex[layer] == footstep[i].to_s ) and ( no_layer_tile? ( layer ) ) )
        Audio.se_play ( file, 100, @next_foot_pitch )
        @last_foot = Graphics.frame_count
        return nil
      end
    end
  end
 
  def sound_foot
    if ( dash? )
      mul = 6
    else
      mul = 7
    end
    if ( Graphics.frame_count > ( @last_foot + mul ) )
      @map_tile_id = []
      @map_tile_tex = []
      for i in 0..2
        @map_tile_id.push ( $game_map.data[@x, @y, i] )
        @map_tile_tex.push ( @map_tile_id[i].to_s[0,2] )
      end
     
      # Use "debug_tileid" here to bring up the numbers of all the current tiles
      # to use with definitions of the tileids, walk over tiles ingame...
     
      if ( @last_foot_pitch == FOOTSTEP_PITCH )
        @next_foot_pitch = FOOTSTEP_PITCH2
        @last_foot_pitch = FOOTSTEP_PITCH2
      else
        @next_foot_pitch = FOOTSTEP_PITCH
        @last_foot_pitch = FOOTSTEP_PITCH
      end
     
      # Ground layer
      footstep_check ( FOOTSTEP_GRASS, FOOTSTEP_GRASS_FILE, 0 )
      footstep_check ( FOOTSTEP_DIRT, FOOTSTEP_DIRT_FILE, 0 )
      footstep_check ( FOOTSTEP_SAND, FOOTSTEP_SAND_FILE, 0 )
      footstep_check ( FOOTSTEP_SNOW, FOOTSTEP_SNOW_FILE, 0 )
      footstep_check ( FOOTSTEP_WOOD, FOOTSTEP_WOOD_FILE, 0 )
     
      # Layer 1
      footstep_check ( FOOTSTEP_GRASS_LONG, FOOTSTEP_GRASS_FILE, 1 )
      footstep_check ( FOOTSTEP_DIRT_LONG, FOOTSTEP_DIRT_FILE, 1 )
      footstep_check ( FOOTSTEP_SAND_LONG, FOOTSTEP_SAND_FILE, 1 )
      footstep_check ( FOOTSTEP_SNOW_LONG, FOOTSTEP_SNOW_FILE, 1 )
     
      # Insert custom sounds here
     
    end
  end
 
end
Revenir en haut
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum