Status
Not open for further replies.

SC Fúria

Villager
Member
Joined
Feb 19, 2016
Messages
10
Reaction score
2
First Language
Spanish
Primarily Uses
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? 

Thanks for reading!

SC Fúria
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
870
First Language
English
Primarily Uses
RMMV
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
Global Mod
Joined
Jul 22, 2014
Messages
6,114
Reaction score
5,851
First Language
English
Primarily Uses
RMVXA
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
Veteran
Joined
Jan 2, 2013
Messages
63
Reaction score
24
First Language
English
Primarily Uses
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
Member
Joined
Feb 19, 2016
Messages
10
Reaction score
2
First Language
Spanish
Primarily Uses
In the end I've solved it with variables, as Wavelength said. Thanks everyone! ^^
 

Hunters12

Villager
Member
Joined
Jun 30, 2014
Messages
16
Reaction score
6
First Language
English
Primarily Uses
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
    Screenshot_1.png
    31.1 KB · Views: 7

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,114
Reaction score
5,851
First Language
English
Primarily Uses
RMVXA

@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 Threads

Latest Profile Posts

party time.png
If you've played Knight Shift Chapter 1 this image'll mean something to you. If not, that's also fine!
Here's a medical question for ya: Why do I start lightly coughing after I drink coffee?
Well, someone "reviewed" my game. Didn't credit me anywhere in the video and spent 2 minutes insulting it. Going to ignore that and move on.
To cut down on map lag, I've been researching how to implement a lighting layer as a single map overlay instead of a bunch of individual lights. Hopefully I'll have a screenshot soon!
Imagine having a game broken up into a whole bunch of chapters? Like Chapter 11 should be about the party members going bankrupt.

Forum statistics

Threads
117,265
Messages
1,105,960
Members
153,440
Latest member
VicArt
Top