MZ Passive question

I'm in RPGMZ, I have Visu's Skills and States plugin installed, and I want to make a passive state that activates when an ally dies. How do I do that?
Code:
<JS Passive Condition>
condition = $gameParty.deadMembers().length;
</JS Passive Condition>
Code:
<JS Passive Condition>
condition = $gameParty.deadMembers().length;
</JS Passive Condition>
Can you give me an example, so I can understand better? I'm not very good with J's.
I don't understand the question. An example of what? I literally typed out the code for you.
Nevermind that, I figured how that code works. But now I have another problem: how do I remove the status when I revive the fallen ally? I intend for the status to be removed once the fallen allies are revived.
I suggest you read through the plugin description and instructions once more.

The condition of a passive state defines when it is on. When that condition is no longer met, the passive state is off.

They aren't two separate things, where you can tell it when to turn on and then you separately tell it to turn off.

Did you try the above code before saying you have another problem? Because it should already do exactly what you say 😉

Good luck with your project!
Yeah, I did try it. The result was that the character with the Berserk Rage state (that's how I called that passive) was still in the Berserk Rage state even after I used a Revive. Maybe it's something I should replace "length" in the code with?
Yeah, I did try it. The result was that the character with the Berserk Rage state (that's how I called that passive) was still in the Berserk Rage state even after I used a Revive. Maybe it's something I should replace "length" in the code with?
Try $gameParty.deadMembers().length > 0
Yeah, I did try it. The result was that the character with the Berserk Rage state (that's how I called that passive) was still in the Berserk Rage state even after I used a Revive. Maybe it's something I should replace "length" in the code with?
Please show a screenshot of your state.

What Trihan provided is a more explicit way to cast the result as a boolean, but the fact is if there are no dead actors in the party, then deadMembers().length is 0 which evaluates as falsy.

If it works correctly that the state is not on when all members are alive to begin with, it should work correctly once members are revived and are alive again.
1706894581660.png
The state
1706894603402.png

A character I gave the state to
1706894659520.png

Notice how the character with the Berserk Rage still has the Berserk Rage status (this is in the battle test).
You've set that up incorrectly.

Per the instructions, the conditions are for the state, not an actor.

1706894846719.png
View attachment 293875The state
View attachment 293876
A character I gave the state to
View attachment 293877
Notice how the character with the Berserk Rage still has the Berserk Rage status (this is in the battle test).
Why have you put "Erika" into the brackets for the call to deadMembers when neither of us even remotely implied that you should do that?

(incidentally had you put quotes around the name this wouldn't have mattered since you'd just have been sending the function a redundant argument it wouldn't do anything with, but without quotes, you've attempted to send the value of a variable *called* Erika, which will cause an error because there is no such variable in existence)
Why have you put "Erika" into the brackets for the call to deadMembers when neither of us even remotely implied that you should do that?
I didn't even look for the code to have been altered. 🤣

@TheMergerMagikoopa Your original question didn't state you only want this to happen when one specific ally dies...if that's the case, you'll need a completely different code statement.
Ah, so that's why I am dealing with a syntax error.
Ah, so that's why I am dealing with a syntax error.
Yes, it's the funniest thing but when you just add random bits on to the specific code you were given, it's unlikely to work. 😛
Yes, it's the funniest thing but when you just add random bits on to the specific code you were given, it's unlikely to work. 😛

No, wait. It wasn't the added thing. It was your advice. (In case you ask, the sintax error was an unexpected ">".)
The code runs fine with my addup, except for my aforementioned problem that it didn't work.
Oh well, at least Turan should know the code for my specifications (particular allies are dead). Or if not, he will figure it out
Ah, yeah, you can't use the greater than sign in notetags because the parser thinks it's the end of the tag. Should have put < 1 instead. You'd still have gotten an error for the reason I stated above though. 🙂

$gameParty.deadMembers().some(function(member) { member.name() === "Erika" }) should work as a condition if you want it to apply specifically to her. You could also use the ID.
No, wait. It wasn't the added thing. It was your advice.
That's not correct.

What @Trihan provided you was perfectly valid JavaScript, as was my original post.

You typing Erika in the middle tells the code to look for a variable called Erika which doesn't exist.

Oh well, at least Turan should know the code for my specifications (particular allies are dead).
Code:
<JS Passive Condition>
condition = $gameActors.actor(69).isDead();
</JS Passive Condition>

You must replace the 69 with Erika's actor ID from the database, no leading zeros.

Ah, yeah, you can't use the greater than sign in notetags because the parser thinks it's the end of the tag.
That's true if you're referencing a straightforward meta <tag_name: value>

But these have parsers that, presuming they're anything like the Yanfly plugins, are looking for the specific string </JS Passive Condition> - any other line should be parsed into the code stored on the object.

I'm more inclined to presume the OP replaced all of my code with what you typed without the condition = in front.
That's not correct.

What @Trihan provided you was perfectly valid JavaScript, as was my original post.

You typing Erika in the middle tells the code to look for a variable called Erika which doesn't exist.


Code:
<JS Passive Condition>
condition = $gameActors.actor(69).isDead();
</JS Passive Condition>

You must replace the 69 with Erika's actor ID from the database, no leading zeros.


That's true if you're referencing a straightforward meta <tag_name: value>

But these have parsers that, presuming they're anything like the Yanfly plugins, are looking for the specific string </JS Passive Condition> - any other line should be parsed into the code stored on the object.

I'm more inclined to presume the OP replaced all of my code with what you typed without the condition = in front.
Good point, could be. Ah well, as long as it's sorted now.
Okay, now it works properly, except for the fact DevTools always activates whenever I run anything. Other than that, thanks.

Original thread: https://forums.rpgmakerweb.com/threads/passive-question.165386/