# Percentage Healing while sleeping

Status
Not open for further replies.

#### SC Fúria

##### Villager
Hi guys!

Recently I've been wondering about the possibility of making a percentage healing whenever the player goes to sleep in an inn, bed... Basically, what i want is to heal the 100% of the maximum hp if the game difficulty is set to easy, heal a 75% of mhp if it's intermediate and heal a 50% if it's hard. I've been trying different ways but i'm short in ideas  Does someone know how could it be done?

SC Fúria

#### Ossra

##### Formerly Exhydra
You could try something like this in the event :

Code:
``````◆Comment：// Easy Mode; Full Heal
◆If：gameDifficulty = 0
◆Script：\$gameParty.members().forEach(function(member){
：      ：  member.hp = member.mhp;
：      ：};
◆
：End
◆Comment：// Intermediate Mode; 75% Heal
◆If：gameDifficulty = 1
◆Script：\$gameParty.members().forEach(function(member){
：      ：  if (member.hp < (member.mhp * 0.75)) {
：      ：    member.hp = member.mhp * 0.75;
：      ：  }
：      ：};
◆
：End
◆Comment：// Hard Mode; 50% Heal
◆If：gameDifficulty = 2
◆Script：\$gameParty.members().forEach(function(member){
：      ：  if (member.hp < (member.mhp * 0.50)) {
：      ：    member.hp = member.mhp * 0.50;
：      ：  }
：      ：};
◆
：End``````

Last edited by a moderator:

#### Wavelength

##### MSD Strong
Run through each member of the party and do the following for them:

1. Store their HP in a variable (V1)
2. Do a Recover All on the party member (so they get rid of states, knockout, etc.)
3. Store their Max HP in another variable (V2), and multiply it by either 1.00, 0.75, or 0.50, depending on current difficulty
4. Store their Max HP in yet another variable (V3)
5. Compare V1 and V2.  If V1 is higher, subtract V1's value from V3.  Otherwise, subtract V2's value from V3.
6. Reduce the party member's HP by the new, lower value of V3.

#### Allinardo

##### Dungeon Crawler
Well is it just one actor you want to have heal while sleeping in an inn, or the entire party? Or is your party just one actor?
If it's either of the former, then go with what @Wavelength said.
But if it's the last one, then a simple script call should do. I believe it's...

var player = \$gameActors.actor(1);

player.gainHp(0.25*(player.mhp));

Just replace the '0.25' with '0.50' or '0.75' depending on what percent you want.

HOWEVER keep in mind you will get partial hit points through this method, so while it's simpler than the method mentioned above, use at your own risk. Same with ExHydra's I believe.

Last edited by a moderator:

#### SC Fúria

##### Villager
In the end I've solved it with variables, as Wavelength said. Thanks everyone! ^^

#### Hunters12

##### Villager
Run through each member of the party and do the following for them:

1. Store their HP in a variable (V1)

2. Do a Recover All on the party member (so they get rid of states, knockout, etc.)

3. Store their Max HP in another variable (V2), and multiply it by either 1.00, 0.75, or 0.50, depending on current difficulty

4. Store their Max HP in yet another variable (V3)

5. Compare V1 and V2. If V1 is higher, subtract V1's value from V3. Otherwise, subtract V2's value from V3.

6. Reduce the party member's HP by the new, lower value of V3.

How to put 1.00, 0.75, or 0.50 on variable control ? i cant put , or .

#### Attachments

• Screenshot_1.png
31.1 KB · Views: 8

#### Wavelength

##### MSD Strong

@Hunters12 , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

Closing this thread to prevent confusion.

But to answer your question real quick, what you can do is to multiply by 25, then divide by 100 in the next line. That's the same as multiplying by 0.25

Status
Not open for further replies.

### Latest Profile Posts

Marketing seems to be about reducing dependence on luck to sell a product, as well as expanding the number of avenues in which luck can play a role in selling a product.
So, I've been wanting to do this randomized logic puzzle in my game for years now. I finally figured out how to do it by using arrays and a few small script calls. It's based on the Einstein Fish Puzzle! Though, I have no idea how to actually have the player put in answers.... might start a thread about it.

The projectiles shown in this video are as follows:
1, Basic Triple
2, 30-Degree Arc
3, Randomized Blast Wave
4, 8-way
5, 8-way Double
6, 8-way Slowness
7, 120-Degree Arc Repetitive
8, Projective Triple
9, Split 8-way
10, 2-way Split Randomized Arc
11, HP-MP Split Arc
12, Split Laser
13, Shock
14, Cosine
Drop shadows and water reflections tests in RPG Maker VX Ace

I'm doing a fairy tale project Little Red Riding Hood and the Woodsman. I'm almost done with the demo in my native language and I intend to make a demo version in English as well. I'm just going to use the translator because I don't know the pronunciations very well, I only know how to say "Hey" and nothing else..