Hey everyone! I had an idea for a skill called "ReHeal". What it does is, when the character with the skill is healed, he stores a portion of that healing he got in a "Stored Healing" variable. When this skill is used, he uses all of the healing he stored up to heal himself or someone else. The amount of stored healing is then reset to 0. The value is also reset when the battle ends. I'm not sure how to accurately (or at least) get ahold of the amount of healing he gets and store it in a variable properly. I'm also not sure how to reset the variable after the skill gets used. If anyone is able to help, that would be greatly appreciated!
[MV]Storing Healing Received in a Variable
RPG Maker MV SupportI would use Yanfly's Auto Passive States and Buffs and States Core.
Your ReHeal skill would have a Passive State notetag on it, so learning it will give the character that state.
In the passive state, you give it the Buffs and States Core notetag:
That will store all healing received into a variable on the actor and make it start each battle at 0.
Then, you'd just make the ReHeal skill itself have HP Recovery damage and put in the formula:
that will make the skill heal for however much the actor has stored, then reset the variable.
If you want to get extra fancy, you can use a notetag on the skill from Yanfly's Skill Core:
That will make the skill greyed out and unable to be used unless the actor has actually stored up some healing.
Your ReHeal skill would have a Passive State notetag on it, so learning it will give the character that state.
In the passive state, you give it the Buffs and States Core notetag:
Code:
<Custom Battle Effect>
user.healStorage=0;
</Custom Battle Effect>
<Custom Respond Effect>
if (this.isHpRecover())
target.healStorage+=value;
</Custom Respond Effect>
That will store all healing received into a variable on the actor and make it start each battle at 0.
Then, you'd just make the ReHeal skill itself have HP Recovery damage and put in the formula:
Code:
let healing=a.healStorage; a.healStorage=0; healing
If you want to get extra fancy, you can use a notetag on the skill from Yanfly's Skill Core:
Code:
<Custom Requirement>
value=!!user.healStorage;
</Custom Requirement>
That will make the skill greyed out and unable to be used unless the actor has actually stored up some healing.
Thanks for the reply! The skill is grayed out until he's healed (which is a touch I really like so thank you lol), but when he actually gets to use it nothing happens. Did I miss something maybe?
Huh, that's weird. If the custom requirement works (it's greyed out until healed), that means all of the state tags are working correctly.
Hm...I wonder if the Yanfly stuff does healing as a negative value?
Try this. Change your damage formula to this:
Then, in battle, press F12 and go to the Console tab. Look at what numbers get printed there.
If it's saying healing is a negative number, you're going to go to your Custom Respond Effect and change it to say -= value instead of += value.
Hm...I wonder if the Yanfly stuff does healing as a negative value?
Try this. Change your damage formula to this:
Code:
let healing=a.healStorage; a.healStorage=0; console.log("healing is ", healing); healing
Then, in battle, press F12 and go to the Console tab. Look at what numbers get printed there.
If it's saying healing is a negative number, you're going to go to your Custom Respond Effect and change it to say -= value instead of += value.
Looks like changing the Custom Respond Effect did the trick! His heal works now! Thank you for all the help!
Original thread: https://forums.rpgmakerweb.com/threads/mv-storing-healing-received-in-a-variable.159267/