• Benvenuto in Making Videogames!
  • Dai sfogo alla tua fantasia!
  • Crea il tuo Videogioco!
Benvenuto ospite! Login Registrati




Valutazione discussione:
  • 0 voto(i) - 0 media
  • 1
  • 2
  • 3
  • 4
  • 5
[SCRIPT] DeadlyDan Footsteps
#1
Descrizione

Si sentono i rumori dei passi dei tuoi eroi(ci sono 5 rumori differenti)


Autore
DeadlyDan


Allegati

Ecco i rumori da copiare nella cartella Audio/SE http://www.megaupload.com/?d=O9VRGJ1Y


Istruzioni per l'uso

Copiare sopra Main lo script e le musiche dentro Audio/SE

Script
[spoiler]
Codice:
#==============================================================================
# ■ 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
[/spoiler]


____________________________________________________________
*EDIT by Johnny 97*: Mettete gli script dentro i tag code e spoiler, altrimenti non si capisce niente. L'autore è DeadlyDan, l'hai scritto nel titolo del topic (xD) ed era scritto nello script, prestate più attenzione!
 
Rispondi
  


Messaggi in questa discussione
[SCRIPT] DeadlyDan Footsteps - da lavezzinapoli7 - 06-07-2011, 11:49 PM

Vai al forum:


Browsing: 1 Ospite(i)