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

Anyone want dynamically soft shadow? :kaohi:
1643106068630.png
Happy Birthday, me!
Woops.
giphy.gif
Ack, I've got to make a script support thread... I hate doing it now; I feel like an annoyance to people. Especially because my questions are usually stupid. Or, at least I assume they are when I don't get any replies lol. Oh well, I'll just make it in the morning. No point doing it now if I'll be asleep.
Slowly working on directions and walking sprites. :kaoback:
mA1ETTy.jpg

Forum statistics

Threads
118,685
Messages
1,117,875
Members
155,808
Latest member
dutchpleb
Top