How do I make a basic stun mechanic?

I have a basic mechanic I want to try making, where the boss charges up something powerful, then you hit them with an ability that stuns, it interrupts their charging and then they skip said ability and move on to the next phase. But if you don't stun them in time, the boss uses the ability and oneshots you. I like using Yanfly ATB, so I'm thinking I'll need to use Yanfly's Battle AI Core to do this, and make the stun ability an ATB interrupt but also apply a stun state, that if the state is active it turns a switch on, and if the switch is on then the boss doesn't use the ability.

Is there a more obvious way that I'm not aware of?
Just add a state that adds stun. As long as stun has something in it that says cannot move, the enemy will not get that turn, and will skip the turn in the attack pattern.

Now, since you are on an ATB system you'll have to set it up so that the stun lasts long enough, which may require some playing around.
Are you asking how to make an charge attack mechanic also?
It doesn't seem to skip the turn in the attack pattern, though. The enemy just goes back to repeat that turn as if it never happened.

Spoiler
Untitled.png

Untitled2.png

I have <ATB Interrupt> on the skill it self. Have I set up something incorrectly?

Are you asking how to make an charge attack mechanic also?

Hmm, I was just making a second skill called "Charging..." that I set the boss to do one turn before they used the actual ability, but I guess learning how to do it more properly would be very helpful. Especially since if I want you to stun the actual cast time, then this current method I'm using isn't very intuitive. So yes please, if you don't mind, I'd love to learn a better way.
Is Long Cast the skill you want to stop? If so what is happening is the engine still thinks it is on turn 0 when the bar fills, so it will do that skill.

ATB systems use a tick system to decide when a new turn has passed. You need to set up your system so the correct number of ticks = one turn, and make sure that enemy does not fill the bar before the turn passes. That's what I meant when I said you may need to play with the turn length.

I've moved this thread to Plug-In Support. Thank you.

Well the forum description was "How do I and How to", it seemed like this applied much more to the basic RMMV enemy turn conditions than specifically "ATB plugin support" so that's why I thought that was the correct forum. Are you saying if I don't use ATB then it will work the way I have it set up?
It should, as it works that way for me. So it does have to be a plug-in that is causing the issue. But to clarify is it Long Cast you want to interrupt? Also you may wish to post a screenshot of your stun skill as well.
Yes it is, I set Long Cast to have a -2000 speed in the database to make it take as long as possible to charge, and I'm sure I can use other ATB notetags to make it longer.

Spoiler
Untitled3.png

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-make-a-basic-stun-mechanic.102994/