Resource Conditional States / Buffs

For a project I am working on I want the party members to receive buffs, debuffs, and states based on remaining resources. For example, if the player runs out of mp, they would receive a state. I could not find a way to do this without scripts, and I created this:

if ($gameParty.members()[0].mp = 0) {$gameParty.members()[0].addState(32)}

It is set to run once every turn as a battle event. However, despite reaching and sitting at 0 mana on the respective party member I never receive the state. What is it that I'm missing?
$gameParty.members()[0] just refers to the first member in your party, so it's not necessarily the first member of the battle party, and even if it's in the battle party, it's only one of the party member. You'd need a check for every member in the battle party.

Also, it's '==' and not '=' for the conditional.

Code:
if ($gameParty.members()[0].mp == 0)
$gameParty.members()[0] just refers to the first member in your party, so it's not necessarily the first member of the battle party
Unless I'm misunderstanding you, it is - the "battle party" is simply the first 4 members of the party (or whatever you may have increased its size to), the ordering is the same.

In fact, calling members() and battleMembers() in battle returns the same list.

However, your solution is perfectly correct 🙂
Yeah I just included that part in case he has a plugin that changes that, like how I did it for my project. But yes, you are correct.

Original thread: https://forums.rpgmakerweb.com/threads/resource-conditional-states-buffs.152539/