Any way to create a "Disease" state, where MaxHP lowers with damage?

I'm looking to create a Disease state like in FFXII where your MaxHP reduces to match your current HP. Is there anyway to achieve this, either by script code or plugin? And before anyone suggests it, I already have a Curse state that reduces the Recovery Rate to 0%, preventing healing, along with a Zombie state that reverses healing, but those are not workarounds or the same thing.

I have a Berserker class & state that gets stronger with less HP & simply preventing recovery won't stop the power boost for a berserker, but having your MaxHP set to match your current HP would stop the effect as it's based on the difference between the current HP & Max HP.

I should mention that I'm using VisuStella's plugins in case it's possible to produce the effect with them.
Might want to check this out and play around with it + FOSSIL.

@Animebryan Someone on MV wanted the exact same thing you do. Perhaps taking the code given in this thread and using it with the proper VisuStella notetags will solve your problem, provided nothing used was changed by MZ itself.

EDIT: The reaction doesn't tell me if anything worked, and I still don't have time to try and test anything out right now. You have to give me more to go on for later.
EDIT: The reaction doesn't tell me if anything worked, and I still don't have time to try and test anything out right now. You have to give me more to go on for later.
Script calls & codes that work in MV don't exactly work in MZ copy & paste. Some changes were made so coding from Yanfly's YEP plugin library won't work with VS plugins. I need actual coding for MZ that actually work, either with VS's plugins or with another MZ compatible plugin.
None of the code in the linked thread is different in MZ's engine. The only thing you would need to change is the names of the notetags to their counterparts in VisuStella.

If you can't figure that out, let us know and someone can help you through the appropriate plugins and documentation, but there's nothing wrong with the code. (exactly as Sword said)
Really? I could've sworn I heard that something was changed & MV codes needed some tweaking to function properly in MZ. Guess I heard wrong. But there are several coding references in that topic so it is a little confusing as to which am I supposed to use, so I could use some help on which to use.
Really? I could've sworn I heard that something was changed & MV codes needed some tweaking to function properly in MZ. Guess I heard wrong. But there are several coding references in that topic so it is a little confusing as to which am I supposed to use, so I could use some help on which to use.
If I wasn't reasonably sure it would work, I wouldn't have said it. I try my best not to lead people wrong. I'll hunt around for the notetags you need once I get home, unless someone steps in before I get a chance to.

@Animebryan Okay, so use the following code in your state's notebox.
JavaScript:
<JS On Add State>
// Initialise tracking value
user._mhpLost = user._mhpLost || 0;
// Add difference between current and max HP
user._mhpLost += user.mhp - user.hp;
// Apply permanent MHP malus
user.addParam(0, user.hp - user.mhp);
</JS On Add State>

<JS On Remove State>
// Revert MHP malus
user.addParam(0, user._mhpLost);
// Remove tracking value
delete user._mhpLost;
</JS On Remove State>

The next bit of code goes into the notebox of State #1 (death state, of course):

JavaScript:
<JS On Add Effect>
if (user._mhpLost) user.addParam(0, user._mhpLost);
delete user._mhpLost;
</JS On Add Effect>

Lastly, judging from the other thread, the <No Death Clear> notetag should be put in your Disease state's notebox. Think that should cover it all.

And just to be clear, these notetags come from the VisuStella Skills and States Core. Hopefully this gets everything working as it should. If so, make sure to offer thanks to @caethyril since they came up with this code back then for the other user. If it doesn't work, we'll have to troubleshoot.
Lastly, judging from the other thread, the <No Death Clear> notetag should be put in your Disease state's notebox.
Why? The No Death Clear function causes the state to remain after death, that's not how that state works. Also, what would be the point of adding that snippet of code to the death state if the state doesn't clear upon death? That makes no sense.

Btw, what is malus?
Why? The No Death Clear function causes the state to remain after death, that's not how that state works. Also, what would be the point of adding that snippet of code to the death state if the state doesn't clear upon death? That makes no sense.
If you read through the other thread, the notetag in the death state and the notetag to bypass death were added at different times for different reasons. From the other thread:
"The only problem was that the death removed the state before the <Custom Apply Effect> could start. I fixed this by using State Categories (YEP) and put <Category: Bypass Death Removal> into the state's notes."

If you don't encounter a similar issue...then don't put that notetag in.

Btw, what is malus?

It's used somewhat atypically there.

Original thread: https://forums.rpgmakerweb.com/threads/any-way-to-create-a-disease-state-where-maxhp-lowers-with-damage.151249/