Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] setting battler opacity

Does anyone know where the Battler opacity is set in the RMXP scripts? That is, the opacity of the battler graphics in the battle system. I can't find it anywhere.
 
I was simply trying to find a way to make the party member Battlers have a slightly less opacity than 100%, so that the font in front (HP/SP etc) could be more readable, however I was able to create a shadow around the text, so it may not be as necessary now.

If it's a simple edit, I'd still be interested in seeing how to do it, otherwise it's probably fine now.
 
Well in the interest of learning. :D

I'd make 2 constants in Sprite_Battler, the main phase opacity and the other opacity .
Code:
class Sprite_Battler < RPG::Sprite

  Opacity_1 = 200 # Main Phase Opacity

  Opacity_2 = 152  # Try to keep Opacity_1 - 48

Now Sprite_Battler is a sprite object ( < RPG::Sprite) so we need to set our new max opacity when it is initialized (otherwise it defaults to 255).

So your initialize method should look like:
Code:
  def initialize(viewport, battler = nil)

    super(viewport)

    @battler = battler

    @battler_visible = false

    self.opacity = Opacity_1

  end

  #--------------------------------------------------------------------------


Now just change in the update method where the opacity value changes depending on the battle phase.

Code:
      if $game_temp.battle_main_phase

        self.opacity += 3 if self.opacity < Opacity_1

      else

        self.opacity -= 3 if self.opacity > Opacity_2

      end

 

Let me know how that works for you.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top