Joined
Apr 30, 2020
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMMV
My project required modifying the YEP_FootstepSounds plugin, and along the way I encountered and repaired a possible bug. Specific tiles were playing the step sounds of adjacent tiles, rather than the tile the player was actually on. For example, playing grass sounds when walking on stone. It turns out the x,y used to determine the tile and corresponding tile-tag was being offset for some unknown purpose.

The fix was to remove these lines from Game_CharacterBase.prototype.playFootstepSound function:
JavaScript:
if (this.x === 6) {
    x += 1;
  } else if (this.x === 4) {
    x -= 1;
  }
if (this.y === 2) {
    y += 1;
  } else if (this.y === 8) {
    y -= 1;
}

These lines cause off-by-one errors when using region/tile footstep sounds. I might be missing something, but to me these lines seem wholly unnecessary. They seem almost intentionally erroneous, but perhaps that's just because I don't see their intent. Perhaps the creator forgot to remove an adjustment they made specific to their game?
 
Last edited:

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
797
Reaction score
642
First Language
English
Primarily Uses
RMMV
I believe it should be this.direction() instead of this.x and this.y. That would make it so that when playing repeated footsteps you play the ones of the next tile (ie: the tile you're moving into)
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,509
Reaction score
14,851
First Language
English
Primarily Uses
RMMV
It depends entirely on context.

I'm pretty sure if Yanfly had a bug in any plugins, they would have been brought to light a long, long time ago and fixed.

Are you sure that your mod isn't what caused the issue?
 
Joined
Apr 30, 2020
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMMV
These are both good points. I'll test with an unmodified version of the plugin file, the default "MoveN" sounds, and a fresh project to see if it's more likely the changes I made.

So far, with the unmodified plugin, I'm seeing the same behavior. It does seem like they could have been attempting to play the tile you were moving into. Might have been missed just because it only affects tiles in certain row/columns which are adjacent to a tile of a different sound. Here's the larger context of the issue:

JavaScript:
// Called by processFootstepSound, which is called by both increaseSteps functions.
// Terrain tag and region ID are correct if x != 6 or 4, or y != 2 or 8
Game_CharacterBase.prototype.playFootstepSound = function(volume, pitch, pan) {
  if (volume <= 0) return;
  if (pitch <= 0) return;
  if (!$dataMap) return;
  if (!$dataMap.regionFootstepSounds) DataManager.processMapFootstepNotetags();
  var x = this.x;
  if (this.x === 6) {  // Location of possible error, results in region/terrain off-by-ones
    x += 1;
  } else if (this.x === 4) {
    x -= 1;
  }
  var y = this.y;
  if (this.y === 2) {
    y += 1;
  } else if (this.y === 8) {
    y -= 1;
  }
  var regionId = $gameMap.regionId(x, y)
  var terrainTag = $gameMap.terrainTag(x, y);
  if (regionId > 0) {
    var footstepData = $dataMap.regionFootstepSounds[regionId];
  }
  if (!footstepData && terrainTag > 0) {
    var footstepData = $gameMap.tileset().terrainTagFootstepSounds[terrainTag];
  }
  if (!footstepData) footstepData = $dataMap.regionFootstepSounds[0];
  var se = {
    name:   footstepData[0],
    volume: footstepData[1] * volume,
    pitch:  footstepData[2] * pitch,
    pan:    pan.clamp(-100, 100)
  };
  AudioManager.playSe(se);
};

// Calls playFootstepSound, does not affect terrainTag/region determination
Game_CharacterBase.prototype.processFootstepSound = function() {
  if (this.canPlayFootsteps() && $gameSystem.canHearFootsteps()) {
    var player = $gamePlayer;
    var distance = $gameMap.distance(this.x, this.y, player.x, player.y);
    var volume = Yanfly.Param.Footsteps.EventVolume || 0;
    volume += distance * Yanfly.Param.Footsteps.DistanceVolume;
    var pitch = Yanfly.Param.Footsteps.EventPitch || 0;
    pitch += distance * Yanfly.Param.Footsteps.DistancePitch;
    var pan = 0;
    pan -= $gameMap.deltaX(this.x, player.x);
    this.playFootstepSound(volume, pitch, pan);
  };
};
 
Last edited:

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
797
Reaction score
642
First Language
English
Primarily Uses
RMMV
It depends entirely on context.

I'm pretty sure if Yanfly had a bug in any plugins, they would have been brought to light a long, long time ago and fixed.

Are you sure that your mod isn't what caused the issue?
yanfly plugins still have unpatched bugs, for example the event copier has a typo so it never runs post copy code, and always runs precopy code twice.

It says
Yanfly.Param.EventCopierPostCopy = JSON.parse(Yanfly.Parameters['PreCopyCode']);
but should say
Yanfly.Param.EventCopierPostCopy = JSON.parse(Yanfly.Parameters['PostCopyCode']);

There's no place to report them officially without spending money though
 

KaitlynKitty

Villager
Member
Joined
Apr 6, 2021
Messages
9
Reaction score
0
First Language
English
Primarily Uses
RMMV
My project required modifying the YEP_FootstepSounds plugin, and along the way I encountered and repaired a possible bug. Specific tiles were playing the step sounds of adjacent tiles, rather than the tile the player was actually on. For example, playing grass sounds when walking on stone. It turns out the x,y used to determine the tile and corresponding tile-tag was being offset for some unknown purpose.

The fix was to remove these lines from Game_CharacterBase.prototype.playFootstepSound function:
JavaScript:
if (this.x === 6) {
    x += 1;
  } else if (this.x === 4) {
    x -= 1;
  }
if (this.y === 2) {
    y += 1;
  } else if (this.y === 8) {
    y -= 1;
}

These lines cause off-by-one errors when using region/tile footstep sounds. I might be missing something, but to me these lines seem wholly unnecessary. They seem almost intentionally erroneous, but perhaps that's just because I don't see their intent. Perhaps the creator forgot to remove an adjustment they made specific to their game?
I tried your fix and it gives me an error that y is undefined when I try to move.
Edit: It turns out there's just another thing in between the two that I didn't realize was important. It's fixed now!
 

Latest Threads

Latest Posts

Latest Profile Posts

MrSaturnMZ.png Can confirm that Mr. Saturn is appearing in Vtubers Vs MOTHER and here's the MV/MZ compatible sprite sheet for them.
Final Fantasy IX is apparently getting an animated adaptation - coming from IGN, so this news has bite to it. FF9 is one of the best turn-based RPGs ever imo. https://www.ign.com/articles/final-fantasy-9-animated-series-announced
I hope everyone is well. Just a quick update, I am working on my college degree right now so that's why I've delayed a lot of my Old RPG maker projects until further notice. I hope you're all making good progress and that you have fun working on them gems. Keep hammering away.
Don't think I can ignore this anymore, but it only happens like once a day. Not sure why my entire pc slows down though, its using a lot of memory but not compared to my max. Seem the thread about updating the nwjs it a while ago, it just looked like a pain/tldr :p
nwjs.PNG

Forum statistics

Threads
112,430
Messages
1,068,249
Members
146,086
Latest member
WrathOfWood
Top