thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
404
Reaction score
203
First Language
English
Hi everyone!

Hoping to find some help on this little issue.

I'm using an if statement in a YEP action sequence that looks like this:

if ($gameTroop._enemies.filter(function(c) {return c._enemyId === 13;}).length === 2)

This works just fine, but I need something slightly different.

What I actually need it to do is more like:

"if the gametroop contains two ALIVE enemies that match enemy ID 13"

It's an extra caveat on the statement, but ideally I still want to do it with one single line.

Can anyone help at all?

Thanks so much!
 

BlueMoon

Nebula Games Leader
Veteran
Joined
Jan 10, 2017
Messages
363
Reaction score
487
First Language
Italian
Primarily Uses
RMMZ
You can make the check using this code :kaopride:

Code:
$gameTroop.members().filter(function(e) {return e.enemyId() === 13 && e.isAlive()}).length === 2

I think this should make the trick!
 

Latest Threads

Latest Posts

Latest Profile Posts

Upgraded my avatar to be cuter.
When you look for several things for ages and then suddenly find it all at once.

Status.png
Status2.png
equip.png
I'm going to see if I can set up a triple booting setup. Windows for standard use & gaming, debian for linux development and manjaro for linux gaming, wine & proton use.
Who's got 2 thumbs and discovered an issue with his plugin after deleting the last fully functional copy? This guy xD
Well after a bit of a health break, back to streaming. Going to start in about 30 minutes.


...Also bored and figured I'd stream early on an off day. :LZSsmile:

Forum statistics

Threads
129,697
Messages
1,204,384
Members
170,762
Latest member
zaprobaa
Top