Yanfly plugin library: How to show a message window when landing a critical hit / hitting an elemental weakness etc? (solved)

Hello there,
I would like a message window containing the message "heavy blow" to pop up in battle upon successfully landing a critical hit, or a message with "*name of target goes here* is weak against this element!" when hitting an elemental weakness. How could I accomplish this? I have the Yanfly Plugin-Library, in case it helps.

I greatly appreciate any aid.
I would use Yanfly's Damage Core for the critical hit message.

Go into the plugin parameters and line 30 is where the critical check is. So on one of the lines after that you can add something like:
Code:
SceneManager._scene._logWindow.addText("Heavy blow!");

For the elemental part...I think the easiest way would be
- copy line 2 to line 3
- change line 2 to let oldDam = baseDamage;
- insert on line 4 if (oldDam<baseDamage) SceneManager._scene._logWindow.addText(target.name + " is weak against this element!");

I haven't actually used the battle log before, but that's the script call I found, so see how that all works.
I set everything up as you said. The first suggestion does not give any reaction, unfortunately.
The second suggestion, however, gives out somekind of debug message in the battle log but it vanishes way too fast to be read. So no luck here, unfortunately.

Maybe it is just possible to call a common event with a message window whenever a critical hit / elemental weakness is hit? As that would do it for me.
So far, thank you for your suggestions.
If you want just a regular message window, you can replace the code I gave you with that script call - you can Google it or look it up in the pinned MV script call thread.

Personally, I as a player would find it very annoying every time something like that happened and a window popped up that I had to click through.

Perhaps someone else who has worked with the battle log will chime in to fix the function calls I offered, it must be something with adding a wait or something.
I might do that. Thank you for the help.
Yes, I know about the risk of annoyances like this. I am still trying to figue out a better thing for that.

Spoiler: Why this method
For now my reason for this method to be the desired one is, to be frank, because I am currently "porting" an SNES-RPG over to MV and I am getting closer and closer to the original. I got the overworld-part of it working like around 95 to 97% and I am working on the battle-part of the game now. Just by doing that, I learn to use RPGMMV more efficiently over time. Luckily the several plugins available for MV are suited just great to accomplish that. However, since I still have much to learn in terms of actual coding, I yet have to take some big steps here and there.
I assume that it should be easy to call a message window or battle message based on certain checks, but for me this is still not doable on my own.

But as I said, I first like to learn how to do it by this method, then, afterwards I can see how I could improve it and make it non-annoying. I plan on posting an actual thread for the ported game, after I have done about 50% of the game.
If you want just a regular message window, you can replace the code I gave you with that script call - you can Google it or look it up in the pinned MV script call thread.
Okay, I successfully added a "heavy blow!" battle bessage in Yanfly's Damage Core by first copy damage step 2 to damage step 3 and then placing
interpreter.setWaitMode('heavy blow!');"
in damage step 2 and now it works as intended.
And to extend the duration of the battle messages I used the plugin from this topic https://forums.rpgmakerweb.com/index.php?threads/battle-log-speed.52741/ since the "heavy blow!" message would only stay for about 30 frames onscreen.

So, my problem is practically solved. Thanks again for the help and suggestions.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-plugin-library-how-to-show-a-message-window-when-landing-a-critical-hit-hitting-an-elemental-weakness-etc-solved.154567/