MV FTKR Display Regenerate Message - Add sound effects

I tried editing FTKR Display Regenerate Message to add sound effects to the notification, but after inserting the snippet the battle log no longer shows.

I tried inserting it right after this.gainHp(value); and at the very end of Game_Battler.prototype.regenerateHp but it had the same effect; The correct sound effects play, but the battlelog no longer appears when they do.
Spoiler: Attempts so far:
Code:
Game_Battler.prototype.regenerateHp = function() {
    var value = Math.floor(this.mhp * this.hrg);
    value = Math.max(value, -this.maxSlipDamage());
    if (value !== 0) {
        this.gainHp(value);
    // rethy edit
    if (value > 0) {
        SoundManager.playRecovery();
    }
    else {
        AudioManager.playSe({
        name: 'Poison',
        volume: 30,
        pitch: 100,
        pan: 0});
        SoundManager.playActorDamage();
    }
        var message = value > 0 ? FTKR.DRM.message.hpPlus : FTKR.DRM.message.hpMinus;
        this.setupBattleLogMessage(value, message, TextManager.hp);
    }
};
Code:
Game_Battler.prototype.regenerateHp = function() {
    var value = Math.floor(this.mhp * this.hrg);
    value = Math.max(value, -this.maxSlipDamage());
    if (value !== 0) {
        this.gainHp(value);
        var message = value > 0 ? FTKR.DRM.message.hpPlus : FTKR.DRM.message.hpMinus;
        this.setupBattleLogMessage(value, message, TextManager.hp);
    // rethy edit
    if (value > 0) {
        SoundManager.playRecovery();
    }
    else {
        AudioManager.playSe({
        name: 'Poison',
        volume: 30,
        pitch: 100,
        pan: 0});
        SoundManager.playActorDamage();
    }

    }
};

Additionally, how do you disable regeneration due to map steps for armor/weapons with the HP Regeneration EX-Parameter? I only noticed it after adding sound effects, but it's not the intended behavior.
That edit looks good to me, are you sure you didn't make some other mistakes?

For your other question, if you want the regen (but other traits yes) to not count on map only for armors/weapons, I guess you need to alter what it counts for the trait objects (or maybe someone knows another way). So put something like this I think:

Game_BattlerBase.prototype.traitsWithId = function(code, id) {
if (!$gameParty.inBattle() && code === Game_BattlerBase.TRAIT_XPARAM && id === 7) {
return this.notAllTraits().filter(function(trait) {
return trait.code === code && trait.dataId === id;
});
} else {
return this.allTraits().filter(function(trait) {
return trait.code === code && trait.dataId === id;
});
}
};

Game_BattlerBase.prototype.notAllTraits = function() {
return this.notAllTraitObjects().reduce(function(r, obj) {
return r.concat(obj.traits);
}, []);
};

Game_Actor.prototype.notAllTraitObjects = function() {
var objects = Game_Battler.prototype.traitObjects.call(this);
objects = objects.concat([this.actor(), this.currentClass()]);
// var equips = this.equips();
// for (var i = 0; i < equips.length; i++) {
// var item = equips[i];
// if (item) {
// objects.push(item);
// }
// }
return objects;
};
I tested the edited version in a project with no other plugins and it had the same effect, the battlelog messages don't appear but the SE plays. I assumed it's some small syntax error, but all the brackets look okay to me as well.

On the other hand, the code you gave for the second part of the problem seems to be working perfectly.
Cool.

For the notification I tested it quickly by copy pasting your code there and unless I'm mistaken it seemed to work for me? A sound effect played and the japanese text that's in the pluggin settings default appeared there when I took poison damage.
Cool.

For the notification I tested it quickly by copy pasting your code there and unless I'm mistaken it seemed to work for me? A sound effect played and the japanese text that's in the pluggin settings default appeared there when I took poison damage.
I got it.

It's one of those plugins where it doesn't work if you change the name, but it didn't say in the help and I usually save my edits as a separate copy. I figured it out after you mentioned Japanese text and downloaded the untranslated version to compare.

If one character regens and another degens it plays both sound effects at the same time, but I am going to call this functionally finished now, thanks for the help.

Original thread: https://forums.rpgmakerweb.com/threads/ftkr-display-regenerate-message-add-sound-effects.183174/