HP based on the number of a certain item in inventory.

So I've been playing a lot of Hero Chronicles (I love Clash of the Dragons, tis awesome) and I was wondering if there was a way, using events that an actors HP was dependant on how many of a certain item is in the inventory.

EG. The Hero (Actor) has 4 different troops that battle for him (he does not engage in battle directly)

Troop 1 is Goblins

Troop 2 of Thieves

Troop 3 is Knights

Troop 4 is dragons.

Now these troops only appear in battle, not in the main menu as playable characters.

But... they appear as Items in the item menu (using Yanflys Item menu customisation script).

So. Is there a way, using events to have the system check how many "Goblins" and "Knights" and "Dragons" etc are in the menu and convert this number into HP for the troops in battle. And then to have the system check after battle how much HP is left and change the number of items to that amount instead?
Please close this. I have managed to do it myself.

I will post a tutorial on it soon just in case anyone else might be interested.
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.

Original thread: https://forums.rpgmakerweb.com/threads/hp-based-on-the-number-of-a-certain-item-in-inventory.20346/