Health Potion Formulas?

I've look around, but I can't find an answer to this problem.

I'm trying to create a health potion that heals the player using the formula:

(150 * ((a.def + 150)/100.0)).to_i

I made a potion item like this:

Item Type: Normal

Consume: Yes

Scope: The User

Occasion: Always

Damage Type: HP Recover

Element: None

Formula: (150 * ((a.def + 150)/100.0)).to_i

Variance: 0

Critical: No

However, whenever my character drinks it, it doesn't restore any health.

Does anyone know what I'm doing wrong? Does HP Recover not actually do anything? Or do I need to make a State?

I'm hoping I don't need to make a state, because then I'd need to have a unique state for each potion (this potion is 150, but a better potion might be 250).
You're using a instead of b.


When you use an item and select who to use it on, that person is the target, not the user, so b.


Also,

(150 * (val/100.0)).to_iYou don't need the inner brackets if you move the values around.
150 * x / 100 is the same as 150 / 100 * x


so you could just write it as

Code:
(1.5 * val).to_i
so in your example:
Code:
(1.5 * (b.def + 150)).to_i
I tried changing the formula to that, but it still didn't work. But since both the target and the user are the same, it shouldn't matter whether I use a or b.
The formula you have in the OP works perfectly fine for me in a test battle. Is it when used in the menu that causes problems?

Are you using any scripts?
It... might be script I use. I'll check as soon as I can. I use Yanfly's Lunatic Damage, so I might need to put the formula in that instead of the usual formula box.
I tried putting the formula in Yanfly's Lunatic Damage, but it still won't work.

Edit:  But it must still be a script issue, because it works in a fresh game project...
You will have to track down which script is the problem.

Disable all scripts (Ctrl+A to select all, then Ctrl+Q to comment them out) and then re-enable them one by one (same Ctrl+ A, then Ctrl+Q) until you find the one which stops the formula working.  No short way round this, I'm afraid.
The problem script is Yanfly's  Lunatic Damage. I just don't know how to make the formula work with it.

I also don't know where to post to get help with that script. I'll look for the script support section, if there is one.
I'll move this to the Script Support section for you.
Oh, thank you 🙂

A little bit ago, I made a post about this in the Script Support section. Should I get rid of the other post I made?

Original thread: https://forums.rpgmakerweb.com/threads/health-potion-formulas.50165/