Actor's HP becomes NaN when using a heal spell

I have a particularly weird issue. Whenever I heal an actor, the actor's HP doesn't heal and their box becomes NaN (Not a Number), thus is unable to die, as seen here:

wat_by_wolfryhedgies-dcgee97.png


I've never seen this issue nor have I seen it it documented like this - only NaN with death. And while I have some yanfly plugins equipped I don't have Auto-Passive States as of now. The state I have on it is also empty.

Spoiler: Here's the spell if anyone is wondering.
spell_by_wolfryhedgies-dcgee8o.png

I've never seen anyone run the same thing, just a similar issue. Is there a fix for this?
I might've actually figured it out, I used the wrong variable... 😅
Edit: Gonna see if it's not just a figure of my imagination. If it's the fix i'm closing it.

Edit 2: Somehow it still persists even after fixing the formula, so the problem is still a thing. Uh...
What is the formula for your heal spell? NaN (Not A Number) means you tried to either a) divide by 0, or b) do math on something that isn't a number- text, undefined values, whole objects, or something else that became NaN. So if any value in the healing process is invalid, the final heal result becomes NaN, which is added to the player health, in turn making that NaN.
What is the formula for your heal spell? NaN (Not A Number) means you tried to either a) divide by 0, or b) do math on something that isn't a number- text, undefined values, whole objects, or something else that became NaN. So if any value in the healing process is invalid, the final heal result becomes NaN, which is added to the player health, in turn making that NaN.

a.mgi + a.atk * 2 + 20

I probably keep messing up the formula, because I forget things and through looking at other heal spells it's a.mat instead of a.mgi, which I have replaced Magic Attack with Magic in the system.
Okay, it IS that I ultimately forgot that magic is put as "mat". I'll be closing the thread due to solving the problem now.

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/actors-hp-becomes-nan-when-using-a-heal-spell.97310/