Looking to create a state that gives a character ATB refills and MPs on kill

Hey guys!

I'm looking to create a state that gives a bonus after a character kills an enemy. Specifically, I want to create a buff that completely refills the ATB bar of that character and grants that character 3 MPs.

I'm using quite a few of Yanfly's plugins, including the Battle Core, the Buffs States Core, the ATB system, etc.

Now I'm pretty sure we can create such a en effect using the Buffs States Core. Near the end of the plugin explanation, Yanfly has written the following instructions:

<Custom Establish Effect>
code
code
</Custom Establish Effect>
This effect will run when the battler connects a hit and after damage execution occurs. This effect will run after <Custom Respond Effect> has occurred and before everything else.

<Custom Conclude Effect>
code
code
</Custom Conclude Effect>

This is the final effect to be run after the battler selects a target and will occur after hit/miss/evade confirmation and damage execution.



However, I'm unfortunately unable to code in JS. Is there anyone who could tell me if the state I'm looking to create is indeed achievable this way? If so, would it be possible to help me figure out how to code the state?

And if Yanfly's plugin cannot create that state, does anyone know another way?

Thank you in advance! 🙂
@MaxLionheart

Hello,

Create a state and put this in the notetag:

Code:
<Custom Establish Effect>
if (!this._killProc && (target.isDead() || target.hp <= 0)) {
    this._killProc = true;
    user.gainMp(3);
}
</Custom Establish Effect>

I presently don't know the ATB functions. I would have to review the plugin to figure those out. I'll try to get to it later today. Are you using Yanfly's ATB system?

For a brief explanation, this code checks if a KO move has landed, and if so, it adds 3 MP to the user. The check for this._killProc is to prevent multihit moves from replenishing MP multiple times.
Hi again Boikish! Thank you again for your help!

It works perfectly! And I appreciate your explanation of how your code works. I think I understand a little bit the logic.

As for the ATB, yes, I'm using Yanfly's. I have no difficulty adjusting the timer gauge with a skill (I simply need to add a notetag <ATB Gauge: +33%> for example), but I have no idea how to code it in JS, which is required with what I want to achieve.

Thanks again 🙂

Original thread: https://forums.rpgmakerweb.com/threads/looking-to-create-a-state-that-gives-a-character-atb-refills-and-mps-on-kill.120917/