Opacity State

Trying to make a stealth state that changes the users opacity.. can't seem to figure out how to do it. Been trying to use the <Custom Apply Effect> and <Custom Leave Effect> tags from Buffs & States core and have tried all kinds of combinations of this/user/battler/gameActor.actors(...) etc.. & .opacity/.alpha/._opacity/._alpha/.setOpacity()

...but I think I'm just misunderstanding how Yanfly's tags work tbh. I don't think this needs a plugin request thread and can be solved by finding the proper code. I can achieve this through Action Sequences but seemed silly having to attach a piece of code to every sequence to reset opacity.

If anyone could help that'd be great!
The relevant property is opacity, but it's on the sprite object (Sprite_Battler), not the actor/enemy (Game_Battler). By default the sprites are set up to check their battler and update themselves; the battler does not directly have access to its "own" sprite. Yanfly's Battle Engine Core adds a battler() lookup function on Game_Battler though (or you could implement your own lookup loop), in which case you could something like:
Code:
user.battler().opacity = 128;  // 50%
Not sure whether that'll be sufficient by itself (there are other factors that alter sprite opacity) but it's worth a try~! 😂

In case it helps as a reference, here's a little plugin I wrote to adjust opacity with notetags: Cae_BattlerOpacity
Ahh, user.battler! I never tried that one... 😐

Thank you!
Hope it works! ^_^
I just wanted to say thanks for this, caethyril. I've been agonizing over this myself for months (most decidedly NOT a dev, over here), so I appreciate it!
Yo, I was wondering if there is a continuation of this. I've done this but I'm wanting to use skill 'stealth' out of battle and enter into battle with it still active and the character still in lower opacity

Original thread: https://forums.rpgmakerweb.com/threads/opacity-state.108683/