Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
zahraa

Opacity of windowskin

Question

Hi ! :)

Well,I have nothing to say so let's ask main question!

I know how to change opacity of windowskin but when you make Opacity of your windowskin (which used in menu of game) lower,you see nothing but a black screen but i want to see the map which I'm in it behind the windowskin

I want it for "Window_BattleStatus" too.i want to see battleback behind the windowskin (when i make its opacity lower,you know)

SORRY for bad English

Waiting for your answers

Thanks ;)

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

for your first one add this code:

@background = Spriteset_Map.new

 

place it in the main method of a scene above the main loop, and then just reduce the opacity of all windows in that scene, heres an example of how I did it in scene_menu, I placed all this code just above the main loop:

 

    @command_window.opacity = 160
    @playtime_window.opacity = 160
    @steps_window.opacity = 160
    @gold_window.opacity = 160
    @status_window.opacity = 160
    @background = Spriteset_Map.new
 
    oh ye and your going to need to dispose the background otherwise you will get an error when the menu          
    re-opens, place:
    @background.dispose
    at the bottom of the main method below the disposal of all the other objects

 

for your second one your going to have to make a few edits, first you will need a larger battleback(640, 480), reduce the opacity of the window, then go into Spriteset_Battle, on line 19 you will see:

@viewport1 = Viewport.new(0, 0, 640, 320)

change that line to:

@viewport1 = Viewport.new(0, 0, 640, 480)

next go to line 106 and you will see:

@battleback_sprite.src_rect.set(0, 0, 640, 320)

again change the 320 to 480

as long as you have a larger battle back you will now be able to see it behind the window :)

Edited by diagostimo

Share this post


Link to post
Share on other sites
  • 0

You can also try this way as well for the first part. This way if you add a new window to your Menu you don't have to continously keep changing the opacity. Just change it from the Window_Base.

class Window_Base < Window
	alias :zahraa_menu_init :initialize unless $@
	def initialize(*args, &block)
		zahraa_menu_init(*args, &block)
		menu_opacity?
	end
	def menu_opacity?
		return unless $scene.is_a?(Scene_Menu)
		self.back_opacity = 160
		self.opacity = 160 
	end
end
class Scene_Menu
	alias :zahraa_main_map :main
	def main
    @background = Spriteset_Map.new
		zahraa_main_map
		@background.dispose
	end
end

Share this post


Link to post
Share on other sites
  • 0

Well,Let's see :
@diagostimo: Your answers was good.Second one works Really great.thanks a lot :thumbsup:
First one works too,but there was something that annoyed me:
When i open the menu,It takes about one second (Its time depends on size of map) to change opacity of windoskin and show map behind it.Maybe it doesn't seem a big problem but i really care about it. :\
 
@bigace:I'm not sure I'm using this script right,But i got an error.
I placed these codes at start of window_base :
 
class Window_Base < Window
alias :zahraa_menu_init :initialize unless $@
def initialize(*args, &block)
zahraa_menu_init(*args, &block)
menu_opacity?
end
def menu_opacity?
return unless $scene.is_a?(Scene_Menu)
self.back_opacity = 160
self.opacity = 160
end
end

 
and placed these codes at start of scene_menu :


class Window_Base < Window
alias :zahraa_menu_init :initialize unless $@
def initialize(*args, &block)
zahraa_menu_init(*args, &block)
menu_opacity?
end
def menu_opacity?
return unless $scene.is_a?(Scene_Menu)
self.back_opacity = 160
self.opacity = 160
end
end

 
and when i start the game,I get this error :
Script  "Scene_Menu" line 8 : NameError occurred.
undefined method `main' for class `Scene_Menu'
 
Thank you guys :grin:

Edited by zahraa

Share this post


Link to post
Share on other sites
  • 0

Of course it didn't work because I aliased the code, if a code is aliased it needs to go below the original code or you'll get an error. Sorry should of specified, you just needed to add that snippet I posted in a new script below Scene_Debug. Just click insert on your keyboard above Main and then copy and paste the script I gave into it. Whatever you did probably would cause an error.

Share this post


Link to post
Share on other sites
  • 0

Got it! :P

 

And thank you sooooo much for your help.this is exactly what i want. :excited:

Nice job. :thumbsup:

Share this post


Link to post
Share on other sites
  • 0

about the opacity not changing straight away with my method, as I said put it above the main loop, there's a bit of code there that might cause delay, you will notice Graphics.transition just above the main loop, it should have been above that, that may cause a slight delay in it being drawn but not 100% on that, but bigace's way is more efficient as it deals with multiple windows at once for that scene, with bigace's script you could add to it to account for more scenes, if you didn't want to do it manually in them all as it can get messy and you might forget where you added edits, here is an example:

 

return unless $scene.is_a?(Scene_Menu)
#if I wanted to add scene_item to be transparent I should change the above to this:
return unless $scene.is_a?(Scene_Menu) || $scene.is_a?(Scene_Item)
#note I just add || which basically means or, I also change the class name, you could
#also add more on multiple lines like so:
return unless $scene.is_a?(Scene_Menu) || 
  $scene.is_a?(Scene_Item) ||
  $scene.is_a?(Scene_Title) ||
  $scene.is_a?(Scene_Battle) ||
  $scene.is_a?(Scene_Equip) #ect
Edited by diagostimo

Share this post


Link to post
Share on other sites
  • 0

yeah,when i put those codes above Graphics.transition,It worked really great. :thumbsup:

thanks. :)

and thanks again for your answer about ' battleback behind windowskin ' :grin:

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...