MV [(YEP) Target Core] A skill that damages one or all enemies

Hello Makers!

I was trying to come up with a skill that damages a single enemy normally, but if the user enters an enhanced state, it damages all enemies instead. I was looking at some other threads regarding this plugin (</Custom Target Eval> to be precise), but all I managed to do is for the skill to consume mana and nothing else happens. Is anyone with more JS knowledge than me able to help with this?
It always helps if you post what you tried to do that didn't work.

But try this:
Code:
<Custom Target Eval>
if (user.isStateAffected(X))
    targets.push($gameTroop.aliveMembers().filter(enemy => enemy!=targets[0]));
</Custom Target Eval>
where X is the ID of the state, no leading zeros.
@ATT_Turan so I tested it in various ways. Originally your code did exactly the same thing. Used up mana, and nothing else. After I added a line to it:
<Custom Target Eval>
if (user.isStateAffected(9)) {
targets.push($gameTroop.aliveMembers().filter(enemy => enemy!=targets[0]));
} else {
targets.push(target);
}
</Custom Target Eval>
the single-target damage works fine. In both cases though, when the actor has the state applied, this error pops up when selecting the enemy with a skill:
error.png
Oh. My mistake - I thought the targets array started pre-populated with the actual target you selected.

It doesn't.

So just do:
Code:
<Custom Target Eval>
if (user.isStateAffected(9))
    targets=$gameTroop.aliveMembers();
else
    targets.push(target);
</Custom Target Eval>
I just had to add the 'else' line again and it works like a charm. Thank you ♥
Yeah, I noticed that right after I posted and edited it in 😛

You're welcome! Good luck with your project.

Original thread: https://forums.rpgmakerweb.com/threads/yep-target-core-a-skill-that-damages-one-or-all-enemies.157756/