[YEP Enemy Levels] Make an enemy gain a level when killing

Hi

I'm using YEP Enemy Levels, and I hava a question.

I want an enemy gain one level each time it defeats an ally. I kinda know how to do this, I want to check if any battler affected by death state is an ally, and if the source of the fatal damage is an enemy, and if it's still alive.

But where I'm stuck is that I don't know how to store the source of a fatal blow in a variable.

I tried to uses States & Buff Core and make a "Custom Apply Effect" notetag, but it seems like when the Death state is set because of a normal attack, the "user" becomes undefined, and I get a console error.

Do you have any tips on how to make it possible ?
Try putting this in a passive state for your enemies.

Code:
<Custom Conclude Effect>
if(target.hp <= 0 && target.isActor()){
user.gainLevel(1);
}
</Custom Conclude Effect>
It works fine, thanks ! I could even add an animation for the level up ! ^^


Solved !

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/yep-enemy-levels-make-an-enemy-gain-a-level-when-killing.121289/