|
  |
DeadlyDan_Footsteps, Extra functionality to display audible footsteps in VX |
|
|
|
|
Jan 30 2008, 07:18 PM
|

Level 5

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

|
Hey guys, another script release  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=O9VRGJ1YHere is the script, hope you enjoy it  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
__________________________

|
|
|
|
|
|
|
|
|
Feb 4 2008, 02:59 PM
|

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.
|
|
|
|
|
|
|
|
|
Feb 4 2008, 03:38 PM
|

Level 5

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.
__________________________
|
|
|
|
|
|
|
|
|
Feb 12 2008, 04:00 PM
|
Level 1

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
|
|
|
|
|
|
|
|
|
Mar 10 2008, 03:18 PM
|

Sir Jacketh

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?
|
|
|
|
|
|
|
|
|
Mar 11 2008, 12:54 AM
|
Level 2

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
|
|
|
|
|
|
|
|
|
Mar 12 2008, 10:11 PM
|

Level 5

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  While in an airship set it to enabled = false.
__________________________
|
|
|
|
|
|
|
|
|
Mar 19 2008, 07:08 AM
|
Level 1

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  While in an airship set it to enabled = false. Thank you!
|
|
|
|
|
|
|
|
|
Mar 22 2008, 04:05 PM
|
Level 1

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
|
|
|
|
|
|
|
|
|
Apr 23 2008, 01:36 PM
|
Level 1

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
|
|
|
|
|
|
|
|
|
Jun 19 2008, 07:56 PM
|

Level 2

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
__________________________
Script: N00b Writer: Master Mapping: Normal Visit: 
|
|
|
|
|
|
|
|
|
Apr 18 2009, 06:46 PM
|
Making a Comeback

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:
Tileset__s2.png ( 4.72K )
Number of downloads: 16CODE FOOTSTEP_GRASS_LONG = [29, 30] This will add these:
Tileset__s3.png ( 4.68K )
Number of downloads: 13...I think! and thus, you will have these:
Tileset__s1.png ( 5.3K )
Number of downloads: 13if you understood that, you should be able to use this to choose which Tileset ID's you want to use:
Tileset__s.png ( 121.23K )
Number of downloads: 52let me know if you have any more questions  ~Miget man12
__________________________
By the way:   I'm bored because it's summer so I decided to drop by for a bit.
|
|
|
|
|
|
|
|
|
Sep 29 2011, 12:30 AM
|

Level 2

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...).  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.  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_FootstepsI'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.  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. 
|
|
|
|
|
|
|
|
|
Nov 7 2011, 02:02 PM
|

Level 2

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.
__________________________
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. 
|
|
|
|
|
|
|
|
  |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
RPG RPG Revolution is an Privacy
Policy and Legal
|
|