Scripts aren't doing their job at healing?

Okay, what am I doing wrong with my variables?

Spoiler
wk0ppt.jpg



2mm8zzc.jpg

Those variables are supposed to allow very weak healing, but nothing happens when I test it. My HP doesn't change at all.
Are you watching the correct actor?


Those commands should always heal the actor with the ID #1, no matter if that actor is in the party (or at which position in the party it is), and no matter which actor is targeted by the item/skill that calls the common event.
Yes. I only have one character in my party during my test. I purposely make him lose HP, get the healing item to get it back, and nothing happens when I use it.

Spoiler
2ze0bgo.jpg



The three items I added for demonstration purposes. Weak Potion is the one that heals very little HP (2-5), Moldy Bread is the one that you risk getting the Food Poisoning state but also be healed a small amount (originally it was either/or but I'm planning on changing that), Foul Brew either inflicts a Fever/Headache/Sore Throat/Listless state on the user or blows them up for 20 damage (OR thanks to Yanfly's new plugins, the foe, making this actually a blessing in disguise if you use it on them instead).


i5rrtf.jpg



I use Weak Potion. It does nothing. Wonderful.


2iapmxf.jpg



I use Moldy Bread. I get no healing at all and get the state instead. I tried testing this earlier, and I either got the state or no healing at all.


2ir8z04.jpg



I use Foul Brew. I get one of the states I added just fine.


Here's the Common Event for that btw:


zxp4sp.jpg
What is the actor ID of that actor? can you show us its database page?
Here you are!


1263804.jpg
Your conditional statements are embedded, meaning only if "Weak Healing = 3" will any of those events possibly execute, but due to them being equivalent, none of them will ever fire off, only the gainHp 2 event will execute. Try formatting your event like the following instead, using your variables of course:


oPzqn.png



It should also be noted, that you do not need to do it as a script event, there is a Change HP Event under the first tab of the event command selection that can get this job done, or rather should be able to get the job done if you don't plan on using formulas in the code to change the HP.
Hey, that worked! Thanks, Liquidize!


Although this makes me wonder why my Bad Potion CE works just fine, despite it being embedded too?
I think a more elegant way to do is to put this in the damage calculation of your healing potion/skill:


Math.ceil(Math.random()*5)


This will make the potion heal 1-5 HP, with each value having the same odds.
Oh, that could work too!
Bad food works because the default value of variables is 0.

Original thread: https://forums.rpgmakerweb.com/threads/scripts-arent-doing-their-job-at-healing.61774/