Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
120
Reaction score
31
First Language
English
Primarily Uses
RMMV
Hi All,

I think this might be a simple one. But I am looking for a condition to check for a specific skill. I have a skill that needs 2 or more of the same enemy to activate and I got that working with "Troop Alive Members > 1", but the issue I run into is if one enemy of that kind is alive with a different enemy it will still try and do that skill. What I need to check for is if more than 1 of the same enemy ID is alive.

Does anyone know if that is possible with an Eval, and if so, what would be the eval?
I was thinking something along the likes of:
alive enemyId(XX) > 1 : Skill XX, Highest HP%

But, you know, actually correct.

As always, any help is greatly appreciated.
 

eomereolsson

Veteran
Veteran
Joined
Sep 29, 2021
Messages
433
Reaction score
358
First Language
German
Primarily Uses
RMMV
I would try something along those lines in the EVAL (sorry, I am not at home, so I can't actually test it):
let result=false; $gameTroop.aliveMembers().forEach(m => {if (user != m && user.enemyId() == m.enemyId()) result = true;}); result;
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
5,459
Reaction score
3,535
First Language
English
Primarily Uses
RMMV
Just to offer a slightly shorter option (not any better, as far as I know!):
Code:
$gameTroop.aliveMembers().filter(member => member.enemyId()==user.enemyId()).length>1

Both of these solutions are presuming that the enemy you want two of is the enemy using the skill. If that's not the case (the boss needs two henchmen to use a thing), then replace user.enemyId() with the ID of the desired enemy.
 

Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
120
Reaction score
31
First Language
English
Primarily Uses
RMMV
Thank you to both of you! That got me to what I was looking for!
 

Latest Profile Posts


Clarn Hold
(No storylines)
There was a tutorial on how to draw anime eyes. Just draw Among Us. So I tried.
Screenshot_107.jpg
DamageActor3_7.png added!
index.php

Making a "characters first appearance" drawing for my game. Now I just have to finish the sprite art animation for her grand entrance.​
ScreenShot_9_24_2022_7_56_24.png
New area being started today. It leads to one of the games 2 optional bosses.

Forum statistics

Threads
125,537
Messages
1,171,802
Members
164,608
Latest member
royeventcompany
Top