RPG Maker MV 50% Heal

Status
Not open for further replies.

ProjectMarakar

Villager
Member
Joined
Jul 16, 2012
Messages
14
Reaction score
1
First Language
English
Primarily Uses
Okay so i'm trying to create an event wherein the player can heal up to 50% of there Max HP. The catch? It can only heal you up to 50% Max HP which means if you try to use it while at 50% or higher it will have no effect. Side notes: There are only two party members and there is no actual RPG battles in game. Anyone know how to accomplish this? 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
This is not a game mechanic discussion - it is a "how do I ..." question, and belongs in MV Support.  Or more specifically, the damage formula thread.


Are you saying, if the player has 25%, they will get another 50% bringing them up to 75%?  Or that they will only get 25% which will bring them to 50% and no higher?


I'm going to assume you'll give them 50% even if it puts them higher than 50% at the end.  Something like this in your damage formula would do that:


b.hpRate() < 0.5 ? Math.floor(b.mhp * 0.5) : 0


and make sure there's no variance.


This will work if they have up to 50% of mhp but not exactly 50%.  If you want them to gain HP if they already have exactly 50%, change the < to <=


If you're doing this through eventing and not through a skill or item, do this instead:

Code:
Control Variables [1: Actor HP] = Game Data > Actor (choose actor) > HP
Control Variables [2: Actor MHP] = Game Data > Actor (choose actor) > MHP (in parameters)
Control Variables [2: Actor MHP] /= 2
Conditional Branch: Variable [1: Actor HP] < Variable [2: Actor MHP]
  Change Actor HP: (choose actor), Variable [2: Actor MHP]
End
This gets the actor's HP and MHP into variables, calculates 50% of MHP, and if the actor currently has less than that 50%, it increases their HP by that much.  Again, use <= if you want to give them HP if they have exactly 50%
 
Last edited by a moderator:

ProjectMarakar

Villager
Member
Joined
Jul 16, 2012
Messages
14
Reaction score
1
First Language
English
Primarily Uses
I'm sorry I posted this in the wrong place I'm kind of new to this but  what I mean to say is that, It will only be able to bring you to 50%. Let me explain better. In game the player can find these rest areas if this area has a "bed" there and they use it it will only bring your HP to 50% of Max HP, meaning if you have 300 HP overall and your current HP is say about 30 and you use this event it will bring you to 150 HP but if you try to use it again it will not take you beyond 150 HP. This way players can't spam it to regain 100%. Do you know how to do that?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Code:
Control Variables [1: HP to Give] = Game Data > Actor (choose actor) > Max HP (in parameters)
Control Variables [1: HP to Give] /= 2
Control Variables [1: HP to Give] -= Game Data > Actor (choose actor) > HP
Conditional Branch: Variable [1: HP to Give] > 0
  Change Actor HP: (choose actor), Variable [1: HP to Give]
End
So this is now working out what 50% of the actor's maximum HP is, and the difference between that and their current HP.  If that ends up being < 0, it means they have more than 50% already.  If it's > 0, it means they have less than 50%, and the variable will currently hold what they would need to top them up to 50%.
 

ProjectMarakar

Villager
Member
Joined
Jul 16, 2012
Messages
14
Reaction score
1
First Language
English
Primarily Uses
2017-01-06.pngThis sort of works but whenever I use the event the player Heals every time. My character in this case is called Penelope she has a max HP of 300 I let her take damage until she has only 100 HP left but when I try she heals for 100 HP every time I use the bed. Do I have it set up right?
 

ProjectMarakar

Villager
Member
Joined
Jul 16, 2012
Messages
14
Reaction score
1
First Language
English
Primarily Uses
It works! Thank you so much friend! I'll make sure to post accordingly as well!
 
Last edited by a moderator:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
ProjectMarakar, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


Next time please just edit the previous post if less than 72 hours have passed.


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

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,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top