Trying to make a state that increases damage and reduces damage for each currently dead party member.

Hello I'm trying to make a state that makes the actor it's attached to get more powerful/more tanky for each dead party member. But for the life of me I've been unable to get it to work. I've been trying to use $gameParty.deadMembers() in my state code sorta like:
<JS Pre-Damage As Target>
if (this.isHpEffect() && value > 0) {
const dead = $gameParty.deadMembers() * 10;
value -= Math.ceil(value * dead);
}
</JS Pre-Damage As Target>

but from what I can tell it's not working. Am I doing something wrong? Is there a easier way to do this? Does that script even work in states? Am I stupid? All these questions and more will I'm hoping will be answered.
Hello I'm trying to make a state that makes the actor it's attached to get more powerful/more tanky for each dead party member. But for the life of me I've been unable to get it to work. I've been trying to use $gameParty.deadMembers() in my state code sorta like:
<JS Pre-Damage As Target>
if (this.isHpEffect() && value > 0) {
const dead = $gameParty.deadMembers() * 10;
value -= Math.ceil(value * dead);
}
</JS Pre-Damage As Target>

but from what I can tell it's not working. Am I doing something wrong? Is there a easier way to do this? Does that script even work in states? Am I stupid? All these questions and more will I'm hoping will be answered.
Try $gameParty.deadMembers().length instead to get the number of dead members.
There's also no point in using Math.ceil() there. value is always an integer, and the number of dead members is always an integer, so there's no way you can multiply them together and get a decimal that needs rounding.

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-make-a-state-that-increases-damage-and-reduces-damage-for-each-currently-dead-party-member.170296/