How to make a player or enemy drain an attack

Hey guys, another question for today. How do i make an enemy drain an attack? Or maybe the player. So i want the player to drain an element (ex: Fire, Ice, etc.), so how do i do this?   🙂
Do you mean something like this:

*Alice casts Fireball on the Flame Pyxie!

*the Flame Pyxie recovers HP!

If so, Yanfly has an easy Element Absorb script.

https://yanflychannel.wordpress.com/rmvxa/battle-scripts/element-absorb/
What do you mean by "drain an attack?"  Do you mean that if, for example, an enemy were to attack you with a fire element skill it would heal you?  Or do you mean that the elemental part of the attack would be nullified?  If something is being drained, does this mean that it is being absorbed by someone?  Your phrase is too vague.  Can you specify exactly what you want to happen?

Ninja'd, sort of, but not totally.
@captainproton: Yes, but likely..

@ksjp17: Yes, i mean by draining an attack. an enemy were to attack you with a fire element skill it would heal you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-player-or-enemy-drain-an-attack.38016/