I've been trying to make this work and I need some help.
This state is the Knockout State.
<custom apply effect>
if (ally.isStateAffected(1)) {
$gameSystem.setWindowskin( "Window2" )
}
Basically what's supposed to be happening is when an Actor dies, the menu changes color. Like in Earthbound when an Ally dies.
I know that the window code works because I've tested this without checking if it's an actor. The reason why I need to check if it is an actor that has died is because when enemies are killed, the window changes color.
It looks like you are checking if someone with the state has the state. And I'm not certain what "ally" does in that context. Maybe:
a.isActor()
If that doesn't work, then you might need to replace "a" with whatever the code for "the battler with this state" is.
Several things immediately come to mind:
- You need to close your notetag with </Custom Apply Effect>
- I don't think ally is an actual variable. If you look at the console when someone gets knocked out, you should see an error. Try a.
- You are checking if someone who just got applied state 1 has state 1. This will always be true. Instead check if a.isActor().
Lastly in your title you mention Yanfly Auto Passive States. I can't see how this plugin is involved.
Just to add to the excellent advice you've been given, you also are not following the format given in the instructions for the notetag, which says "Custom Apply Effect".
In this case, it isn't harming your code because Yanfly explicitly went to effort to make the notetags case-insensitive.
However, in other plugins the capitalization can matter, and generally speaking in any kind of code the capitalization does matter; so it's a very good habit to follow it exactly as shown to you.
This thread can be closed now since found solutions to many of my mistakes and problems. 🙂
Thanks!
If you want your thread to be closed you can use the report button, so the mods can see it 🙂
as a short sidenote,
if you found the solution, it might be usefull to place your solution in case
other has the same issue or similair to your, in order to fix them up.