thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
371
Reaction score
141
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 Profile Posts

its_a_random_world.jpg
Well after half a year of health problems (that aren't as bad as before), and playing with UE4 & 5... I realized I should finish this project before working on something else. So I decided to upgrade my randomizer. And really just focus on compromising wherever I can to finish the project sooner rather than later. :kaoswt:
hmmm. an art of mine was removed from reddit, for a reason not even listed.

Forum statistics

Threads
121,890
Messages
1,144,957
Members
160,143
Latest member
Krockhunter
Top