MV Reflection/Counter Popups

Heyho!
I am using SRD Battle Popup Customizer and I'd like to add Custom Popups, that appear if a magic attack is reflected/ a physical attack is countered. I can't figure out how to set the condition, though. Here is a screenshot of how the plugin parameters of a correct Custom Popup should look like:

ScreenShot_BattlePopUp.png


I wasn't able to find the code for reflection / counter yet.
I'm not sure you'll be able to achieve this. It looks like the plugin you're using colors the pop ups based on conditions it can check during the code that deals damage.

At that point, there is nothing in the code that distinguishes whether the damage is coming from reflection or countering. The engine executes those as a regular skill performed by the target out of combat order, so there's no way for you to ask "did this damage come from a counter?"

If you use Yanfly's Counter Control, it introduces some way that it internally tracks how many counterattacks have gone back and forth, so you should be able to check for that variable to be greater than 0. I don't have any thoughts regarding reflection.
I'm using Counter Control actually and I think it treats Reflection the same as Counter Attacks, does it? Maybe it's possible do have the same notification for both of them, then? I don't understand enough of js to figure out how to tackle this, though.

I just want some visual information besides the battle log to tell players what's going on, when an animation plays first on an enemy and then immediately on their characters.
No, Counter Control doesn't interact with reflect at all.

From a quick poke at Counter Control, I think you could use the condition
Code:
BattleManager._counterSequence>0
to color the pop up on a counter attack.

You would have to write a plugin that adds a game variable to track when reflection is being activated, so you could reference that in the popup manager.
Worked! Thank you!

What I meant was that Counter Control lets you set Magic Hit as a condition for a counter attack, so it can be used for both, physical and magical hits. If I don't miss anything here, I won't even need reflection as a parameter, since by default it works just the same as counter, only for magical hits. Using Yanflys & SRDs Plugins with the code you provided I should be able to set up magical & physical counters and just need to name the popup in way that covers both.

Anyway, I have lost count on how many times your posts helped me out already! Thank you once again 😀

Original thread: https://forums.rpgmakerweb.com/threads/reflection-counter-popups.136684/