Change Battlers Opacity depending on State

The title says it all,
I'm looking for a script that changes the sprite opacity of the Battler who is under certain State.
Can anyone help me with that?

Thanks in advance! 🙂
*Little bump*
Do you happen to use any battle system script that shows actor sprite or it is vanilla?
Before, I changed the size of sprites, so it should be easy to change the opacity:

Code:
class Sprite_Battler < Sprite_Base
  alias dl_update_effect update_effect #alias means run this method on top of the originial
  def update_effect
    if @battler.state?(GHOST) #Change this to your state id
      self.opacity = 100 #Opacity is 0-255
    else #If you don't have this state, return opacity to normal
      self.opacity = 255
    end
    dl_update_effect #This alias nickname runs the original update_effect
  end
end
@Harosata Thank you very much! It worked perfectly! 🙂
@TheoAllen I'm using vanilla. Harosata solved it, but thanks anyway!

Original thread: https://forums.rpgmakerweb.com/threads/change-battlers-opacity-depending-on-state.91617/