MV Sprite Tint

I've been using this command in my game to create a time stop effect:

"SceneManager._scene._spriteset._characterSprites[ID].tint = hex"

In addition with Galv's Layers

I was wondering whether there was a script to apply this effect to all sprites on the map - except for the player and events with a special note tag? And if it could have on and off toggle or a command to change the tint?

This is what I'm currently doing:

Captura de tela 2024-10-30 094345.png
Captura de tela 2024-10-30 094355.png
I think you can use $gameVariables.value(X) as ID and then create a loop with add+1 to that variable, but that way you'll get it for event 0 to 33 for example. So maybe paste the events with IDs 16, 18, 22 to 27 and so on as the first events on map, let's say 1-10, and start the loop from 10+? But I'm sure it's even better solution for this, but I'm not good at scripting...

There's also topics like this for example where you can see how to use notetags for this. I think you can use the solution provided by Soulrender in second post.
Holy event command spam, Batman.

Even if you couldn't figure out how to do it in code, why wouldn't you use a Loop event command, increment a variable, and change the sprite with the ID of that variable?

As a tip, if you ever find yourself thinking about placing the same command twenty times, that's not a good way to do it 😉

I was wondering whether there was a script to apply this effect to all sprites on the map
Yes.

Code:
SceneManager._scene._spriteset._characterSprites.forEach(sprite => sprite.tint = hex)

To omit the player:
Code:
SceneManager._scene._spriteset._characterSprites.forEach(sprite => {if (sprite._character != $gamePlayer) sprite.tint = hex})

I can't immediately think of how you'd omit events based on a notetag...as far as I know, the sprites have no reference back to which event they're representing.

I think you might need a little plugin that would set a property on the sprite at the time of its creation if the event has the notetag.
as far as I know, the sprites have no reference back to which event they're representing.
It's the other way around: sprites are assigned a character, but the character has no reference to its sprite(s).

Suggestion:
JavaScript:
for (var sprite of SceneManager._scene._spriteset._characterSprites) {
  var c  = sprite._character;
  var id = c ? c._eventId || 0 : 0;
  if (id)
    sprite.tint = 0xFFFF00;
}
It's the other way around: sprites are assigned a character, but the character has no reference to its sprite(s).
You're right, my brain was backwards.

Thus, to the OP, for omitting the player and a notetag:
Code:
SceneManager._scene._spriteset._characterSprites.forEach(sprite =>
{
    if (sprite._character != $gamePlayer && (!sprite._character.event() || !sprite._character.event().meta.notint))
        sprite.tint = hex;
});

That should skip the player and any event with the <notint> notetag.
SceneManager._scene._spriteset._characterSprites.forEach(sprite => { if (sprite._character != $gamePlayer && !sprite._character.event().meta.notint) sprite.tint = hex}) });
you made 2 mistakes here, the last behind "hex" or the bottom }) giving 2 errors, removing those fix them.

so the correct one without errors (if it works)
JavaScript:
SceneManager._scene._spriteset._characterSprites.forEach(sprite =>
    {
        if (sprite._character != $gamePlayer && !sprite._character.event().meta.notint)
            sprite.tint = hex
    });

so a small oversight again @ATT_Turan ? ^^
Whoops, I forgot to actually read the OP. 😴

Should check for existence of the event method, e.g. for vehicles/followers. This seems to work for me:
JavaScript:
for (var sprite of SceneManager._scene._spriteset._characterSprites) {
  var c  = sprite._character;
  var e  = c instanceof Game_Event ? c.event() : null;
  var ok = c !== $gamePlayer && !(e && "no tint" in e.meta);
  if (ok)
    sprite.tint = 0xFFFF00;
}
For the tag <no tint> present in an event's Note field. 👋
Yeah, I accidentally typed the close brace and parenthesis twice. Fixed.
Thanks everyone for the help!

SceneManager._scene._spriteset._characterSprites.forEach(sprite =>
{
if (sprite._character != $gamePlayer && !sprite._character.event().meta.notint)
sprite.tint = hex
});
This worked wonders!

Original thread: https://forums.rpgmakerweb.com/threads/sprite-tint.172918/