I'm trying to make a message that will display at the bringing of combat if a specific monster is present. I am using an enemy randomizer to create more variation with less troops. It randomizes before the battle screen loads. So is there a way to conditional the message based on the enemy ID?
A message at the begining of combat if a specific enemy is present.
RPG Maker MZ SupportConditional Branch -> Script ->
where x is the ID you're looking for.
$gameTroop.members().filter(enemy => enemy.enemyId()==x).lengthwhere x is the ID you're looking for.
Ah thank!
(Small typo in @ATT_Turan's code: use
Alternatively:
This is
$gameTroop, not $gameTroops. Otherwise looks A-OK!)Alternatively:
$gameTroop.members().some(m => m.enemyId() === 123)This is
true iff the troop has at least 1 enemy with ID 123. Technically a bit more efficient, too, because it'll stop as soon as it finds such an enemy and won't produce a new array.Oops, thanks for the catch!
Hehe Thanks. I was literally just going type that it was getting an error, as I just got to testing it.
Thanks again!
Thanks again!
Original thread: https://forums.rpgmakerweb.com/threads/a-message-at-the-begining-of-combat-if-a-specific-enemy-is-present.152258/