MV Yanfly Battle Core - Show HP Text - Playing Sound Twice

Hello all,

I'm using Yanfly's Battle Core in my MV game. I am having issues with the specific feature where I can show HP damage in the battle log at the top (hero took x damage!). With this disabled, all goes well. With it enabled, when I use a skill that hits multiple enemies, it plays the attack SOUND twice when damaging each foe except for the last one. It shows the foe flashing twice as well.

To better highlight what i mean, I have a video I Took where I isolated everything in a project with ONLY battle core and core engine enabled. This issue still occurs independently of whether or not core engine is enabled; only if battle engine is enabled does this occur. For clarity I performed a normal attack before performing the area attack.



I would like each target for this attack to be damaged exactly how the latter of the two enemies was damaged--flashing once, playing the sound once. I am unsure if this is fixable or hard-coded into the battle core code. I can provide the relevant code snippets if necessary.

Thank you!
Just as a quick measure, try putting into the notes of the skill:
<whole action>
</whole action>

Does that make a difference?
Just as a quick measure, try putting into the notes of the skill:
<whole action>
</whole action>

Does that make a difference?
Just tested, nothing changed
Paste the below into a text editor, save as a *.js file, include as a plugin above the Battle Engine Core.

Code:
Window_BattleLog.prototype.displayHpDamage = function(target) {
        this.push('addText', this.makeHpDamageText(target));
};
Paste the below into a text editor, save as a *.js file, include as a plugin above the Battle Engine Core.

Code:
Window_BattleLog.prototype.displayHpDamage = function(target) {
        this.push('addText', this.makeHpDamageText(target));
};
Thank you for the plugin! It did fix what was occurring, except it introduced an issue where it pushes the HP text for ANY action that occurs, including those that aren't supposed to deal any damage. Even defending says "hero took 0 damage." Is there a way to purposely trigger the plugin only for specific skills?
Oh, hah, let me do that more carefully then.

Code:
Window_BattleLog.prototype.displayHpDamage = function(target) {
    if (target.result().hpAffected) {
        this.push('addText', this.makeHpDamageText(target));
    }
};
Oh, hah, let me do that more carefully then.

Code:
Window_BattleLog.prototype.displayHpDamage = function(target) {
    if (target.result().hpAffected) {
        this.push('addText', this.makeHpDamageText(target));
    }
};
That works far better, exactly as I was looking for. Thank you!

As a side note, this does mess slightly with the counterattack feature. It'll play the attack sound twice for THAT, and it also plays before the message for damage there even shows up... I wish I knew javascript so I wouldn't have to keep asking, but if there's a way to separately avoid triggering this plugin when counterattacking, I think that would fix everything!
As a side note, this does mess slightly with the counterattack feature...avoid triggering this plugin when counterattacking
I assume your "this" is the Battle Engine Core? There's nothing in the code I gave you that changes anything regarding countering.

Is it the same thing? This happens when the Show HP Text parameter is on?
I assume your "this" is the Battle Engine Core? There's nothing in the code I gave you that changes anything regarding countering.

Is it the same thing? This happens when the Show HP Text parameter is on?
Sorry, should have clarified, I think I worded that wrong. Your plugin was not the issue with the counterattack feature, especially not after further testing. BattleCore is doing the same thing on a counterattack that your code fixed for normal AoE attacks: playing double animation sounds. This does occur when the show HP text parameter is on.
I see where the battle log info is displaying before the counter happens. Putting this as a plugin below the Battle Engine Core should fix that.

Code:
Window_BattleLog.prototype.displayCounter = function(target) {
    target.performCounter();
    this.showAttackAnimation(target, [BattleManager._subject]);
    this.waitForAnimation();
    if (Yanfly.Param.BECShowCntText) {
      this.addText(TextManager.counterAttack.format(target.name()));
    }
};

I don't see what would be causing the double sound effect. Are you sure you're not hearing the Evasion sound and the sound for the attack animation and they're set to the same sound? Or similar?

There's not anyplace else in the code that the Show HP Text parameter is referenced, so I don't think that could be causing this.


Here's a video of what's going on now. The area of effect "Cleaving Strike" works like a charm. The "Riposte" skill grants a chance to counterattack, so there's a couple times here where the main character doesn't counter. Note that when he does, and kills that slime, it plays the death sound twice, too. If it's just a hit, it plays the hit sound twice. That no longer happens upon disabling Battle Core Engine, but of course I'd like to keep the plugin in my game.

Edit: This includes both of the plugins you have provided.
What version of the Battle Engine Core are you using? I made a test project with just that plugin and I can't reproduce your bug.
What version of the Battle Engine Core are you using? I made a test project with just that plugin and I can't reproduce your bug.
I'm on v1.34. I will check if there's a new version up, that's a fair point.
That's really outdated.

That's a number of releases before it was updated to work correctly with MV version 1.3.2 in October of 2016, and there were many further revisions after that.
That's really outdated.

That's a number of releases before it was updated to work correctly with MV version 1.3.2 in October of 2016, and there were many further revisions after that.
Strange, considering I got it not that long ago. Either way, I updated to 1.51 and am having the exact same issues, unfortunately. Is that the newest version? I got it fresh off their website.
Is your MV up to date? If you open rpg_core.js, does it say 1.6.x at the top?

I don't know what else to say. I put Battle Engine Core 1.51 into a new project, used all the default settings, added counter attack 100% to all actors. When they counter attack both the hits and kills produce one sound effect. Both side and front view.

If you find out there's some plugin parameter or specific setting that can cause the bug, maybe someone can figure something out.
Is your MV up to date? If you open rpg_core.js, does it say 1.6.x at the top?

I don't know what else to say. I put Battle Engine Core 1.51 into a new project, used all the default settings, added counter attack 100% to all actors. When they counter attack both the hits and kills produce one sound effect. Both side and front view.

If you find out there's some plugin parameter or specific setting that can cause the bug, maybe someone can figure something out.
Yep, rpg_core shows 1.6.2 as the version.

Remember from above, the issue arises from wanting to show the HP text in combat. When I have that enabled this issue occurs, and without it it seems to be fine. I am tempted to just leave it be for now or enable the damage popup instead and just not worry about it.

Thank you for all of the help!
Remember from above, the issue arises from wanting to show the HP text in combat. When I have that enabled this issue occurs
...okay, I didn't hear it in my testing because I had the fix I gave you in Post #6 installed for the area attacks.

When I turn on the HP Text and turn off that fix, I do hear the duplicate sounds. But as soon as I turn my fix back on the duplicate sounds go away in all occasions. I am back to not being able to duplicate your bug.
Yep, the Post #6 fix has worked extremely well! The issue that came up now is the one I mentioned in Post #11 with the Riposte effect, which I have been unable to find a solution since I uploaded the video earlier today. That's now the part I'm taking issue with.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-battle-core-show-hp-text-playing-sound-twice.163110/