Shared troop HP

Hey! I'm looking to implement some simple part breaking feature in my game, where I have overlayed sprites of body parts on the main boss and they act as distinct entities of their own with hp and stats that the player can target separately from the boss.
Specifically I want the parts to be connected to the boss HP so when you choose to attack a part it drains HP from the boss total hp. I'm not sure how to go about implementing this however. And I'd appreciate some ideas.

My own incomplete theory: I create a variable that is connected to the boss MAX HP lets say Var1 and then a second that is connected to the monster part Max HP Var2. then id create another variable which is Monster part Current HP Var3 and subtract that from Var2 in order to find the dmg done? and then subtract that from var1? and set this calculation as a every turn on turn end of the battle in the troop events? This way seems good only problem is that in the 2nd step where I subtract Var 3 from var 2 that won't show how much dmg i did this turn but the amount of dmg the monster part has received in total.
Is there some variable that has access to the amount of dmg that is dealt in the most recent player attack?

For reference I have only 1 actor and it will stay that way.
Thanks in advance.
An alternate way of doing this is to give the core most of the HP. You could have the core creature defense, offense, and speed diminish as its parts are brought to low HP. The parts could be immortal, go into auto-sleep state when at low health, have respawn, have regeneration, or just have flat HP with no healing power. Another thing you can do is give the core a "heal other" skill that reduces it's own HP when used.

Example:
Hydra Body has 10,000 health, some attacks, and a "regenerate" skill that brings a head back to life at full HP. Using this skill reduces the Hydra Body health by 1000. Each hydra head has 1000 HP.
An alternate way of doing this is to give the core most of the HP. You could have the core creature defense, offense, and speed diminish as its parts are brought to low HP. The parts could be immortal, go into auto-sleep state when at low health, have respawn, have regeneration, or just have flat HP with no healing power. Another thing you can do is give the core a "heal other" skill that reduces it's own HP when used.
Yeah, there's a simple way of doing this which is the player needing to defeat all parts of the monster in order to progress but I would prefer to have the dmg dealt attached to variables that control my main bodies hp
Hey! 👋

I would use Yanfly's Auto Passive States and Buffs & States Core...they're a killer combo-nyan!

Every body part can be given the same passive state, and you'd totally put this in the notetags:
Code:
<Custom Respond Effect>
if (this.isDamage())
    $gameTroop.members()[0].gainHp(-value);
</Custom Respond Effect>

That members[0] part re-furs to the order you put the enemies into the troop-nyan. So it'll be easiest for this to work if you empty the troop and make sure the main body is the first one in!

Good luck! 😍
Hey! 👋

I would use Yanfly's Auto Passive States and Buffs & States Core...they're a killer combo-nyan!

Every body part can be given the same passive state, and you'd totally put this in the notetags:
Code:
<Custom Respond Effect>
if (this.isDamage())
    $gameTroop.members()[0].gainHp(-value);
</Custom Respond Effect>

That members[0] part re-furs to the order you put the enemies into the troop-nyan. So it'll be easiest for this to work if you empty the troop and make sure the main body is the first one in!

Good luck! 😍
Ah thanks for this suggestion, wasn't aware of that Yanfly addon (I've bought the whole suit) so I'll try it out once I get home. Also thanks for the parameter for the notes.

Original thread: https://forums.rpgmakerweb.com/threads/shared-troop-hp.167376/