RGSS3 Window_Base opacity edits

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
67
Reaction score
13
First Language
português
Primarily Uses
RMVXA
I want to see if I can replace the window opening/closing effect with a fade in and out! Command windows fade in and out fine, but it breaks Scene_Menu completely hahaha
How would I fix Scene_Menu scene calling and various other windows to this change? (Since "open?" / "close?" would be basically useless, I think....) Or did I forget to fix something in Window_Base??
Code:
class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Object Initialization - aliased
  #--------------------------------------------------------------------------
  alias :z2983_initialize :initialize
  def initialize(x, y, width, height)
    z2983_initialize(x, y, width, height)
    self.openness = 255
    self.contents_opacity = 0
    self.opacity = 0
  end
  #--------------------------------------------------------------------------
  # * Update Open Processing - overwrite
  #--------------------------------------------------------------------------
  def update_open
    self.contents_opacity += 48
    self.opacity += 48
    @opening = false if self.opacity == 255
  end
  #--------------------------------------------------------------------------
  # * Update Close Processing - overwrite
  #--------------------------------------------------------------------------
  def update_close
    self.contents_opacity -= 48
    self.opacity -= 48
    @closing = false if self.opacity == 0
  end
  #--------------------------------------------------------------------------
  # * Open Window - overwrite
  #--------------------------------------------------------------------------
  def open
    @opening = true unless self.opacity == 255
    @closing = false
    self
  end
  #--------------------------------------------------------------------------
  # * Close Window - overwrite
  #--------------------------------------------------------------------------
  def close
    @closing = true unless self.opacity == 0
    @opening = false
    self
  end
end
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Code:
open? (RGSS3)
Returns true if the window is completely open (openness == 255).

close? (RGSS3)
Returns true if the window is completely closed (openness == 0).
You need to rewrite those 2 methods to check the window's opacity instead of openness and it should work, I think.
These aren't useless methods even with your edits, because some default scripts (and most probably some custom ones too) will call them still.

Also, if you set the opacity to 0, there is no reason to set contents_opacity to 0 too, since opacity changes the whole window's opacity, including its contents.
You only need to use contents_opacity when you want to keep the window's graphics (the borders and background) without its contents.
 
Last edited:

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
67
Reaction score
13
First Language
português
Primarily Uses
RMVXA
Oh, not sure about that... setting only opacity on the title command and not contents_opacity gives me this hahahaha
1606804119022.png
1606804470607.png
same happens with the scene_menu windows, too lazy to check others :guffaw:
anyways! I guess that open?/close? fix is sort of working now? Need to do more tests...
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Ohh, I even tested it in a project, but choose the wrong one for it, because I modified the opacity change to change both of them at once there already a long time ago.
Haven't worked with windows for some time by now, kinda forgot how they work by default. :D
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,587
Latest member
Usagiis
Top