One Time Counter State?

Hey guys,

Is there any way to have a state that increases the user's counter attack rate to 100%, then is removed after the user counterattacks?
easiest way i can think about doing it off the top of my head needs Yanfly's Counter plugin. it provides a function for game actions to identify if its skill a counterattack, so from there you could have some conditional using this.isCounter() with a Yanfly Buffs and States plugin tag to remove the state if the action's skill was a counter.
I'd rather avoid using paid plugins if I can help it, since I don't have a ton of money.
Yanfly's Buff and State Core should be enough, and it doesn't cost money.

if (this.isPhysical() && this.isHpEffect() && value > 0) {
user.removeState(x);
}
This will check if the attack is physical, and then remove the state the battler has for counterattacking. In the stat it self, you would include 100% counterattack.

If you don't want to use any plugins at all, the only way I can think of is just having the state being removed by taking damage, but that would remove it on magic attacks, skills that deal 0 damage, etc.
Yanfly's Buff and State Core should be enough, and it doesn't cost money.


This will check if the attack is physical, and then remove the state the battler has for counterattacking. In the stat it self, you would include 100% counterattack.

If you don't want to use any plugins at all, the only way I can think of is just having the state being removed by taking damage, but that would remove it on magic attacks, skills that deal 0 damage, etc.
Your suggestion worked! I actually tried this already, but I had it as a Custom Respond and React Effect and that didn't work. Now I see it needs to be a Custom Establish Effect, because that's when the user's actually landing the counterattack.

Thanks for your help!
but I had it as a Custom Respond and React Effect and that didn't work
did you change the battler for the tag when you had it as respond/react? if you kept it as user, it would have removed the state from the one performing the attack, not the one being hit with the state on.

Now I see it needs to be a Custom Establish Effect, because that's when the user's actually landing the counterattack.
I would have gone with the defender tags rather than the attacker ones. if its a 1 turn state it wouldnt matter, but if the state lasts longer than that,the battler makes a physical attack through their normal turn and they arent hit before then, that skill would remove the state without it being a counter.
did you change the battler for the tag when you had it as respond/react? if you kept it as user, it would have removed the state from the one performing the attack, not the one being hit with the state on.


I would have gone with the defender tags rather than the attacker ones. if its a 1 turn state it wouldnt matter, but if the state lasts longer than that,the battler makes a physical attack through their normal turn and they arent hit before then, that skill would remove the state without it being a counter.
I have a Custom Turn Start Effect that removes the state, so yeah, it probably wouldn't matter. I've tried Respond and React tags and changed the battler from user to target, and it didn't remove the effect. Here's the code I tried for reference:
<Custom React Effect> if (this.isPhysical() && this.isHpEffect() && value > 0) { target.removeState(stateId); //BattleManager._logWindow.push("clear"); } </Custom React Effect>

And here's the full version I had that worked:
<Custom Turn Start Effect> user.removeState(stateId); </Custom Turn Start Effect> <Custom Establish Effect> if (this.isPhysical() && this.isHpEffect() && value > 0) { target.removeState(stateId); } </Custom Establish Effect>
Here's the code I tried for reference:
it looked fine, but i copy pasted it into my game anyways to see. it works as it should.
was the skill the attacker used to trigger it physical? everything in the db does starts off as certain hit by default
it looked fine, but i copy pasted it into my game anyways to see. it works as it should.
was the skill the attacker used to trigger it physical? everything in the db does starts off as certain hit by default
Yep. The attackers were just using normal attacks.

Original thread: https://forums.rpgmakerweb.com/threads/one-time-counter-state.166349/