Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

RMXP: Tile-dependent Footsteps

Script Request Template

Script Title:
Footsteps
RMXP or RMVX:
RMXP
Detailed Description:
This is a major feature that was once existed in RM2K3 where you can hear footsteps depending on the tile you step on. And I believed this was once used in Cell Chamber: Chicane, and was done by eventing in Iron Gaia 2. Since I've collected a handful of footstep SFX clips from different games, especially from MMORPGs, I would like it to use it in RMXP.

Screen shots:
(this may not need a screenshot, I think)

Other Scripts I am using (in order):
Change Map Tileset
Passive Skills by Gando
Maximize Party Size
Advanced Messaging System R4 (edited)
Enhanced Weapons by Charlie Lee
Mail Client by GoldenShadow
Jaberwocky's Quest Log
Guillaume777's Multi-Slots
GubiD's Tactical Battle System
GTBS Particle Engine Patch
GTBS Multi-Attack Patch
Unarmed Actors by Leon
GTBS Unarmed Actors Patch
GTBS Passive Skills Patch
Actor Customization by Synthesize
Particle Engine by Arevulopapo

Provided that it can be turned on or off during tactical battle sequences.
 

Yin

Member

Hey there's one made by Kain Nobel already.
Code:
#===============================================================================

# ** Player & Event Step Sound Effects

#-------------------------------------------------------------------------------

# Written by    : Kain Nobel

# Version       : 1.0

# Last Updated  : 7/20/2008

# Date Created  : 6/20/2008

#===============================================================================

################################################################################

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#

# ~**                 CUSTOMIZABLE CONSTANTS - BEGIN                       **~ #

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#

################################################################################

module StepSFX

  #-----------------------------------------------------------------------------

  # * Is this script active and enabled?

  #-----------------------------------------------------------------------------

  Enabled     = true

  #-----------------------------------------------------------------------------

  # * Horizontal Limit before event is out of range.

  #-----------------------------------------------------------------------------

  Arg_Dist_X  = 6

  #-----------------------------------------------------------------------------

  # * Vertical Limit before event is out of range.

  #-----------------------------------------------------------------------------

  Arg_Dist_Y  = 4

  #-----------------------------------------------------------------------------

  # * The master volume of the step sound effects.

  #-----------------------------------------------------------------------------

  Volume      = 50

  #-----------------------------------------------------------------------------

  # * The modifier for the step sound effect volume (for events vs player dist)

  #-----------------------------------------------------------------------------

  Adjust      = 2.5

  #-----------------------------------------------------------------------------

  # * Step sounds based on terrain tag ID

  #-----------------------------------------------------------------------------

  Tag = {

    # Default tag for no terrain

    0 => "Steps-00-Default",

    # Special Terrains such as grass, water, etc...

    1 => "Steps-01-Grass",

    2 => "Steps-02-Cement",

    3 => "Steps-03-Dirt",

    4 => "Steps-07-Snow",

    5 => "Steps-05-Wood",

    6 => "Steps-06-Metal",

    7 => "step in water"

  }

end

################################################################################

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#

# ~**                  CUSTOMIZABLE CONSTANTS - END                        **~ #

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#

################################################################################

#===============================================================================

# ** Game_Character

#-------------------------------------------------------------------------------

#   This class has been enhanced to use step sounds with player/events based on

# terrain tags.

#===============================================================================

class Game_Character

  #-----------------------------------------------------------------------------

  # * Alias Listing

  #-----------------------------------------------------------------------------

  alias_method  :kn_step_sounds_game_character_update,     :update

  #-----------------------------------------------------------------------------

  # * Update Method (Aliased)

  #-----------------------------------------------------------------------------

  def update

    if StepSFX::Enabled && self.moving? && arg_frames

      if arg_screen_x && arg_screen_y

        if within_x && within_y

          play_step_sounds

        end

      end

    end

    kn_step_sounds_game_character_update

  end

  #-----------------------------------------------------------------------------

  # * Play Step Sounds

  #-----------------------------------------------------------------------------

  def play_step_sounds

    sound_effect = "Audio/SE/"+StepSFX::Tag[self.terrain_tag]

    if StepSFX::Tag.has_key?(self.terrain_tag)

      begin

        Audio.se_play(sound_effect, walk_volume, 75)

      rescue

      end

    end

  end

  #-----------------------------------------------------------------------------

  # * Frame Count Argument

  #-----------------------------------------------------------------------------

  def arg_frames

    unless @move_speed.nil?

      return ((Graphics.frame_count + 2 * self.id) % (18 - @move_speed)).zero?

    end

  end

  #-----------------------------------------------------------------------------

  # * Screen X Argument

  #-----------------------------------------------------------------------------

  def arg_screen_x

    return (self.screen_x > 0 && self.screen_x < 640)

  end

  #-----------------------------------------------------------------------------

  # * Screen Y Argument

  #-----------------------------------------------------------------------------

  def arg_screen_y

    return (self.screen_y > 0 && self.screen_y < 480)

  end

  #-----------------------------------------------------------------------------

  # * Distance X Argument

  #-----------------------------------------------------------------------------

  def arg_distance_x

    return ((self.x + $game_player.x) / 2)

  end

  #-----------------------------------------------------------------------------

  # * Distance Y Argument

  #-----------------------------------------------------------------------------

  def arg_distance_y

    return ((self.y + $game_player.y) / 2)

  end

  #-----------------------------------------------------------------------------

  # * Within Distance X

  #-----------------------------------------------------------------------------

  def within_x

    return arg_distance_x < (StepSFX::Arg_Dist_X * 32)

  end

  #-----------------------------------------------------------------------------

  # * Within Distance Y

  #-----------------------------------------------------------------------------

  def within_y

    return arg_distance_y < (StepSFX::Arg_Dist_Y * 32)

  end

  #-----------------------------------------------------------------------------

  # * Define Walk Volume

  #-----------------------------------------------------------------------------

  def walk_volume

    return StepSFX::Volume+(StepSFX::Adjust*(arg_distance_x+arg_distance_y)/2)

  end

end

 

#===============================================================================

# ** Game_Player

#-------------------------------------------------------------------------------

#   Game_Player's walk volume doesn't have to be measured against anything, so

# this class's volume is constantly a certain value * 2. This overrides the

# 'walk_volume' method in Game_Character.

#===============================================================================

 

class Game_Player < Game_Character

  #-----------------------------------------------------------------------------

  # * Define Walk Volume

  #-----------------------------------------------------------------------------

  def walk_volume

    return StepSFX::Volume * 2

  end

end

 
I'm using it and it works like a charm. I never tried turning it off, but there is a section that says enabled = true/false so I think you should be able to turn it on/off whenever you want. Also, I believe he's still active so if you need any help with it, you can just pm him.
 

Atoa

Member

There's an script that allows you to add terrain higher than 7, if i'm not wrogn it was done by sephirot spwn, but i don't have the link (actually, i'm looking for it too...)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top