Reduce experience from spell.

Hi. Got a question but can't find anything similar, so... (if I missed something, please let me know).

I've got a spell that will kill its user, but does fairly stupid damage. The thing is, I don't want it usable free of charge, so to speak. I set up a separate state for the death caused by this spell - half the job done - now I'm trying to create a rez spell specifically for this state. The basic component (the rez) was easy to do, but I'm trying to find a way to reduce the recipient's EXP by 10% or so.

Can anyone make any suggestions on how best to do this?

Btw, I use some of Yanfly's plugins, so if it can be done with one of those, I'd appreciate it (assuming there isn't a way to do it
in RMMV).

Thanks,
You should be able to do this using Yanfly's Buffs & States Core plugin, e.g. with a <Custom Remove Effect> notetag on your special death state:
Code:
<Custom Remove Effect>
if (user.isActor()) {
  user.gainExp(-user.currentExp() / 10);
}
</Custom Remove Effect>
This says: "when this state is removed, if the battler is an actor, reduce their exp by 1/10 of their current exp". ^_^

Alternatively I think this code should work in various other types of notetag from Yanfly's plugins, e.g. <After Eval> from Skill Core. Haven't tested that, though. 😅
Thank you so much for this, especially the explanation.

It works perfectly. Now I just need to decide if 10% is too generous...

Keep it easy.

Original thread: https://forums.rpgmakerweb.com/threads/reduce-experience-from-spell.97148/