thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
350
Reaction score
81
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

I'm glad I'm sticking to my guns on having fighting game mechanics in my game, from what I've read, it's not for everyone. but for the most part, I've made it so you don't have to use them motion inputs for attacks if you don't want to.
And my project's just entered the Lunar New Year Sale 2022... Let's see if it reaches it's goal of $ 7,77.
Ohmygoodness I played Dicey Dungeons for the first time last night. Gave me SO MANY IDEAS for how to fix Heidi.
d757 going live today

Forum statistics

Threads
118,724
Messages
1,118,217
Members
155,865
Latest member
flawlesscozy
Top