The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: miget man12 on May 09, 2009, 03:01:45 PM

Title: Fairly Simple Footsteps Script
Post by: miget man12 on May 09, 2009, 03:01:45 PM

Simple Footsteps Script
Simple Footsteps Script v2.5
By Miget man12, DerVVulfman(for Tile ID getting formula), Modern Algebra and Yanfly(for improvement help and ideas)
5/31/2009 (MM/DD/YY)
Updates:
May 28, 2009: cleaner code
May 31, 2009: Vastly Improved script, better coding
July 21, 2009: Events get their own sound effects


Introduction

I made this because I wanted to be able to use footsteps without having to use the confusing (in my opinion) configurations of DeadlyDan's Footstep's script. I also made this to have the ability to have events have footsteps, which DeadlyDan's lacks.


Features

-Turning on and off footsteps mid-game
-Events can have footsteps via comments
-Play different SEs depending on which tile ID you're standing on
-Randomized SEs for realistic effects
-Events can have unique footsteps

Script

Demo:
see attached: http://rmrk.net/index.php?action=dlattach;topic=33044.0;attach=16142
It is recommended that you get the demo, but if you'd like: The demo's really outdated ^_^

Spoiler for:
Code: [Select]
#==============================================================================
# ** Simple Footstep script
#  Version 2.5
#  Credits:
#    Creator: Miget man12, Help improving from: Modern Algebra, Yanfly, Twilight1300
#    Formula for getting Tile ID by DerVVulfman
#-----------------------------------------------------------------------------
#  I made this just so I could have a not-laggy, easy to use script. It doesn't
# really have any special features, but it works without very much lag. It is
# also being used in "The Legend of Zelda: Realm of the Gods", a Zelda
# fan-game(Hence the SE's from OoT :D) that I'm working on with Twilight1300.
#-----------------------------------------------------------------------------
# Instructions:
#  To have an event have footstep sounds, just put Comment:
# [footstep]
# To have an event or the player use footsteps:
# For The Player:
#  $game_player.footstep_se = true/false
# For an Event:
#  $game_map.events[(Event ID)].footstep_se = true/false
#  The Event ID is the ID of the event on the map you are on
# If you want an event to have a special footstep sound effect, put a comment
# like so:
#  [footstepse:SE Name]
# e.g.
#  [footstepse:OOT_LikeLike_Move]
# ***Event settings are reset when you tranfer*** (this doesn't apply to comment-
#  related settings)
#==============================================================================
$imported = {} if $imported == nil
$imported["Mm12Footsteps"] = true
module Mm12
  START_WITH_SE = true # Start out with player's footsteps enabled?
  BRIDGE_TILES = [272,273,274,275,276,277,278,279]
  CARPET_TILES = [30,38,62,218]
  DIRT_TILES = []
  GRASS_TILES = [16,19,150,204,214]
  ICE_TILES = [151,215]
  LAVA_TILES = [14,15]
  SAND_TILES = [32,35,238,244,245,252,253]
  STONE_TILES = [24,27,129,130,131,132,133,134,141,142,151,181,205,215,229,193,194,
                195,196,197,200,201,202,205,208,209,210,211,212,213,219,220,221,
                222,224,225,226,229]
  TGRASS_TILES = [20,180,228]
  WOOD_TILES = [160,161,192,216,217]
  SNOW_TILES = [40,43,179,203,227,239,246,247,254,255]
  LADDER_TILES = [516,524,540]
  BRIDGE_SE = ["OOT_Steps_Bridge1", "OOT_Steps_Bridge2"]
  CARPET_SE = ["OOT_Steps_Carpet1", "OOT_Steps_Carpet2", "OOT_Steps_Carpet3",
    "OOT_Steps_Carpet4", "OOT_Steps_Carpet5"]
  DIRT_SE = ["OOT_Steps_Dirt1", "OOT_Steps_Dirt2", "OOT_Steps_Dirt3",
    "OOT_Steps_Dirt4", "OOT_Steps_Dirt5", "OOT_Steps_Dirt6"]
  GRASS_SE = ["OOT_Steps_Grass1", "OOT_Steps_Grass2", "OOT_Steps_Grass3",
    "OOT_Steps_Grass4", "OOT_Steps_Grass5", "OOT_Steps_Grass6",
    "OOT_Steps_Grass7"]
  ICE_SE = ["OOT_Steps_Ice1", "OOT_Steps_Ice2"]
  LAVA_SE = ["OOT_Steps_Lava1", "OOT_Steps_Lava2", "OOT_Steps_Lava3"]
  SAND_SE = ["OOT_Steps_Sand1", "OOT_Steps_Sand2", "OOT_Steps_Sand3",
    "OOT_Steps_Sand4", "OOT_Steps_Sand5"]
  STONE_SE = ["OOT_Steps_Stone1", "OOT_Steps_Stone2", "OOT_Steps_Stone3",
    "OOT_Steps_Stone4", "OOT_Steps_Stone5", "OOT_Steps_Stone6"]
  TGRASS_SE = ["OOT_Steps_TallGrass1", "OOT_Steps_TallGrass2",
    "OOT_Steps_TallGrass3", "OOT_Steps_TallGrass4"]
  WOOD_SE = ["OOT_Steps_Wood1", "OOT_Steps_Wood2", "OOT_Steps_Wood3",
    "OOT_Steps_Wood4", "OOT_Steps_Wood5"]
  SNOW_SE = ["MM_Steps_Snow1", "MM_Steps_Snow2", "MM_Steps_Snow3"]
  LADDER_SE = ["TP_LadderStep1", "TP_LadderStep2", "TP_LadderStep3"]
end
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
  attr_accessor :footstep_se
end

class Game_Player
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias ftstp_gp_initialize initialize
  alias ftstp_gp_increase_steps increase_steps
  def initialize
    @se_ok = true
    @footstep_se = true
    ftstp_gp_initialize
  end
  def increase_steps
    ftstp_gp_increase_steps
    footstep_se
  end
  #---------------------------------------------------------------------------
  # * Footstep SE
  #---------------------------------------------------------------------------
  def footstep_se
    if @se_ok == true
      @num = 0
      play_se
      @se_ok = false
    elsif @se_ok == false
      if $game_player.dash?
        @se_ok = true
      else
        @num = 1
        play_se
        @se_ok = true
      end
      return
    end
  end
  def play_se
    unless $game_map.ship.driving or $game_map.boat.driving or $game_map.airship.driving or !@footstep_se
      if Mm12::LADDER_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 2]))
        RPG::SE.new(Mm12::LADDER_SE[rand(Mm12::LADDER_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::BRIDGE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0])) or Mm12::BRIDGE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 2]))
        RPG::SE.new(Mm12::BRIDGE_SE[rand(Mm12::BRIDGE_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::CARPET_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::CARPET_SE[rand(Mm12::CARPET_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::DIRT_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::DIRT_SE[rand(Mm12::DIRT_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::GRASS_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::GRASS_SE[rand(Mm12::GRASS_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::ICE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::ICE_SE[rand(Mm12::ICE_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::LAVA_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::LAVA_SE[rand(Mm12::LAVA_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::SAND_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::SAND_SE[rand(Mm12::SAND_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::STONE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::STONE_SE[rand(Mm12::STONE_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::TGRASS_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 1])) or Mm12::TGRASS_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::TGRASS_SE[rand(Mm12::TGRASS_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::WOOD_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::WOOD_SE[rand(Mm12::WOOD_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::SNOW_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::SNOW_SE[rand(Mm12::SNOW_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      end
    end
    if $imported["Mm12Swimming"]
      #p "so this works..."
      if $game_map.ship.driving or $game_map.boat.driving
        #p "Odd..."
        RPG::SE.new(Mm12::SWIM_SE[@num], 100, 100).play
      end
    end
  end
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
class Game_Event < Game_Character
  alias ftstp_setup setup
  alias ftstp_ge_increase_steps increase_steps
  #--------------------------------------------------------------------------
  # * Event page setup
  #--------------------------------------------------------------------------
  def setup(new_page)
    ftstp_setup(new_page)
    if !@list.nil?
      for i in 0...@list.size - 1
        next if @list[i].code != 108
        if @list[i].parameters[0].include?("[footstepse:")
          cmd = @list[i].parameters[0].split(':')
          @custom_se_name=cmd.last if cmd.size>1 && /footstepse/===cmd.first
          @custom_se_name[-1, 1] = ""
          #list = @list[i].parameters[0].scan(/\[footstepse:([0-9]|[a-z]|[A-Z])+\]/)
          #p $1
          @footstep_se_custom = true
          #$1
        elsif @list[i].parameters[0].include?("[footstep]")
          #p "should work, right?"
          @footstep_se = true
        end
      end
    end
  end
  def footstep_se
    get_dist_vol
    play_se
  end
  def play_se
    if @footstep_se_custom
      RPG::SE.new(@custom_se_name, rand(30)+80, rand(30)+80).play
    elsif @footstep_se
      if Mm12::LADDER_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 2]))
        RPG::SE.new(Mm12::LADDER_SE[rand(Mm12::LADDER_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::BRIDGE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0])) or Mm12::BRIDGE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 2]))
        RPG::SE.new(Mm12::BRIDGE_SE[rand(Mm12::BRIDGE_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::CARPET_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::CARPET_SE[rand(Mm12::CARPET_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::DIRT_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::DIRT_SE[rand(Mm12::DIRT_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::GRASS_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::GRASS_SE[rand(Mm12::GRASS_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::ICE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::ICE_SE[rand(Mm12::ICE_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::LAVA_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::LAVA_SE[rand(Mm12::LAVA_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::SAND_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::SAND_SE[rand(Mm12::SAND_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::STONE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::STONE_SE[rand(Mm12::STONE_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::TGRASS_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::TGRASS_SE[rand(Mm12::TGRASS_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::WOOD_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::WOOD_SE[rand(Mm12::WOOD_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::SNOW_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::SNOW_SE[rand(Mm12::SNOW_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      end
    end
  end
  def get_dist_vol
    @x_dist = $game_player.x - @x
    @y_dist = $game_player.y - @y
    @x_dist = @x_dist.abs
    @y_dist = @y_dist.abs
    @ttl_dist = Math.sqrt(@x_dist * @x_dist + @y_dist * @y_dist ).round
    #p @ttl_dist
    @dist_vol = 60
    @dist_vol2 = 20
    @dist_vol -= @ttl_dist*3
    @dist_vol += rand(30)
    if @dist_vol < 0
      @dist_vol = 0
    end
    #p @dist_vol
    @dist_vol2 -= @ttl_dist*2
    @dist_vol2 += rand(30)
    if @dist_vol2 < 0
      @dist_vol2 = 0
    end
    #p "Distance Volume: "+@dist_vol1.to_s
  end
  def increase_steps
    ftstp_ge_increase_steps
    footstep_se
  end
end
class Game_Map
  #--------------------------------------------------------------------------
  # * DerVVulfman's method L get_tile_index
  #--------------------------------------------------------------------------
  def tile_index(tile_id)
    case tile_id
      # Multi-tiled ids in Tileset 'A'
      when 2048..8191; return ((tile_id - 2000) / 48) - 1
      # Individual tile ids in Tileset 'A'
      when 1536..1663; return(tile_id - 1408)
      # Tilesets 'B' to 'E'
      when 0..1023; return (tile_id + 256)
    end
    return 0
  end
end
Also get the sound effects here(courtesy of DeadlyDan)
http://www.megaupload.com/?d=O9VRGJ1Y (http://"http://www.megaupload.com/?d=O9VRGJ1Y")

Customization

 
Spoiler for customization:
Quote
Code: [Select]
 BRIDGE_TILES = [72,73,74,75,76,77,78,79]
  CARPET_TILES = [30,38,162,218]
  DIRT_TILES = [16, 27]
  GRASS_TILES = [24,19,208]
  ICE_TILES = [129,130,131,132,133,134,141,142,151,181,205,215,229]
  LAVA_TILES = [14, 15]
  SAND_TILES = [32, 35]
  STONE_TILES = [144,145,146,147,148,149,163,164,165,166,176,177,192,193,194,195,
    196,197,200,201,208,209,210,211,212,213,219,220,221,222,232,233,234,235,236,
    237,240,241,243,248,249,250,251]
  TGRASS_TILES = [180,228]
  WOOD_TILES = [160,161,192,216,217]
  BRIDGE_SE = ["OOT_Steps_Bridge1", "OOT_Steps_Bridge2"]
  CARPET_SE = ["OOT_Steps_Carpet1", "OOT_Steps_Carpet2", "OOT_Steps_Carpet3",
    "OOT_Steps_Carpet4", "OOT_Steps_Carpet5"]
  DIRT_SE = ["OOT_Steps_Dirt1", "OOT_Steps_Dirt2", "OOT_Steps_Dirt3",
    "OOT_Steps_Dirt4", "OOT_Steps_Dirt5", "OOT_Steps_Dirt6"]
  GRASS_SE = ["OOT_Steps_Grass1", "OOT_Steps_Grass2", "OOT_Steps_Grass3",
    "OOT_Steps_Grass4", "OOT_Steps_Grass5", "OOT_Steps_Grass6",
    "OOT_Steps_Grass7"]
  ICE_SE = ["OOT_Steps_Ice1", "OOT_Steps_Ice2"]
  LAVA_SE = ["OOT_Steps_Lava1", "OOT_Steps_Lava2", "OOT_Steps_Lava3"]
  SAND_SE = ["OOT_Steps_Sand1", "OOT_Steps_Sand2", "OOT_Steps_Sand3",
    "OOT_Steps_Sand4", "OOT_Steps_Sand5"]
  STONE_SE = ["OOT_Steps_Stone1", "OOT_Steps_Stone2", "OOT_Steps_Stone3",
    "OOT_Steps_Stone4", "OOT_Steps_Stone5", "OOT_Steps_Stone6"]
  TGRASS_SE = ["OOT_Steps_TallGrass1", "OOT_Steps_TallGrass2",
    "OOT_Steps_TallGrass3", "OOT_Steps_TallGrass4"]
  WOOD_SE = ["OOT_Steps_Wood1", "OOT_Steps_Wood2", "OOT_Steps_Wood3",
    "OOT_Steps_Wood4", "OOT_Steps_Wood5"]
Filenames for the footstep SEs and which Tile IDs use which SEs
Spoiler for For in-game changing:
Quote
Code: [Select]
#  To have an event have footstep sounds, just put Comment:
# [footstep]
# To have an event or the player use footsteps:
# For The Player:
#  $game_player.footstep_se = true/false
# For an Event:
#  $game_map.events[(Event ID)].footstep_se = true/false
#  The Event ID is the ID of the event on the map you are on

Compatibility

 Over-writes:
  Nothing
Aliases:
 Game_Player:
  *initialize
  *jump
  *increase steps

 Game_Event
  *setup

New Methods
 Game_Player:
  *footstep_se (plays the SE(s) for the footsteps)
  *play_se
 Game_Event
  *footstep_se (plays the SE(s) for the footsteps on events and calculates the volume)
  *get_dist_vol
  *play_se
Game_Map
  *tile_id (get the tile ID of a certain X and Y, by DerVVulfman)

Screenshot

No screenshots, it only makes sounds


DEMO

Demo: See RRR topic for attached demo, I'll attach it here soon
http://www.rpgrevolution.com/forums/index.php?showtopic=30643

see attached: http://rmrk.net/index.php?action=dlattach;topic=33044.0;attach=16142
I really need to upload an updated demo, I'll do it eventually :D


Installation

1. Place script in script editor above Main
2. Place the SE's from the .zip in the Audio/SE folder
3. Configure Tile ID's
4. Setup the events you want to have footsteps


FAQ

N/a (Yet!)


Credits

- Miget man12
- DerVVulfman - Tile ID formula
- Modern Algebra - Help w/ improvements
- Yanfly - Help w/ improvements
- Twilight1300 - Help w/ improvements

Terms and Conditions

 Credits in your game would be nice ;)
 Also, if you could let me know that you're using it, that would be great
Additional Notes

My first script that I posted free of request!
I only updated it because Twilight requested it :D

~Miget man12
Title: Re: Fairly Simple Footsteps Script
Post by: modern algebra on May 09, 2009, 03:13:08 PM
I don't think you should overwrite so many methods - it's a little careless. Anyway, the function of the script seems very nice. I will move it to the database :)

Also, it's your script, you can post it wherever you like  ;)
Title: Re: Fairly Simple Footsteps Script
Post by: miget man12 on May 09, 2009, 03:17:40 PM
Okay, I'll fix that, sorry. Thanks for moving to the database.

~Miget man12

EDIT: Fixed, should work now.
Title: Re: Fairly Simple Footsteps Script
Post by: Yanfly on May 09, 2009, 08:15:25 PM
Hmmm, I've created a script for this in the past but ditched it since it generated too much lag. However, like Modern Algebra said, you shouldn't overwrite too many methods. Have you ever thought about just inputting the sound effect into "increase_steps" since that's where all the movement effects lead into anyway.
Title: Re: Fairly Simple Footsteps Script
Post by: miget man12 on May 09, 2009, 08:28:10 PM
Oh, I guess I misunderstood MA, is this better?
Spoiler for The Script:
Code: [Select]
#==============================================================================
# ** Simple Footstep script v1.0b
#  Credits: Miget man12,
#  I made this just so I could have a not-laggy, easy to use script. It doesn't
# really have any special features, but it works without the slightest bit of
# lag.
#
# Overwrites:
#  Nothing
# Aliases:
#  Game_Character:
#   *initialize
#   *increase_steps
#
# Game_Event:
#  *setup
#
# New Methods
#  Game_Character:
#   *footstep_se (plays the SE(s) for the footsteps)
#  Game_Event:
#   *footstep_se (plays the SE(s) for the footsteps on events and calculates the volume)
#
#  To have an event have footstep sounds, just put Comment:
# [footstep:type]
# Where type is the type of footstep, e.g.:
# [footstep:floor][footstep:grass][footstep:wood][footstep:snow]
#  This would make the event do all 4 types at the same time(Not advised,
# because the wood goes slightly after the floor and it sounds weird)
# Combinations sound good, the only thing that doesn't is 'wood' and 'floor'
#  To change whether the player or a specific event has footsteps mid-game,
# you use a simple call script.
# For The Player:
#  $game_player.se_(type) = true/false
# e.g.:
#  $game_player.se_floor = true/false
#  $game_player.se_grass = true/false
#  $game_player.se_wood = true/false
#  $game_player.se_snow = true/false
# For an Event:
#  $game_map.events[(Event ID)].se_(type) = true/false
#  The Event ID is the ID of the event on the map you are on
# e.g.:
#  $game_map.events[1].se_floor = true/false
#  $game_map.events[1].se_grass = true/false
#  $game_map.events[1].se_wood = true/false
#  $game_map.events[1].se_snow = true/false
#  All of these are preset to true if you have a the above comment for the
# respective type.
# *ALL OF THESE ARE RESET WHEN YOU ENTER A NEW MAP EXCEPT THE PLAYER'S OPTIONS*
# Small Update May 5, 2009:
#  Now it gets quieter on events depending on how far from them you are!
#==============================================================================
module Mm12
  FLOOR_SE = "stepfloor"
  GRASS_SE = "stepgrass"
  WOOD_SE = "stepwood"
  SNOW_SE = "stepsnow"
end
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :se_floor
  attr_accessor :se_grass
  attr_accessor :se_wood
  attr_accessor :se_snow
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias ftstp_gc_initialize initialize
  alias ftstp_gc_increase_steps increase_steps
  def initialize
    @se_ok = true
    ftstp_gc_initialize
  end
  #--------------------------------------------------------------------------
  # * Increase Steps
  #--------------------------------------------------------------------------
  def increase_steps
    ftstp_gc_increase_steps
    footstep_se
  end
  #---------------------------------------------------------------------------
  # * Footstep SE
  #---------------------------------------------------------------------------
  def footstep_se
    if @se_ok == true
      if @se_floor
        footstep_sound1 = RPG::SE.new(Mm12::FLOOR_SE, rand(30) + 80, rand(30) + 80)
        footstep_sound1.play
      end
      if @se_grass
        footstep_sound2 = RPG::SE.new(Mm12::GRASS_SE, rand(30) + 40, rand(30) + 80)
        footstep_sound2.play
      end
      if @se_wood
        footstep_sound2 = RPG::SE.new(Mm12::WOOD_SE, rand(30) + 40, rand(30) + 80)
        footstep_sound2.play
      end
      if @se_snow
        footstep_sound2 = RPG::SE.new(Mm12::SNOW_SE, rand(30) + 40, rand(30) + 80)
        footstep_sound2.play
      end
      @se_ok = false
    elsif @se_ok == false
      if $game_player.dash?
        @se_ok = true
      else
        if @se_floor
          footstep_sound1 = RPG::SE.new(Mm12::FLOOR_SE, rand(30) + 80, rand(30) + 80)
          footstep_sound1.play
        end
        if @se_grass
          footstep_sound2 = RPG::SE.new(Mm12::GRASS_SE, rand(30) + 40, rand(30) + 80)
          footstep_sound2.play
        end
        if @se_wood
          footstep_sound2 = RPG::SE.new(Mm12::WOOD_SE, rand(30) + 40, rand(30) + 80)
          footstep_sound2.play
        end
        if @se_snow
          footstep_sound2 = RPG::SE.new(Mm12::SNOW_SE, rand(30) + 40, rand(30) + 80)
          footstep_sound2.play
        end
        @se_ok = true
      end
      return
    end
  end
end

#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
class Game_Event < Game_Character
  alias ftstp_setup setup
  #--------------------------------------------------------------------------
  # * Event page setup
  #--------------------------------------------------------------------------
  def setup(new_page)
    ftstp_setup(new_page)
    if !@list.nil?
      for i in 0...@list.size - 1
        next if @list[i].code != 108
        if @list[i].parameters[0].include?("[footstep:grass]")
          @se_grass = true
        end
        if @list[i].parameters[0].include?("[footstep:floor]")
          @se_floor = true
        end
        if @list[i].parameters[0].include?("[footstep:wood]")
          @se_wood = true
        end
        if @list[i].parameters[0].include?("[footstep:snow]")
          @se_snow = true
        end
      end
    end
  end
  def footstep_se
    get_dist_vol
    if @se_ok == true
      if @se_floor
        footstep_sound1 = RPG::SE.new(Mm12::FLOOR_SE, @dist_vol, rand(30) + 80)
        footstep_sound1.play
      end
      if @se_grass
        footstep_sound2 = RPG::SE.new(Mm12::GRASS_SE, @dist_vol, rand(30) + 80)
        footstep_sound2.play
      end
      if @se_wood
        footstep_sound2 = RPG::SE.new(Mm12::WOOD_SE, @dist_vol2, rand(30) + 80)
        footstep_sound2.play
      end
      if @se_snow
        footstep_sound2 = RPG::SE.new(Mm12::SNOW_SE, @dist_vol2, rand(30) + 80)
        footstep_sound2.play
      end
      @se_ok = false
    elsif @se_ok == false
      if $game_player.dash?
        @se_ok = true
      else
        if @se_floor
          footstep_sound1 = RPG::SE.new(Mm12::FLOOR_SE, @dist_vol, rand(30) + 80)
          footstep_sound1.play
        end
        if @se_grass
          footstep_sound2 = RPG::SE.new(Mm12::GRASS_SE, @dist_vol, rand(30) + 80)
          footstep_sound2.play
        end
        if @se_wood
          footstep_sound2 = RPG::SE.new(Mm12::WOOD_SE, @dist_vol2, rand(30) + 80)
          footstep_sound2.play
        end
        if @se_snow
          footstep_sound2 = RPG::SE.new(Mm12::SNOW_SE, @dist_vol2, rand(30) + 80)
          footstep_sound2.play
        end
        @se_ok = true
      end
      return
    end
  end 
  def get_dist_vol
    @x_dist = $game_player.x - @x
    @y_dist = $game_player.y - @y
    if @x_dist < 0
      @x_dist *= -1
    end
    if @y_dist < 0
      @y_dist *= -1
    end
    @ttl_dist = @y_dist + @x_dist
    #p @ttl_dist
    @dist_vol = 60
    @dist_vol2 = 20
    @dist_vol -= @ttl_dist*3
    @dist_vol += rand(30)
    if @dist_vol < 0
      @dist_vol = 0
    end
    #p @dist_vol
    @dist_vol2 -= @ttl_dist*2
    @dist_vol2 += rand(30)
    if @dist_vol2 < 0
      @dist_vol2 = 0
    end
    #p @dist_vol2
  end
end
Thanks for the advice, to the both of you.

~Miget man12
Title: Re: Fairly Simple Footsteps Script
Post by: modern algebra on May 11, 2009, 11:40:09 PM
That's a lot better.

Good call, Yanfly.

However, miget man12 - recall that Game_Event is a subclass of Game_Character. Is there not some way you can simplify your script knowing that.

Even beyond that, your footstep_se method is confusingly large. It repeats, there doesn't seem to be a large difference between @se_ok being true or false, and certainly nothing that couldn't be resolved much shorter and without repetition.


It is a good script, but I would suggest that you re-evaluate your code structure and see if there are any ways you can simplify.
Title: Re: Fairly Simple Footsteps Script
Post by: jegnan on May 28, 2009, 12:02:26 PM
hmm, this script is nice but it only seems let my character move down. You can't go up, left, or right. The character goes down no matter which direction I input.I'm not using any other script.
Title: Re: Fairly Simple Footsteps Script
Post by: miget man12 on May 28, 2009, 02:22:53 PM
...that's weird, if you can send me something showing it, it may help.
Also, you may want to check this out, I forgot to put it here:
Spoiler for:
Code: [Select]
#==============================================================================
# ** Simple Footstep script
#  Credits: Miget man12,
#  I made this just so I could have a not-laggy, easy to use script. It doesn't
# really have any special features, but it works without the slightest bit of
# lag.
#  To have an event have footstep sounds, just put Comment:
# [footstep:type]
# Where type is the type of footstep, e.g.:
# [footstep:floor][footstep:grass][footstep:wood][footstep:snow]
#  This would make the event do all 4 types at the same time(Not advised,
# because the wood goes slightly after the floor and it sounds weird)
# Combinations sound good, the only thing that doesn't is 'wood' and 'floor'
#  To change whether the player or a specific event has footsteps mid-game,
# you use a simple call script.
# For The Player:
#  $game_player.se_(type) = true/false
# e.g.:
#  $game_player.se_floor = true/false
#  $game_player.se_grass = true/false
#  $game_player.se_wood = true/false
#  $game_player.se_snow = true/false
# For an Event:
#  $game_map.events[(Event ID)].se_(type) = true/false
#  The Event ID is the ID of the event on the map you are on
# e.g.:
#  $game_map.events[1].se_floor = true/false
#  $game_map.events[1].se_grass = true/false
#  $game_map.events[1].se_wood = true/false
#  $game_map.events[1].se_snow = true/false
#  All of these are preset to true if you have a the above comment for the
# respective type.
# *ALL OF THESE ARE RESET WHEN YOU ENTER A NEW MAP EXCEPT THE PLAYER'S OPTIONS*
#==============================================================================
$imported = {} if $imported == nil
$imported["Mm12Footsteps"] = true
module Mm12
  FLOOR_SE = "stepfloor"
  GRASS_SE = "stepgrass"
  WOOD_SE = "stepwood"
  SNOW_SE = "stepsnow"
  # For Iron Boots
  IRON_SE = []
  # Stepping(various dif. pitches)
  IRON_SE[0] = "OOT_Steps_IronBoots1"
  IRON_SE[1] = "OOT_Steps_IronBoots2"
  IRON_SE[2] = "OOT_Steps_IronBoots3"
  IRON_SE[3] = "OOT_Steps_IronBoots4"
  # For Jumping with iron boots
  IRON_SE[4] = "OOT_Steps_IronBoots_Jump"
  # For Landing(after jumping) with iron boots
  IRON_SE[5] = "OOT_Steps_IronBoots_Land"
  IRON_BOOT_ID = BOOT_ID[2]
end
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================

class Game_Player
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :se_floor
  attr_accessor :se_grass
  attr_accessor :se_wood
  attr_accessor :se_snow
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias ftstp_gp_initialize initialize
  alias ftstp_gp_increase_steps increase_steps
  alias mm12ftstp_gp_jump jump
  def initialize
    @se_ok = true
    ftstp_gp_initialize
  end
  def increase_steps
    ftstp_gp_increase_steps
    footstep_se
  end
  #--------------------------------------------------------------------------
  # * Jump
  #     x_plus : x-coordinate plus value
  #     y_plus : y-coordinate plus value
  #--------------------------------------------------------------------------
  def jump(x_plus, y_plus)
    if $imported["Mm12IronBoots"]
      if $game_party.members[0].armor2_id == Mm12::IRON_BOOT_ID
        RPG::SE.new(Mm12::IRON_SE[4]).play
      end
    end
    mm12ftstp_gp_jump(x_plus, y_plus)
    if $imported["Mm12IronBoots"]
      if $game_party.members[0].armor2_id == Mm12::IRON_BOOT_ID
        RPG::SE.new(Mm12::IRON_SE[5]).play
      end
    end
  end
  #---------------------------------------------------------------------------
  # * Footstep SE
  #---------------------------------------------------------------------------
  def footstep_se
    if @se_ok == true
      play_se
      @se_ok = false
    elsif @se_ok == false
      if $game_player.dash?
        @se_ok = true
      else
        play_se
        @se_ok = true
      end
      return
    end
  end
  def play_se
    if @se_floor
      RPG::SE.new(Mm12::FLOOR_SE, rand(30) + 80, rand(30) + 80).play
    end
    if @se_grass
      RPG::SE.new(Mm12::GRASS_SE, rand(30) + 40, rand(30) + 80).play
    end
    if @se_wood
      RPG::SE.new(Mm12::WOOD_SE, rand(30) + 40, rand(30) + 80).play
    end
    if @se_snow
      RPG::SE.new(Mm12::SNOW_SE, rand(30) + 40, rand(30) + 80).play
    end
    if $imported["Mm12IronBoots"]
      if $game_party.members[0].armor2_id == Mm12::IRON_BOOT_ID
        RPG::SE.new(Mm12::IRON_SE[rand(3)], rand(30) + 80).play
      end
    end
  end
end

#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
class Game_Event < Game_Character
  alias ftstp_setup setup
  #--------------------------------------------------------------------------
  # * Event page setup
  #--------------------------------------------------------------------------
  def setup(new_page)
    ftstp_setup(new_page)
    if !@list.nil?
      for i in 0...@list.size - 1
        next if @list[i].code != 108
        if @list[i].parameters[0].include?("[footstep:grass]")
          @se_grass = true
        end
        if @list[i].parameters[0].include?("[footstep:floor]")
          @se_floor = true
        end
        if @list[i].parameters[0].include?("[footstep:wood]")
          @se_wood = true
        end
        if @list[i].parameters[0].include?("[footstep:snow]")
          @se_snow = true
        end
      end
    end
  end
  def footstep_se
    get_dist_vol
    play_se
  end 
  def play_se
    if @se_floor
      RPG::SE.new(Mm12::FLOOR_SE, @dist_vol, rand(30) + 80).play
    end
    if @se_grass
      RPG::SE.new(Mm12::GRASS_SE, @dist_vol, rand(30) + 80).play
    end
    if @se_wood
      RPG::SE.new(Mm12::WOOD_SE, @dist_vol2, rand(30) + 80).play
    end
    if @se_snow
      RPG::SE.new(Mm12::SNOW_SE, @dist_vol2, rand(30) + 80).play
    end
  end
  def get_dist_vol
    @x_dist = $game_player.x - @x
    @y_dist = $game_player.y - @y
    if @x_dist < 0
      @x_dist *= -1
    end
    if @y_dist < 0
      @y_dist *= -1
    end
    @ttl_dist = @y_dist + @x_dist
    #p @ttl_dist
    @dist_vol = 60
    @dist_vol2 = 20
    @dist_vol -= @ttl_dist*3
    @dist_vol += rand(30)
    if @dist_vol < 0
      @dist_vol = 0
    end
    #p @dist_vol
    @dist_vol2 -= @ttl_dist*2
    @dist_vol2 += rand(30)
    if @dist_vol2 < 0
      @dist_vol2 = 0
    end
    #p @dist_vol2
  end
end

~Miget man12
Title: Re: Fairly Simple Footsteps Script
Post by: miget man12 on May 31, 2009, 08:19:16 PM
Okay, I'm going to go ahead and update this(despite the fact that no one seems to really care :D)
Here's the script:
Spoiler for:
Code: [Select]
#==============================================================================
# ** Simple Footstep script
#  Version 2.0
#  Credits:
#    Creator: Miget man12, Help improving from: Modern Algebra, Yanfly
#    Formula for getting Tile ID by DerVVulfman
#-----------------------------------------------------------------------------
#  I made this just so I could have a not-laggy, easy to use script. It doesn't
# really have any special features, but it works without very much lag. It is
# also being used in "The Legend of Zelda: Realm of the Gods", a Zelda
# fan-game(Hence the SE's from OoT :D) that I'm working on with Twilight1300.
#-----------------------------------------------------------------------------
# Instructions:
#  To have an event have footstep sounds, just put Comment:
# [footstep]
# To have an event or the player use footsteps:
# For The Player:
#  $game_player.footstep_se = true/false
# For an Event:
#  $game_map.events[(Event ID)].footstep_se = true/false
#  The Event ID is the ID of the event on the map you are on
# ***Event settings are reset when you tranfer***
#==============================================================================
$imported = {} if $imported == nil
$imported["Mm12Footsteps"] = true
module Mm12
  START_WITH_SE = true # Start out with player's footsteps enabled?
  #-----------------------------------------------------------------------------
  # For Iron Boots -- IGNORE THESE!!
  IRON_SE = []
  # Stepping(various dif. pitches)
  IRON_SE[0] = "OOT_Steps_IronBoots1"
  IRON_SE[1] = "OOT_Steps_IronBoots2"
  IRON_SE[2] = "OOT_Steps_IronBoots3"
  IRON_SE[3] = "OOT_Steps_IronBoots4"
  # For Jumping with iron boots
  IRON_SE[4] = "OOT_Steps_IronBoots_Jump"
  # For Landing(after jumping) with iron boots
  IRON_SE[5] = "OOT_Steps_IronBoots_Land"
  IRON_BOOT_ID = BOOT_ID[2]
  SWIM_SE = ["OOT_Link_Swim1", "OOT_Link_Swim2"]
  #-----------------------------------------------------------------------------
  # Okay, stop ignoring now :D
  BRIDGE_TILES = [72,73,74,75,76,77,78,79]
  CARPET_TILES = [30,38,162,218]
  DIRT_TILES = [16, 27]
  GRASS_TILES = [24,19,208]
  ICE_TILES = [129,130,131,132,133,134,141,142,151,181,205,215,229]
  LAVA_TILES = [14, 15]
  SAND_TILES = [32, 35]
  STONE_TILES = [144,145,146,147,148,149,163,164,165,166,176,177,192,193,194,195,
    196,197,200,201,208,209,210,211,212,213,219,220,221,222,232,233,234,235,236,
    237,240,241,243,248,249,250,251]
  TGRASS_TILES = [180,228]
  WOOD_TILES = [160,161,192,216,217]
  BRIDGE_SE = ["OOT_Steps_Bridge1", "OOT_Steps_Bridge2"]
  CARPET_SE = ["OOT_Steps_Carpet1", "OOT_Steps_Carpet2", "OOT_Steps_Carpet3",
    "OOT_Steps_Carpet4", "OOT_Steps_Carpet5"]
  DIRT_SE = ["OOT_Steps_Dirt1", "OOT_Steps_Dirt2", "OOT_Steps_Dirt3",
    "OOT_Steps_Dirt4", "OOT_Steps_Dirt5", "OOT_Steps_Dirt6"]
  GRASS_SE = ["OOT_Steps_Grass1", "OOT_Steps_Grass2", "OOT_Steps_Grass3",
    "OOT_Steps_Grass4", "OOT_Steps_Grass5", "OOT_Steps_Grass6",
    "OOT_Steps_Grass7"]
  ICE_SE = ["OOT_Steps_Ice1", "OOT_Steps_Ice2"]
  LAVA_SE = ["OOT_Steps_Lava1", "OOT_Steps_Lava2", "OOT_Steps_Lava3"]
  SAND_SE = ["OOT_Steps_Sand1", "OOT_Steps_Sand2", "OOT_Steps_Sand3",
    "OOT_Steps_Sand4", "OOT_Steps_Sand5"]
  STONE_SE = ["OOT_Steps_Stone1", "OOT_Steps_Stone2", "OOT_Steps_Stone3",
    "OOT_Steps_Stone4", "OOT_Steps_Stone5", "OOT_Steps_Stone6"]
  TGRASS_SE = ["OOT_Steps_TallGrass1", "OOT_Steps_TallGrass2",
    "OOT_Steps_TallGrass3", "OOT_Steps_TallGrass4"]
  WOOD_SE = ["OOT_Steps_Wood1", "OOT_Steps_Wood2", "OOT_Steps_Wood3",
    "OOT_Steps_Wood4", "OOT_Steps_Wood5"]
end
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
  attr_accessor :footstep_se
end

class Game_Player
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias ftstp_gp_initialize initialize
  alias ftstp_gp_increase_steps increase_steps
  alias mm12ftstp_gp_jump jump
  def initialize
    @se_ok = true
    @footstep_se = true
    ftstp_gp_initialize
  end
  def increase_steps
    ftstp_gp_increase_steps
    footstep_se
  end
  #--------------------------------------------------------------------------
  # * Jump
  #     x_plus : x-coordinate plus value
  #     y_plus : y-coordinate plus value
  #--------------------------------------------------------------------------
  def jump(x_plus, y_plus)
    if $imported["Mm12IronBoots"]
      if $game_party.members[0].armor2_id == Mm12::IRON_BOOT_ID
        RPG::SE.new(Mm12::IRON_SE[4]).play
      end
    end
    mm12ftstp_gp_jump(x_plus, y_plus)
    if $imported["Mm12IronBoots"]
      if $game_party.members[0].armor2_id == Mm12::IRON_BOOT_ID
        RPG::SE.new(Mm12::IRON_SE[5]).play
      end
    end
  end
  #---------------------------------------------------------------------------
  # * Footstep SE
  #---------------------------------------------------------------------------
  def footstep_se
    if @se_ok == true
      @num = 0
      play_se
      @se_ok = false
    elsif @se_ok == false
      if $game_player.dash?
        @se_ok = true
      else
        @num = 1
        play_se
        @se_ok = true
      end
      return
    end
  end
  def play_se
    unless $game_map.ship.driving or $game_map.boat.driving or $game_map.airship.driving or !@footstep_se
      if Mm12::BRIDGE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 2]))
        RPG::SE.new(Mm12::BRIDGE_SE[rand(Mm12::BRIDGE_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::CARPET_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::CARPET_SE[rand(Mm12::CARPET_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::DIRT_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::DIRT_SE[rand(Mm12::DIRT_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::GRASS_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::GRASS_SE[rand(Mm12::GRASS_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::ICE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::ICE_SE[rand(Mm12::ICE_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::LAVA_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::LAVA_SE[rand(Mm12::LAVA_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::SAND_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::SAND_SE[rand(Mm12::SAND_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::STONE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::STONE_SE[rand(Mm12::STONE_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::TGRASS_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::TGRASS_SE[rand(Mm12::TGRASS_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      elsif Mm12::WOOD_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::WOOD_SE[rand(Mm12::WOOD_SE.size-1)], rand(30) + 80, rand(30) + 80).play
      end
      if $imported["Mm12IronBoots"]
        if $game_party.members[0].armor2_id == Mm12::IRON_BOOT_ID and !$game_map.landvhcl.driving
          RPG::SE.new(Mm12::IRON_SE[rand(3)], rand(30) + 80).play
        end
      end
    end
    if $imported["Mm12Swimming"]
      #p "so this works..."
      if $game_map.ship.driving or $game_map.boat.driving
        #p "Odd..."
        RPG::SE.new(Mm12::SWIM_SE[@num], 100, 100).play
      end
    end
  end
end

#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
class Game_Event < Game_Character
  alias ftstp_setup setup
  #--------------------------------------------------------------------------
  # * Event page setup
  #--------------------------------------------------------------------------
  def setup(new_page)
    ftstp_setup(new_page)
    if !@list.nil?
      for i in 0...@list.size - 1
        next if @list[i].code != 108
        if @list[i].parameters[0].include?("[footstep]")
          @footstep_se = true
        end
      end
    end
  end
  def footstep_se
    get_dist_vol
    play_se
  end  
  def play_se
    if @footstep_se
      if Mm12::BRIDGE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 2]))
        RPG::SE.new(Mm12::BRIDGE_SE[rand(Mm12::BRIDGE_SE.size-1)], @dist_vol, rand(30) + 80).play
      elsif Mm12::CARPET_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::CARPET_SE[rand(Mm12::CARPET_SE.size-1)], @dist_vol, rand(30) + 80).play
      elsif Mm12::DIRT_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::DIRT_SE[rand(Mm12::DIRT_SE.size-1)], @dist_vol, rand(30) + 80).play
      elsif Mm12::GRASS_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::GRASS_SE[rand(Mm12::GRASS_SE.size-1)], @dist_vol, rand(30) + 80).play
      elsif Mm12::ICE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::ICE_SE[rand(Mm12::ICE_SE.size-1)], @dist_vol, rand(30) + 80).play
      elsif Mm12::LAVA_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::LAVA_SE[rand(Mm12::LAVA_SE.size-1)], @dist_vol, rand(30) + 80).play
      elsif Mm12::SAND_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::SAND_SE[rand(Mm12::SAND_SE.size-1)], @dist_vol, rand(30) + 80).play
      elsif Mm12::STONE_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::STONE_SE[rand(Mm12::STONE_SE.size-1)], @dist_vol, rand(30) + 80).play
      elsif Mm12::TGRASS_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::TGRASS_SE[rand(Mm12::TGRASS_SE.size-1)], @dist_vol, rand(30) + 80).play
      elsif Mm12::WOOD_TILES.include?($game_map.tile_index($game_map.data[@x, @y, 0]))
        RPG::SE.new(Mm12::WOOD_SE[rand(Mm12::WOOD_SE.size-1)], @dist_vol, rand(30) + 80).play
      end
    end
  end
  def get_dist_vol
    @x_dist = $game_player.x - @x
    @y_dist = $game_player.y - @y
    if @x_dist < 0
      @x_dist *= -1
    end
    if @y_dist < 0
      @y_dist *= -1
    end
    @ttl_dist = @y_dist + @x_dist
    #p @ttl_dist
    @dist_vol = 60
    @dist_vol2 = 20
    @dist_vol -= @ttl_dist*3
    @dist_vol += rand(30)
    if @dist_vol < 0
      @dist_vol = 0
    end
    #p @dist_vol
    @dist_vol2 -= @ttl_dist*2
    @dist_vol2 += rand(30)
    if @dist_vol2 < 0
      @dist_vol2 = 0
    end
    #p @dist_vol2
  end
end
class Game_Map
  #--------------------------------------------------------------------------
  # * DerVVulfman method L get_tile_index
  #--------------------------------------------------------------------------
  def tile_index(tile_id)
    case tile_id
      # Multi-tiled ids in Tileset 'A'
      when 2048..8191; return ((tile_id - 2000) / 48) - 1
      # Individual tile ids in Tileset 'A'
      when 1536..1663; return(tile_id - 1408)
      # Tilesets 'B' to 'E'
      when 0..1023; return (tile_id + 256)
    end
    return 0
  end  
end
New Features:
-Play different SEs depending on which tile ID you're standing on
-randomized SEs for realistic effects
For the SEs that it's configured to use, go here:
http://noproblo.dayjo.org/ZeldaSounds/OOT/index.html#Footsteps
(Credits to Nintendo :D)

@MA: Most of the methods are different b/w Events and the Player, I tried my best :|
As for the @se_ok thing, that's for when you're dashing, if you're dashing it sounds kind of bad if they're too fast, so I made it go half as fast.

@jegnan: There's really no way it would do that, because this doesn't affect any of that stuff O_o

EDIT: Wait, I'm allowed to update it even if it's double-posting, right?

~Miget man12
Title: Re: Fairly Simple Footsteps Script
Post by: modern algebra on May 31, 2009, 08:22:18 PM
Yeah, it's fine to double post with an update. Nice work miget man
Title: Re: Fairly Simple Footsteps Script
Post by: shandy333 on August 09, 2009, 05:19:47 PM
So am I suppose to download all of the sound effects?
Title: Re: Fairly Simple Footsteps Script
Post by: miget man12 on August 09, 2009, 08:04:59 PM
Well, you can change the SE names in the script if you want to use different ones. I just use those SEs myself, so it's set up for them. Just edit the customization ^_^
Also, I forgot to put version 2.5 of the script on these forums.(I got your PM, this'll fix that problem) Just get the script from the first post.

~Miget man12
Title: Re: Fairly Simple Footsteps Script
Post by: shandy333 on August 10, 2009, 04:27:21 AM
Hey, that's wonderful. I had no choice but to download those sounds anyway. It was a pretty good choice.
Will I have to change anything when I get the new script?

Oh and that Why's (poignant) guide to ruby. Is the best guide ever. :(
Title: Re: Fairly Simple Footsteps Script
Post by: miget man12 on August 10, 2009, 04:33:39 AM
um, you may want to copy your old customization if you changes stuff. Other than that, it should be fine.

~Miget man12
Title: Re: Fairly Simple Footsteps Script
Post by: shandy333 on August 10, 2009, 05:38:25 AM
No changes were needed, thanks. :-[
Title: Re: Fairly Simple Footsteps Script
Post by: Uniquesone on December 15, 2009, 12:15:50 AM
Thank you very much for this great script.

Can you give me the script to find out the tile id?

Thanks
Title: Re: Fairly Simple Footsteps Script
Post by: miget man12 on December 15, 2009, 01:32:26 AM
You can use this: http://www.rpgrevolution.com/forums/index.php?showtopic=26217

~Miget man12
Title: Re: Fairly Simple Footsteps Script
Post by: Mr_Wiggles on December 15, 2009, 06:33:31 AM
Dude, awsome idk that there was a script that did this, too bad its not for XP, im sure theres one out there but i realy dont "need" it.

your script looks simple enough to use as well
Title: Re: Fairly Simple Footsteps Script
Post by: h3llh0und on December 15, 2009, 05:09:58 PM
Any chance of someone uploading the sounds again?

if it's not too much I would like to ask for an 4shared link