Yanfly System Options Help: Add Window Opacity Slider

● ARCHIVED · READ-ONLY
Started by rapiermother 6 posts View original ↗
  1. So, I've been working with Yanfly's awesome System Options script, and I've been able to put the 2 custom switches into use for showing/hiding my HUD & minimap:



    I'm sure adding a custom variable slider is just as simple, but I want one that adjusts the window opacity. I don't want to be limited to just opaque and translucent; I want a slider that allows the player to adjust the window opacity (for all windows, menus, etc.) between 0% and 100%. So essentially, at 100%, the grey background window in the above screenshot would be opaque and you wouldn't see the map showing through; and at 0%, you would see the white border and all the text/sliders, but you'd see right through the (invisible) grey part and see the map clearly.

    The problem is, I have no idea how to adjust the window opacity based on one of the  $game_variables.
  2. Do you have any menu/window scripts or are you using default?

    ~ Dinhbat
  3. Well, by default, opacity values range from 0 to 255, not 100. I don't know if you still want your slider to go to 100 or not. Then I'd probably edit something into Window_Base.

    class Window_Base < Window #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias rmw_opacity_option_base_initialize initialize def initialize(x, y, width, height) rmw_opacity_option_base_initialize(x, y, width, height) self.back_opacity = $game_variables[1] * 255 / 100 endendYou can take out the * 255 / 100 if you want the max to be 255 and not 100.I'd probably also make an edit to Window_TitleCommand, otherwise it will always be completely transparent all the time.

    Code:
    class Window_TitleCommand < Window_Command  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  alias rmw_opacity_option_titlecommand_initialize initialize  def initialize    rmw_opacity_option_titlecommand_initialize    self.back_opacity = 192  endend
  4. I have many custom window and menu scripts (HIME Custom Slots, obviously Yanfly System Options, Scene_Combine), and a number of custom windows I've made (including supporting windows to improve Scene_Combine, a new menu window that fills the gap between the commands and the gold window, a full Map menu, and others).

    I guess what I'm hoping is that there's some way to modify Window_Base such that whaen any window is drawn, the opacity is determined by a $game_variable. I don;t know if it's that simple, though.
  5. @Yato: Thanks for the point in the right direction. Your answer is seriously overcomplicated though.

    simply adding "self.back_opacity = $game_variables[1]" to the original Window_Base initialize method would suffice (as well as "self.back_opacity = 192" added to initialize in Window_TitleCommand).

    All I really needed was the syntax required to modify the opacity.
  6. Sorry, I assume everyone here likes a nice plug-an-play alias'd method. It's hard to judge someone's scripting knowledge based on one request topic. And if you're looking for syntax, I'd suggest checking out the F1 menu. It has a lot of the syntax for hidden classes, such as Window.