Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> DeadlyDan_Footsteps, Extra functionality to display audible footsteps in VX
deadlydan
post Jan 30 2008, 07:18 PM
Post #1


Level 5
Group Icon

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful




Hey guys, another script release smile.gif Hope you like it, this time, it's footstep sounds, basically, this script allows you to enable and disable the ability to sound footsteps when the player walks. This is useful for creepy games for example, creaky floorboards etc.

The script has some minor problems which are explained in the script information, but overall it's pretty good. It features a different pitch for each step, and the footsteps are faster when you dash.

You can download the footstep sound files i use here:
http://www.megaupload.com/?d=O9VRGJ1Y

Here is the script, hope you enjoy it smile.gif The instructions are inside the script. Thanks.

CODE
#==============================================================================
# ■ 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


__________________________
Go to the top of the page
 
+Quote Post
   
woratana
post Jan 30 2008, 07:36 PM
Post #2


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




Sounds Good!

I think if this script can use with event, that will be great!

I've script the script like this in RMXP before, these are the features I have in my script:
- Sound depends on Terrain
- Event can has step sound.
- Step sound of event will loud or low depends on distance from that event and player
- Skip from play step sound every step, because sometimes it's disturbing when there's sound every step.
- Change volume of step sound for each event.
I think this may inspired your idea~^^


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
deadlydan
post Jan 30 2008, 07:38 PM
Post #3


Level 5
Group Icon

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful




Oh right, nah, my idea was actually inspired by a creepy RPG i once made in RM2k, where it was tedious to make the floorboards creek, thanks though.

I guess this code could be easily imported to be useable in events, you could just change Game_Player to Game_Character.


__________________________
Go to the top of the page
 
+Quote Post
   
woratana
post Jan 30 2008, 07:59 PM
Post #4


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




I suggest you to make it possible to use sound just for some event, and allow to open/stop sound from each event.

Because if every event have sound, if may increase lag or it may really disturb the player.

>_<


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
deadlydan
post Jan 30 2008, 08:03 PM
Post #5


Level 5
Group Icon

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful




Yeah, thats simple enough, in the future i'll add such things, at the moment, it's not my top priority to add anything else to this script... Thanks smile.gif


__________________________
Go to the top of the page
 
+Quote Post
   
X-Snake-X
post Jan 31 2008, 03:29 AM
Post #6


Level 6
Group Icon

Group: Member
Posts: 88
Type: Event Designer
RM Skill: Skilled




Another great Script from you!
It just need some improvements happy.gif


__________________________

I'm from Germany o.o
Go to the top of the page
 
+Quote Post
   
kikaider125
post Feb 4 2008, 02:59 PM
Post #7



Group Icon

Group: Member
Posts: 1
Type: None
RM Skill: Undisclosed




I have a question, is there any simple way to change the volume of the footsteps? they just seem a little loud.
Go to the top of the page
 
+Quote Post
   
deadlydan
post Feb 4 2008, 03:38 PM
Post #8


Level 5
Group Icon

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful




change the 100 in the line:

CODE
Audio.se_play ( file, 100, @next_foot_pitch )


to what ever volume you want.


__________________________
Go to the top of the page
 
+Quote Post
   
ch.maker
post Feb 12 2008, 04:00 PM
Post #9


Level 1
Group Icon

Group: Member
Posts: 6
Type: Event Designer
RM Skill: Advanced




When I am flying by airship, it makes the same sound, as if I were walking
How can I fix that bug?

Sorry about my English mellow.gif
Go to the top of the page
 
+Quote Post
   
Ilikepie123
post Mar 10 2008, 03:18 PM
Post #10


Sir Jacketh
Group Icon

Group: Revolutionary
Posts: 137
Type: Artist
RM Skill: Undisclosed




QUOTE (deadlydan @ Feb 4 2008, 02:45 PM) *
change the 100 in the line:

CODE
Audio.se_play ( file, 100, @next_foot_pitch )


to what ever volume you want.

I think it would require a LOT of scripting. And your English was perfect o.o... There were no gramatical errors or anything visable... O.o...


__________________________
Hmwut?
Go to the top of the page
 
+Quote Post
   
Mech-Ah
post Mar 11 2008, 12:54 AM
Post #11


Level 2
Group Icon

Group: Member
Posts: 25
Type: None
RM Skill: Undisclosed




Never mind.
An excellent script.

This post has been edited by Mech-Ah: Mar 11 2008, 01:00 AM
Go to the top of the page
 
+Quote Post
   
deadlydan
post Mar 12 2008, 10:11 PM
Post #12


Level 5
Group Icon

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful




QUOTE (ch.maker @ Feb 12 2008, 03:07 PM) *
When I am flying by airship, it makes the same sound, as if I were walking
How can I fix that bug?

Sorry about my English mellow.gif


While in an airship set it to enabled = false.


__________________________
Go to the top of the page
 
+Quote Post
   
ch.maker
post Mar 19 2008, 07:08 AM
Post #13


Level 1
Group Icon

Group: Member
Posts: 6
Type: Event Designer
RM Skill: Advanced




QUOTE (deadlydan @ Mar 13 2008, 02:18 AM) *
QUOTE (ch.maker @ Feb 12 2008, 03:07 PM) *
When I am flying by airship, it makes the same sound, as if I were walking
How can I fix that bug?

Sorry about my English mellow.gif


While in an airship set it to enabled = false.


Thank you! laugh.gif
Go to the top of the page
 
+Quote Post
   
francesco34
post Mar 22 2008, 04:05 PM
Post #14


Level 1
Group Icon

Group: Member
Posts: 9
Type: None
RM Skill: Undisclosed




im having a problem if i start the game whit the script and there satnd line 67 stack to deep
Go to the top of the page
 
+Quote Post
   
buran
post Apr 23 2008, 01:36 PM
Post #15


Level 1
Group Icon

Group: Member
Posts: 6
Type: None
RM Skill: Advanced




What I can do to know the tile's ID?

PS. Sorry about my English, I speak better Portuguese ^o^"

This post has been edited by buran: Apr 23 2008, 01:39 PM


__________________________
Sorry about my English, I'm Brazilian, and don't write better English.
-=-=-=--==---=-=-==--=--=-=-==-=-=-=-=-=-===-==-=-=-=-=-=-=-==-=-==-==-=-=-=-==-=--=-=-==-=-==-==
Desculpem meu Ingl�s, eu sou Brasileiro, e n�o escrevo bem Ingl�s
言い訳私の英語、私はブラジルではなく英文を上手に書く
माफ मेरे अंग्रेजी , मैं नहीं कर रहा हूँ और ब्राजील के साथ अंग्रेजी लिखने
Excusez mon anglais, je suis br�silienne et pas bien �crire en anglais
Go to the top of the page
 
+Quote Post
   
Denna.Maes
post Jun 19 2008, 07:56 PM
Post #16


Level 2
Group Icon

Group: Member
Posts: 22
Type: Developer
RM Skill: Undisclosed




QUOTE (buran @ Apr 23 2008, 12:50 PM) *
What I can do to know the tile's ID?

PS. Sorry about my English, I speak better Portuguese ^o^"


I've got the same question sleep.gif


__________________________
Script: N00b
Writer: Master
Mapping: Normal
Visit:


Go to the top of the page
 
+Quote Post
   
tekken999
post Apr 7 2009, 08:55 AM
Post #17


Level 4
Group Icon

Group: Member
Posts: 57
Type: Event Designer
RM Skill: Skilled




Does this apply to custom sprites because mine doesnt make any sound and i havent enountered any errors in the script?
Go to the top of the page
 
+Quote Post
   
miget man12
post Apr 18 2009, 06:46 PM
Post #18


Making a Comeback
Group Icon

Group: Revolutionary
Posts: 393
Type: Musician
RM Skill: Intermediate




Umm... I don't know if anyone really cares about this anymore, but I'll post this anyway:
(please note that I'm not entirely sure about all of this, so this might not work exactly as said)
The Tile IDs are shown in the attached picture, Those which have 2 numbers have the Ground Level and the 1st layer (used in the 'TALL' sections)
i.e.:
CODE
  FOOTSTEP_GRASS = [28, 29, 30]
This will have The following:
Attached File  Tileset__s2.png ( 4.72K ) Number of downloads: 16

CODE
  FOOTSTEP_GRASS_LONG = [29, 30]
This will add these:
Attached File  Tileset__s3.png ( 4.68K ) Number of downloads: 13

...I think!

and thus, you will have these:
Attached File  Tileset__s1.png ( 5.3K ) Number of downloads: 13

if you understood that, you should be able to use this to choose which Tileset ID's you want to use:
Attached File  Tileset__s.png ( 121.23K ) Number of downloads: 52

let me know if you have any more questions smile.gif

~Miget man12


__________________________
By the way:


I'm bored because it's summer so I decided to drop by for a bit.
Go to the top of the page
 
+Quote Post
   
Digioso
post Sep 29 2011, 12:30 AM
Post #19


Level 2
Group Icon

Group: Member
Posts: 20
Type: Event Designer
RM Skill: Skilled




Update:
I had a small bug in there which prevented playing the layer 1 sounds. It's fixed now. I updated the attached version with the fix.

Update 2:
The game crashed if you didn't have a config file. Now it works as promised without a file and uses default sounds.

Sorry for the necropost, but I think it's worth it (and it's my first posting here on this forum...). smile.gif

I wanted to use this script for my own game but found out that it's not compatible to tilesets swapped with SwapXT because the tileids are hardcoded in the script.
So... well I changed that. tongue.gif

You can now create a configuration file where you can put the tileids in for swapped maps. So no more "Stone-Footsteps" when you're walking over grass. The script will check the file and if it finds a map configured in there it will use this configuration.
If you're on a map not configured or if you don't have the configuration file at all it will use the standard sounds from DeadlyDans initial script.

Instructions on how to use this and how to create the config file is provided in the script itself.
The newest version of this script can always be found here: http://www.digioso.org/DeadlyDan_Footsteps

I'm thinking of writing a little program that helps you create the config file as well but I don't know when I'll have to time for that as I'm currently working on my first game and spent all my time there. smile.gif

If you have any questions feel free to ask.

If you're planning to use this please give credit to DeadlyDan and me.

@Miget man12: With the "debug_tileid" method in the script you can make it show you the tileid with each step you do.
Could you test it with this and tell me if you still think it's wrong? Well what you could do basically is just walking over the tiles you think are wrong. If you here the wrong sound (or none where you expected a sound to be) then something isn't right. I can have a look at this and try to fix it then.
I'll see if I can test a few things as well. Have to create a few more configs for my own game so if there's anything wrong I'll probably stumble upon it. So far my results were that the script is correct.

This post has been edited by Digioso: Nov 7 2011, 10:36 PM


__________________________
Leg dich nie mit einem BAOD an, oder du bist selber dran.

Das Leben ist grausam.
Wenn es mal nicht grausam ist, ist es grausamer.

Go to the top of the page
 
+Quote Post
   
Digioso
post Nov 7 2011, 02:02 PM
Post #20


Level 2
Group Icon

Group: Member
Posts: 20
Type: Event Designer
RM Skill: Skilled




Another update. If you saved and loaded your game with this script enabled your game would crash.
I didn't know that I have to save and load the stuff I coded as well... Well... that's fixed now!

Newest version is available at the link above and attached to this posting.
Attached File(s)
Attached File  footsteps_v2.zip ( 5.29K ) Number of downloads: 12
 


__________________________
Leg dich nie mit einem BAOD an, oder du bist selber dran.

Das Leben ist grausam.
Wenn es mal nicht grausam ist, ist es grausamer.

Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 22nd May 2013 - 09:08 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker