Health Potion Formulas?

blackmdawn

Villager
Member
Joined
Oct 28, 2015
Messages
16
Reaction score
0
First Language
English
Primarily Uses
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).
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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
 
Last edited by a moderator:

blackmdawn

Villager
Member
Joined
Oct 28, 2015
Messages
16
Reaction score
0
First Language
English
Primarily Uses
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.
 
Joined
Jul 17, 2015
Messages
586
Reaction score
316
First Language
English
Primarily Uses
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?
 

blackmdawn

Villager
Member
Joined
Oct 28, 2015
Messages
16
Reaction score
0
First Language
English
Primarily Uses
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.
 

blackmdawn

Villager
Member
Joined
Oct 28, 2015
Messages
16
Reaction score
0
First Language
English
Primarily Uses
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...
 
Last edited by a moderator:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
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.
 

blackmdawn

Villager
Member
Joined
Oct 28, 2015
Messages
16
Reaction score
0
First Language
English
Primarily Uses
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.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I'll move this to the Script Support section for you.
 

blackmdawn

Villager
Member
Joined
Oct 28, 2015
Messages
16
Reaction score
0
First Language
English
Primarily Uses
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?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,047
Members
137,569
Latest member
Shtelsky
Top