MV I need help with a plugin to check if a counter is successfully occurred

Hi, I use Yanfly's plugin packs (including YEP_X_CounterControl). I just want to check if my actor has successfully performed a counter-attack, just like we check a successfully "evade" and "miss" via "result().evaded" or "result().missed". I tried this with ChatGPT but it did not work the way I wanted.

Could anyone help me with this?
I tried this with ChatGPT but it did not work the way I wanted
naturally

I just want to check if my actor has successfully performed a counter-attack, just like we check a successfully "evade" and "miss" via "result().evaded" or "result().missed"
the plugin adds an isCounter() method for Game_Actions to tell if it is a counter or not, but what exactly youre going to do depends on where and how youre checking for the counter.

if it were in an <custom react effect> it would be this.isCounter(), but in a <custom action end effect> youd use user.currentAction().isCounter()
naturally


the plugin adds an isCounter() method for Game_Actions to tell if it is a counter or not, but what exactly youre going to do depends on where and how youre checking for the counter.

if it were in an <custom react effect> it would be this.isCounter(), but in a <custom action end effect> youd use user.currentAction().isCounter()
Thanks. Is this able to be used in Respond/Establish effect? I mean React/Confirm happens before the damage is applied to the target, so it may not quite be accurate to my purpose. I need to check it during Respond/Establish, which happens after damage is applied.
what i mentioned are examples, but so long as the skill causing the effect to activate is triggered as a counter attack it should be fine
Thanks a lot. I will try the way you suggest to see.

what i mentioned are examples, but so long as the skill causing the effect to activate is triggered as a counter attack it should be fine

I tried the isCounter(), but it does not seem to work. My actor counters the attack, but nothing happens at all
what is the full note tag you tried and what did you want to happen?
Here I just basically uses isCounter()

JavaScript:
<Custom Deselect Effect>
if (this.isCounter()){
target.addState(224);}
</Custom Deselect Effect>

Just wanna add state 224 when my actor successfully perform a counter-attack. But after triggering the counter-attack, nothing happens.
What you have works. i didnt see anything wrong with it and tried it myself to be sure.

and you are sure that have the this on the correct battler and are using the right notetag?
deselect effects activate when the battler is targeted. this state is on an a battler and youre expecting that when this battler hits an opponent and gets counterattacked, the battler with the state gains state 224, right?
What you have works. i didnt see anything wrong with it and tried it myself to be sure.

and you are sure that have the this on the correct battler and are using the right notetag?
deselect effects activate when the battler is targeted. this state is on an a battler and youre expecting that when this battler hits an opponent and gets counterattacked, the battler with the state gains state 224, right?
True. Regardless of a hit or a miss from the opponent, the state is added to my actor just when a successful counter-attack happens. I have been working with this Buffs&States Core for several years, so I'm sure I did not miss anything.
so you have the state working now? is it working in some way that is not intended? its not clear to me what the goal is. if the actor is supposed to have the state with the above notetag in it and also gain the state added by counterattacking, then you want a confirm effect or any other effects that runs as the battler acts
Regardless of a hit or a miss from the opponent, the state is added to my actor just when a successful counter-attack happens
because youre using a deselect effect. if you need the skill to have also hit the target, using either a react or a respond effect would automatically make that a requirement as they only run when the skill hit. otherwise, you'd have top check the target's result and see if it hit
I use Deselect Effect because my actor can counter even on a missed attack, so Deselect will ignore if it hits or misses. So in general, my purpose should be:
- Opponent attacks my actor
- My actor counter the opponent's attacks
=> At this time, trigger the condition check if the counter-attack is triggered. If it is true, then add the state to the actor.
I use Deselect Effect because my actor can counter even on a missed attack, so Deselect will ignore if it hits or misses. So in general, my purpose should be:
- Opponent attacks my actor
- My actor counter the opponent's attacks
=> At this time, trigger the condition check if the counter-attack is triggered. If it is true, then add the state to the actor.
This doesn't make sense to me reading through it, compared to the notetags you're trying to use.

If this is supposed to happen when the actor who has the state counters an attack, you would not be using Deselect Effect and checking for this.isCounter() because they are not the target of that counter attack.

That notetag and code will only check things on the initial attack they received which triggered the counter (you also appear to be mixing up user and target).
I use Deselect Effect because my actor can counter even on a missed attack, so Deselect will ignore if it hits or misses. So in general, my purpose should be:
im unsure what you mean by this. the deselect effect has nothing to do with your actor doing a counterattack. by this description:
- Opponent attacks my actor
- My actor counter the opponent's attacks
=> At this time, trigger the condition check if the counter-attack is triggered. If it is true, then add the state to the actor.
youd
want a confirm effect or any other effect that runs as the battler acts
Deselect effects are triggered when the battler is targeted for a skill. unless you want the state to be a response to being countered by the enemy, it wouldnt do anything at all to the actor. if you want something to happen when the actor does a counter, you want one of the attacker notetags, not a defender one
So you mean I should put that note tag to the enemy attacking my actor? Is there a way to give the note tags to the defender (my actor)? Because I have an item that boosts 50 ATK when successfully countering an attack.
So you mean I should put that note tag to the enemy attacking my actor?
We didnt suggest that

then you want a confirm effect or any other effect that runs as the battler acts
you would not be using Deselect Effect
If you want something to happen when the actor does a counter, you want one of the attacker notetags
Okay thanks guys. Let me try with the confirm effect.

Thanks guys! I made it work by following your suggestion!

Original thread: https://forums.rpgmakerweb.com/threads/i-need-help-with-a-plugin-to-check-if-a-counter-is-successfully-occurred.173275/