# 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

The Sinners who Never Sinned Teaser for the DEMO!

Surgically removing people's faces and grafting them on to other people is kind of fun.

(editing character art busts for my game)
I think sleep is like a foreign language to me.
I really love it when major blocks preventing me from going all out in game design get shattered.

Like finally developing a fully functioning Technical Machine system where certain characters cannot learn certain moves.

You have no idea how much that helps me.
Streaming some game development! Feel free to drop by!