MZ How to change an event's sprite using its given name instead of ID?

I'm thinking something like a parallel event that goes:

If $gameMessage.speakerName() == "NPC"
-> Fetch any event where Name == "NPC" applies and change its sprite to "NPCAnimation"

I just don't know how to do the script calls for those last two things. Can anyone help out?

(Changing the image with regular events isn't possible here as that requires selecting an Event ID from a map list.)
Didn't the code I gave you yesterday work?

const event = $gameMap.events().find(event => event.event().name === "NPC");
if (event)
event.setImage("NPCAnimation", 0);

If you want for all, I think it's like:

const events = $gameMap.events().filter(event => event.event().name === "NPC");
events.forEach(event => event.setImage("NPCAnimation", 0));
Didn't the code I gave you yesterday work?

const event = $gameMap.events().find(event => event.event().name === "NPC");
if (event)
event.setImage("NPCAnimation", 0);

If you want for all, I think it's like:

const events = $gameMap.events().filter(event => event.event().name === "NPC");
events.forEach(event => event.setImage("NPCAnimation", 0));
Now it does! I tried it earlier and must have put something in wrong, may have been the image path. I finally got the player animation working before that too. Thanks for all your help!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-change-an-events-sprite-using-its-given-name-instead-of-id.182915/