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.

[XP] [1.1] theory's Advanced Windowskins

theory's Advanced Windowskins
Version: 1.1
Platform: XP

Introduction

XP default windowskins are an unattractive thing.  Lifeless, stretched and skewed, and near worthless for cosmetic appeal.  So the only logical solution was to breath new life into them.  And that is what this script does.

Features

  • "Underskin" second layer for Window_Base
  • Automatic transparency for windows allowing the underskin to show
  • new - Scrolling underskins (thanks Glitchfinder)
  • new - Safer & more efficient script (thanks again Glitchfinder)
 
   
Screenshots

http://hosting07.imagecross.com/image-hosting-06/2776screenie.jpg[/img]


Demo

Click to Download...

Script


Code:
=begin

                    ╔═════════════════════════════════════╗
                    â•‘             theory's Advanced Windowskin              â•‘
                    ╚═════════════════════════════════════╝
                    
                    Version 1.1

                    I always hated the dull look of the stock windowskins-
                    When VX came out, I realized what it was missing.  That
                    stretching shit was annoying- and it really needed a second
                    layer.
                    
                    It doesn't fade in and out correctly, and lags if you use
                    too small of an image... but other than that- here you go.
                    
                    
=end


###############################################################################

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of 
#  this class.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias theory_adv_windowskin_game_system_initialize initialize
  def initialize
    theory_adv_windowskin_game_system_initialize
    @underskin_name = 'xptile'
    @underskin_sx = 5
    @underskin_sy = 3
  end
  #--------------------------------------------------------------------------
  # * Set Windowskin File Name
  #     windowskin_name : new windowskin file name
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  # * Get Underskin File Name
  #--------------------------------------------------------------------------
  def us_name
    return @underskin_name
  end
  #--------------------------------------------------------------------------
  # * Set Underskin File Name
  #     underskin_name : new underskin file name
  #--------------------------------------------------------------------------
  def us_name=(underskin_name)    
    @underskin_name = (underskin_name)
  end
  #--------------------------------------------------------------------------
  # * Get Underskin X Scroll
  #--------------------------------------------------------------------------
  def underskin_sx
    return @underskin_sx
  end
  #--------------------------------------------------------------------------
  # * Get Underskin Y Scroll
  #--------------------------------------------------------------------------
  def underskin_sy
    return @underskin_sy
  end
  #--------------------------------------------------------------------------
  # * Set Underskin Scroll Direction
  #     underskin_sx : new underskin x speed
  #     underskin_sy : new underskin y speed
  #--------------------------------------------------------------------------
  def us_scroll(underskin_sx,underskin_sy)    
    @underskin_sx = (underskin_sx)
    @underskin_sy = (underskin_sy)
  end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :@underskin               # second window layer
  attr_accessor :@underskin_sx            # second window layer x scroll speed
  attr_accessor :@underskin_sy            # second window layer y scroll speed
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     x      : window x-coordinate
  #     y      : window y-coordinate
  #     width  : window width
  #     height : window height
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super()
    @override_opacity = 100
    @underskin_ox = 0
    @underskin_oy = 0
    @windowskin_name = $game_system.windowskin_name
    self.windowskin = RPG::Cache.windowskin(@windowskin_name)
    self.opacity = @override_opacity
    self.x = x
    self.y = y
    self.width = width
    self.height = height
    self.z = 100
    @skinlayer = Viewport.new((x + 1), (y + 1), (width - 2), (height - 2))
    @underskin = Plane.new(@skinlayer)
    @underskin.z = 101
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    # Dispose if window contents bit map is set
    if self.contents != nil
      self.contents.dispose
      @skinlayer.dispose
    end
    super
  end

  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # Reset if windowskin was changed
    if $game_system.windowskin_name != @windowskin_name
      @windowskin_name = $game_system.windowskin_name
      self.windowskin = RPG::Cache.windowskin(@windowskin_name)
    end
    if self.visible == false
      @skinlayer.dispose
    else
      @skinlayer.dispose
      @skinlayer = Viewport.new((self.x + 1), (self.y + 1), (self.width - 2), (self.height - 2))
      @underskin = Plane.new(@skinlayer) #
      @underskin.z = 99
      @underskin.bitmap = RPG::Cache.windowskin($game_system.us_name) #
      @underskin_ox -= $game_system.underskin_sx / 8.0
      @underskin_oy -= $game_system.underskin_sy / 8.0
      @underskin.ox = @underskin.ox / 4 + @underskin_ox
      @underskin.oy = @underskin.oy / 4 + @underskin_oy
    end
  end
end

Instructions

Drop the script in, and look over the beginning of the script in the settings part.  Adjust these to use an existing graphic in the windowskins folder (this image should roughly resemble a fog of sorts).  Set your default speed for x and y and you're good to go.  To change these ingame, look at the girl in the demo for examples.

Compatibility

No known issues.

Credits and Thanks

A lot of credit goes to Glitchfinder- he helped out a lot getting the scrolling working, fixing a few other bugs, and showing me how to not use global variables... now I know.

Author's Notes

It doesn't fade in and out as smooth as I'd like- I'll try to fix that in the future.  If you know how, give it a shot.  If you succeed and share, I will make sure you get the credit you deserve.  Any other suggestions?  I'm all open.

Terms and Conditions

Free to use for any purposes you deem appropriate, be they commercial, private, or otherwise.  However, if this script is used, you must credit theory and (changed by his own request) may credit glitchfinder if you would like to show him some respect..
 

Toshi

Member

Really nice! I love it. Its a must-have-script. *Sets this as standart script in the default scripts.rxdata.*
 
Isn't it though?  Soooo much nicer.  Oh, and for the love of god, if *anyone* can fix the scrolling on the underskin- please do.  I will make sure that you get due credit for it.  I tried like over 100 things now- I guess the problem is that I can't figure out what to measure off of, seeing as for some reason a plane can't return the value of x and y  :crazy:

Imagine this, but smooth fading and scrolling at that.  I'll keep cracking at it, but I'm also preoccupied trying to release 1.0 of my map layers so it will be useful rather than occupying unwanted space on the forum (nobody likes betas lol)
 
:dead:

can't believe I missed that.

well, though, we have layers now.  and scrolling soon.

thanks for pointing that out, glitch.  All these years and I never knew that.
 
I've found that it really helps to obsessively search the help file when you need to know about something regarding the default scripts. Even if you don't find what you needed, you'll probably find something interesting. Also, what did you mean, with the scrolling bit? DFo you want the background to scroll with the options, or something else?
 
I created the underskin as a plane- for two reasons.

First, I wanted it to tile without having to do an insane amount of work to get it to (didn't know there was already an option- but honestly, it's still cool having a second layer.)  Secondly, I was hoping that like any other plane (panorama, fog, etc) that it could be scrolled.  So, I used the same method I used to get the panorama scrolling in MLA and tried to make the underskin scroll like a fog. (I know I could add a fog to the menus with no work whatsoever, but I wanted it behind things like message windows too.)  Okay, so naturally the $game_map.x/y isn't going to apply to menus, so I tried adding to variables off of like 15 different things, and can't figure it out.  I might be able to pull things together well, but honestly I'm still learning. If someone could look over the script (there's already scroll speed settings in there, I left the code even though it doesn't do anything)  and figure out what I need to take measurements from, it would be a huge help to my learning process as I'm out of ideas (and I need this for my MLA script as well, running into a similar problem.)
 
Okay, it's been updated.  Check the top for download.  Much, much nicer.  A lot of thanks to glitchfinder for his assistance on this one.

It's pretty much finished- the only things that might get fixed would be the fade-in / fade-out, and a fix for the default windows that don't support this for whatever reason.

If anyone has any feedback, share it.  Feedback and interaction define the difference between a good script and a great script.
 
theory":as1dpqnl said:
Okay, it's been updated.  Check the top for download.  Much, much nicer.  A lot of thanks to glitchfinder for his assistance on this one.

It's pretty much finished- the only things that might get fixed would be the fade-in / fade-out, and a fix for the default windows that don't support this for whatever reason.

If anyone has any feedback, share it.  Feedback and interaction define the difference between a good script and a great script.

Check out that redefined window class I sent you for info on how the fade in and out works. Also, the windows that it doesn't work in probably use an initialize method that does not use the update command. Also, the Window_Status does not update on its own, and will not scroll without being told to update. Finally, I don't mind if people don't credit me when they use this script, so long as this post mentioned I helped. It just doesn't seem quite right to force a mandatory list of credits on the game designer. One credit is usually more than enough per script.
 

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