# Trouble with healing formula

Status
Not open for further replies.

#### Sword_of_Dusk

My problem is a simple one. I want my healing spell to work within a certain range. To be specific, I want it to heal between 35-45 HP a cast. I currently have the formula set as the following:

Math.randomInt(45)+35

This is not working as intended, however. I've seen healing numbers go beyond my desired limit of 45. Does anyone know where I've gone wrong?

#### Shaz

##### Veteran
Well, you're saying take a random number between 0 and 45, and add 35 to it. So if the random number happens to be 40, you're going to get 75.

Math.randomInt(11) will give you a number between 0 and 10,
so Math.randomInt(11) + 35 will give you a number between 35 (35 + 0) and 45 (35 + 10)

However ... can't you just set the damage to 40, with a variance of 5?

#### TheoAllen

##### Self-proclaimed jack of all trades
Use shaz's solution above then set variance to 0

#### Sword_of_Dusk

Shaz, your formula worked. Had a feeling I was ignoring something obvious.

And yeah, I probably could've just relied on the variance, but I wanted to make absolutely sure. Anyway, can an admin close this thread when they get the chance?

#### Sword_of_Dusk

So that's how you do it. Thanks again, Shaz.

#### slimmmeiske2

##### Little Red Riding Hood

Status
Not open for further replies.

### Latest Profile Posts

I'm a bit conflicted. One the one hand, it's quite visually cool to make bodies of water that the player can interact with by going into it. However obscuring the player character from a gameplay perspective is pretty bad. Hmm... There's the option to make the area around the player visible, but then that kind of defeats the purpose of submerging them.
Stream will be live shortly with some Darkest Dungeon! Feel free to drop by!
Another two plugins done! One being an on map grid inventory.
busy with my newborn child, can't even touch pc at all
Make a Game in RPG Maker MZ: Episode 6 Starts NOW! Let's map some caves!