MP gain on kills?

Hello everyone,

I've been trying to mess around with a game mechanic where a character can recover MP whenever they kill an enemy.

I've tried using shared battle events for it, but I failed miserably. My issue stems from not being able to create an event that changes depending on who's killing the foe. Keep in mind that I don't mean a mechanic like life steal, I mean a static % gain when you kill a foe with any skill or attack.

Is it even possible to create a plugin for this? I'm not sure how RPG Maker MV deals with on-kill effects. I've looked at Yanfly's Death Nova plugin but that's not exactly what I want.

My ideal plugin would work like this:

<MP gain on kill: X%>

A note tag on a state/item/actor.


Does anybody know of a plugin that could work like this? I own the Yanfly collection so maybe I'm sitting on the solution already.
Doesn't it work with just Yanfly Buffs & States notetag?

<Custom Establish Effect>
if (target.isDead())
user.gainMp(user.mmp*0.1);
</Custom Establish Effect>

If you want it on an actor or equipment, you can put a passive state on it.
I just tested it with a passive state, my MP was at 40/100 when I killed a foe and it didn't increase. Perhaps because that kill ended the battle? I'm not sure what the issue could be.
Change the target.isDead() check to target.hp <= 0
<Custom Establish Effect>

if (target.hp <= 0())

user.gainMp(user.mmp*0.1);

</Custom Establish Effect>


I tried this, and it didn't work. Perhaps I skipped a character somewhere?

Oh, I forgot to mention that I'm using BattleSysSTB. Might that be what's causing this issue?
I tried this, and it didn't work. Perhaps I skipped a character somewhere?
if (target.hp <= 0())
youve added some. the line should be:
Code:
if (target.hp <= 0)

also thing to note is that this'll go off any time the user hits a target and they end up with with 0 hp. if your game has multi hitting skills or regularly features enemies that resist KO, the player would get multiple activations from them. otherwise it should work fine.

Oh, I forgot to mention that I'm using BattleSysSTB. Might that be what's causing this issue?
partially, but just for the first one. having that means you have yanfly's battle core engine installed, and that one is the one that makes it so that by default battlers dont die immediately after fatal damage is taken.
Yeah, that was it! It works now, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/mp-gain-on-kills.181562/