Recover HP When Equipping Certain Equips

Hey everyone, I wold like a plugin that will recover a certain amount an health when certain equipment is put on. For Example: 


Actor1 has 34/62 HP. When he puts on the magic robes his Max HP goes up by 6 and he recovers 6 HP, so now his health is 40/68. When he removes the armour it goes back to 34/62. 


Is there a plugin that covers this?
Here you go!


http://pastebin.com/fvugfX4F


(It works with both HP and MP!)


Just note that it may have compatibility issues with any plugin that deals with the equip menu.


Let me know if you have any issues and I'll look into it.
Here you go!


http://pastebin.com/fvugfX4F


(It works with both HP and MP!)


Just note that it may have compatibility issues with any plugin that deals with the equip menu.


Let me know if you have any issues and I'll look into it.



It works! And it seems to be playing nicely with my other plugins. The only thing is that with Yanfly's Item Upgrade plugin when you attach a mod to an already equipped weapon or armor that increases health, the plugin doesn't adjust the hp difference. I would appreciate it if you could make it compatible with yanfly's plugin. 
It works! And it seems to be playing nicely with my other plugins. The only thing is that with Yanfly's Item Upgrade plugin when you attach a mod to an already equipped weapon or armor that increases health, the plugin doesn't adjust the hp difference. I would appreciate it if you could make it compatible with yanfly's plugin. 

Ok.  I think I got it working for ya!


First, I had to update my plugin, so redownload that.


As for the rest, you just have to use the Eval notetags including the function I added.


for example, Let's say you have an item that increases HP by 10.


You'd make the following notes in the item's notebox:


<Upgrade Effect>


Eval: num = 10


Eval: item.params[0]+= num;


Eval: if ($gameParty.checkItemIsEquippedId(item) > 0) $gameActors.actor($gameParty.checkItemIsEquippedId(item))._hp += num;


</Upgrade Effect>


This will increase the item stat (HP), then increase the specific actor's HP who is equipped with the item!


Give it a try and let me know if you have any further issues.


Just remember that you MUST be using YF Itemcore plugin and have Instance Items turned on for this to work right.


(I'll be using this add-on myself!  Thanks for the suggestion!)
Spoiler
d96.jpg





Perfecto. My sir and/or madam you are an annoying peeve saver. if there is anything writing, eventing, or database related that I can help with, do not hesitate to ask.


Edit: I think I came across something. I changed the hp to mp in the third eval line, but the item only increases HP.
Spoiler
d96.jpg





Perfecto. My sir and/or madam you are an annoying peeve saver. if there is anything writing, eventing, or database related that I can help with, do not hesitate to ask.


Edit: I think I came across something. I changed the hp to mp in the third eval line, but the item only increases HP.

To switch to mp, you also have to change the second Eval line to params[1].
To switch to mp, you also have to change the second Eval line to params[1].

Duh. I should have seen that. That's what I get for reading code at 3 in the morning. Is there any special way that I should credit you in my game?
Duh. I should have seen that. That's what I get for reading code at 3 in the morning. Is there any special way that I should credit you in my game?

Just a "Special Thanks to Maliki79" would be fine.  And a promise you'll let me know when you release it!


Glad to have helped and Good luck!
Will do. Will do.

Original thread: https://forums.rpgmakerweb.com/threads/recover-hp-when-equipping-certain-equips.59999/