Hammy - Window Shadows v1.04
Add depth and visual polish to your game's UI with customizable window shadows
Introduction
This script provides a customizable shadow system for all windows in RPG Maker VX Ace. It automatically adds shadows behind windows to create depth and visual polish in your game's user interface.
AI Disclaimer: Generative AI was used to refine the documentation and presentation of this script, as I am not a native English speaker. Additionally, AI was used to optimize the explicit z-index initialization part of the code, for naming conventions in some places and for general beautification of the script.
Features
Core Shadow Features
- Automatic shadow creation for all windows
- Runtime shadow enable/disable via Game_System integration
- Window exclusion system for selective shadow application
- Explicit z-index management for proper shadow layering
Customization System
- Per-window-class shadow configuration with custom graphics and settings
- Per-window-type shadow configuration via FF9 Windowskin System integration
- Configurable shadow offsets (horizontal and vertical positioning)
- Shadow opacity scaling based on parent window transparency
Technical Features
- Automatic shadow property updates (position, size, openness, visibility)
- Dynamic shadow recreation when system is re-enabled
- Proper shadow disposal and cleanup on window termination
Screenshots
Script Calls
The following script calls are available for use in events and other scripts.
Shadow System Control
$game_system.window_shadows = true
Enables the window shadow system globally. All windows will display their configured shadows.
$game_system.window_shadows = false
Disables the window shadow system globally. All window shadows will be hidden and disposed.
Examples
Ruby:
- # Enable window shadows globally
- $game_system.window_shadows = true
- # Disable window shadows globally
- $game_system.window_shadows = false
复制代码
Usage
This section explains how to prepare windowskin graphics for use as shadows.
Shadow Windowskin Preparation
Shadow windowskins are modified versions of standard RPG Maker VX Ace windowskin files. Windowskins are 128x128 pixels in size.
- Step 1: Start with your standard windowskin file (128x128 pixels)
- Step 2: Keep only the upper-right quadrant (x: 64-128, y: 0-64)
- This section contains the window border graphics. Everything else should be removed or made transparent.
- Step 3: Remove the top and left border segments
- Delete the upper portion of the window frame. Delete the left portion of the window frame. Delete the scroll arrows. Keep only the bottom and right border segments.
- Step 4: The result should show only the lower-right corner and edges
- This creates the shadow effect when offset behind the main window.
- Step 5: Place your prepared shadow windowskin files in the Graphics/System
- Ensure they are referenced properly in the configuration settings.
Configuration
Edit the constants in the
Hammy::WindowShadows module to configure the shadow windowskins, offsets, opacities, exclusions, and custom window mappings.
Default Shadow Settings
Configure the default shadow appearance for all windows in the game. These settings control the shadow windowskin, offsets, and opacity. Set windowskin to nil to disable shadows globally across the game.
DEFAULT_SETTINGS
Hash containing default shadow configuration.
-
windowskin: Shadow windowskin filename in Graphics/System folder.
-
offset_x: Horizontal shadow offset in pixels (positive = right).
-
offset_y: Vertical shadow offset in pixels (positive = down).
-
opacity: Shadow opacity value (0-255, where 255 is fully opaque).
-
Valid values: Hash with Symbol keys and specific value types
-
Default:{ :windowskin => "Window_Shadow", :offset_x => 3, ... }
Example
Ruby:
- DEFAULT_SETTINGS = {
- :windowskin => "Window_Shadow",
- :offset_x => 3,
- :offset_y => 3,
- :offset_width => 0,
- :offset_height => 0,
- :opacity => 120
- }
复制代码
Excluded Windows
Configure window classes that should not display shadows. Add window class constants to exclude specific windows from the shadow system entirely.
EXCLUDED_WINDOWS
Array of window class constants to exclude.
-
Valid values: Array containing Window Class constants
-
Default:[Window_BattleLog]
Example
Ruby:
- EXCLUDED_WINDOWS = [Window_BattleLog]
复制代码
Explicit Z-Index Windows
Configure window classes requiring explicit z-index assignment during initialization. Windows without explicit z-values can cause shadows to appear above other parent windows when shadows are re-enabled.
EXPLICIT_Z_WINDOWS
Array of window classes requiring explicit z.
These windows will be assigned
z = 200 during initialization.
-
Valid values: Array containing Window Class constants
-
Default:[Window_ChoiceList]
Example
Ruby:
- EXPLICIT_Z_WINDOWS = [Window_ChoiceList]
复制代码
Window Class Shadow Configuration
Configure custom shadow settings for specific window classes. This allows you to override default shadow appearances for individual window types with per-class customization of graphics and offsets.
WINDOWSKIN_MAP
Hash mapping window class names to custom settings.
-
Format: "ClassName" => { :windowskin => "Name", :offset_x => x, :offset_y => y, :opacity => o }
-
Valid values: Hash with String keys and Hash values
-
Default:{ "Window_MenuCommand" => {...}, "Window_Gold" => {...} }
Example
Ruby:
- WINDOWSKIN_MAP = {
- "Window_MenuCommand" => {
- :windowskin => "Window_Shadow_Red",
- :offset_x => 3,
- :offset_y => 3,
- :offset_width => 0,
- :offset_height => 0,
- :opacity => 80
- },
- "Window_Gold" => {
- :windowskin => "Window_Shadow",
- :offset_x => 0,
- :offset_y => 0,
- :offset_width => 3,
- :offset_height => 3,
- :opacity => 80
- },
- }
复制代码
Window Type Shadow Map
Configure custom shadow settings for window types when using the Hammy FF9 Windowskin System. This allows shadows to automatically match the visual style of window types defined in the system.
WINDOW_TYPE_MAP
Hash mapping window types to custom shadow settings.
-
Format: :window_type => { :windowskin => "Name", :offset_x => x, :offset_y => y, :opacity => o }
-
Available types: :default, :frame, :topbar, :help
-
Valid values: Hash with Symbol keys and Hash values
-
Default:{ :default => { ... }, :frame => { ... }, ... }
Example
Ruby:
- WINDOW_TYPE_MAP = {
- :default => {
- :windowskin => "Window_Shadow_Default",
- :offset_x => 2,
- :offset_y => 2,
- :offset_width => 0,
- :offset_height => 0,
- :opacity => 120
- },
- :frame => {
- :windowskin => "Window_Shadow_Frame",
- :offset_x => 2,
- :offset_y => 2,
- :offset_width => 0,
- :offset_height => 0,
- :opacity => 120
- },
- :topbar => {
- :windowskin => "Window_Shadow_Topbar",
- :offset_x => 2,
- :offset_y => 2,
- :offset_width => 0,
- :offset_height => 0,
- :opacity => 120
- },
- :help => {
- :windowskin => "Window_Shadow_Default",
- :offset_x => 2,
- :offset_y => 2,
- :offset_width => 0,
- :offset_height => 0,
- :opacity => 120
- },
- }
复制代码
Installation
- Copy the script to an open slot below ▼ Materials but above ▼ Main
- If using Hammy FF9 Windowskin System, place this script BELOW the Windowskin System script
- Ensure your shadow windowskin graphics are saved in Graphics/System with the names defined in the configuration
Compatibility
This script is made strictly for RPG Maker VX Ace. It is highly unlikely that it will run with RPG Maker VX without adjusting.
License
MIT License - Free for commercial and non-commercial use.
Credits
No credits are required.
Why VX Ace?
You might wonder why I'm still making scripts for VX Ace instead of MV/MZ. The answer is simple: Ruby is pure beauty, while JavaScript is a terrible language. Ruby's elegant syntax, intuitive design, and expressive power make scripting a joy. JavaScript, on the other hand, is a chaotic mess of inconsistencies and quirks that I simply despise.
I work with RPG Maker VX Ace for my own game project, and I share the scripts I create with the community. If you're still using VX Ace, you're in good company!
Download
Script:Download from GitHub
Demo:Download from GitHub
YEA System Options Addon
This addon extends Yanfly's System Options script to include window shadow enable/disable functionality directly in the system options menu. Players can toggle window shadows on and off without using script calls.
Features:
- Window shadows toggle command in System Options menu
- Automatic detection of Global System Option script presence
- Configurable command insertion position via anchor system
Requirements:
Installation: Place this addon script BELOW both YEA-SystemOptions and the Window Shadows System.
Download:Download from GitHub
Spoiler: Addon Code
Ruby: - # encoding: utf-8
- #==============================================================================
- # ▼ Hammy - Window Shadows - YEA System Options Addon v1.01
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # -- Last Updated: 25.05.2026
- # -- Requires: Hammy Window Shadows v1.01+,
- # YEA-SystemOptions v1.00
- # -- Optional: Theolized - Global System Option v1.00
- # -- Recommended: None
- # -- Credits: Yanfly (YEA-SystemOptions),
- # Theo Allen (Global System Option)
- # -- License: MIT License
- #==============================================================================
- $imported ||= {}
- $imported[:hammy_window_shadows_system_options] = true
- #==============================================================================
- # ▼ Updates
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 25.05.2026 - (v1.01) Applied new documentation conventions.
- # Migrated configuration modules to Hammy::PascalCase naming.
- #
- # 23.10.2025 - (v1.00) Initial release.
- #
- #==============================================================================
- # ▼ Introduction
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # This addon extends the Yanfly System Options script to include window shadow
- # enable/disable functionality for the Hammy Window Shadows System. It
- # provides seamless integration with the system options menu, allowing players
- # to toggle window shadows directly from the game's options screen.
- #
- # The addon automatically detects whether Theo's Global System Option script is
- # present and adapts its save behavior accordingly, supporting both standard
- # save file storage and global options storage.
- #
- # -----------------------------------------------------------------------------
- # ► Core Integration Features
- # -----------------------------------------------------------------------------
- # ★ Window shadows toggle command in System Options menu
- # ★ Automatic detection of Global System Option script presence
- # ★ Configurable command insertion position via anchor system
- #
- #==============================================================================
- # ▼ Base Classes & Method Modifications
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # This script modifies the following RGSS3 base classes:
- #
- # -----------------------------------------------------------------------------
- # ► Game_System (Class)
- # -----------------------------------------------------------------------------
- # ★ Added Getters/Setters:
- # - window_shadows
- # - window_shadows=
- #
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # This script modifies the following 3rd party classes:
- #
- # -----------------------------------------------------------------------------
- # ► OptionData (Class)
- # -----------------------------------------------------------------------------
- # ★ Public Instance Variables:
- # - window_shadows (attr_accessor)
- #
- # ★ Alias Methods:
- # - initialize → window_shadows_optiondata_initialize
- #
- # -----------------------------------------------------------------------------
- # ► Window_SystemOptions (Class < Window_Command)
- # -----------------------------------------------------------------------------
- # ★ Alias Methods:
- # - draw_item → window_shadows_win_sysopt_draw_item
- # - cursor_change → window_shadows_win_sysopt_cursor_change
- # - make_command_list → window_shadows_win_sysopt_make_comm_list
- #
- #==============================================================================
- # ▼ Instructions
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
- #
- # ★ This script requires Yanfly - YEA-SystemOptions and Hammy - Window Shadows
- # and must be placed BELOW them.
- #
- # ★ If using Theolized Global System Option v1.0, window shadow preferences
- # will be saved globally across all save files.
- #
- #==============================================================================
- # ▼ Compatibility
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
- # it will run with RPG Maker VX without adjusting.
- #
- #==============================================================================
- #==============================================================================
- # ** Window Shadows Configuration
- #------------------------------------------------------------------------------
- # Configuration settings for the Window Shadows system.
- #==============================================================================
- module Hammy
- module WindowShadows
-
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - System Options Anchor -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Configure the insertion position for the window shadows command in the
- # System Options menu. The command will be inserted after the specified
- # anchor command.
- #
- # WINDOW_SHADOWS_INSERT_ANCHOR: Symbol of the anchor command.
- # - Valid values: Symbol representing a command in System Options
- # - Default: :window_blu
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- WINDOW_SHADOWS_INSERT_ANCHOR = :window_blu
-
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - Command Vocabulary -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Configure the display text and help information for the window shadows
- # toggle command in the System Options menu.
- #
- # WINDOW_SHADOWS_VOCAB: Hash containing command text and help description.
- # [0] = Command name, [1] = Off text, [2] = On text, [3] = Help text
- # - Valid values: Hash with Symbol key and Array of Strings
- # - Default: { :window_shadows => [...] }
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- WINDOW_SHADOWS_VOCAB = {
- :window_shadows => ["Window Shadows", "Off", "On",
- "Enable or disable window shadows.\n" \
- "Shadows add visual depth to windows."
- ]
- }
-
- #==========================================================================
- # ▼ End of Documentation
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # This marks the end of the documentation and configuration section.
- # Everything below this point is the actual script implementation code.
- #
- # WARNING: Modifying the code below requires advanced Ruby and RGSS3
- # knowledge. Improper changes may cause script errors, game crashes, or
- # data corruption. Only edit if you understand the consequences and have
- # backups of your project.
- #==========================================================================
-
- #--------------------------------------------------------------------------
- # * Merge Window Shadows Vocabulary [Custom]
- #--------------------------------------------------------------------------
- if $imported["YEA-SystemOptions"]
- YEA::SYSTEM::COMMAND_VOCAB.merge!(WINDOW_SHADOWS_VOCAB)
- end
-
- end # Hammy::WindowShadows
- end # Hammy
- #==============================================================================
- # ▼ Script Dependencies Check
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # This section checks for the presence of required companion scripts.
- # If any required scripts are missing, it displays an error message and exits.
- #==============================================================================
- unless $imported["YEA-SystemOptions"]
- msgbox("YEA-SystemOptions v1.00 by Yanfly is required but not found!\n" \
- "Please install the required script before using " \
- "Window Shadows - System Options Addon.")
- exit
- end
- unless $imported[:hammy_window_shadows]
- msgbox("Hammy Window Shadows v1.00 is required but not found!\n" \
- "Please install the required script before using " \
- "Window Shadows - System Options Addon.")
- exit
- end
- #==============================================================================
- # ** OptionData
- #------------------------------------------------------------------------------
- # This class handles global system option data. It saves option preferences
- # globally across all save files when using Theo's Global System Option.
- #==============================================================================
- if $imported[:Theo_GlobalOption]
- class OptionData
- #--------------------------------------------------------------------------
- # * Public Instance Variables [Custom]
- #--------------------------------------------------------------------------
- attr_accessor :window_shadows
-
- #--------------------------------------------------------------------------
- # * Alias Method Definitions [Custom]
- #--------------------------------------------------------------------------
- alias_method :window_shadows_optiondata_initialize, :initialize
-
- #--------------------------------------------------------------------------
- # * Object Initialization [Alias]
- #--------------------------------------------------------------------------
- def initialize
- window_shadows_optiondata_initialize
- @window_shadows = true
- end
-
- end # OptionData
- end # if $imported[:Theo_GlobalOption]
- #==============================================================================
- # ** Game_System
- #------------------------------------------------------------------------------
- # This class handles system data. It saves the disable state of saving and
- # menus. Instances of this class are referenced by $game_system.
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # * Get Window Shadows Setting [Custom]
- #--------------------------------------------------------------------------
- def window_shadows
- if $imported[:Theo_GlobalOption]
- return $option_data.window_shadows
- else
- return @window_shadows
- end
- end
-
- #--------------------------------------------------------------------------
- # * Set Window Shadows Setting [Custom]
- #--------------------------------------------------------------------------
- def window_shadows=(value)
- if $imported[:Theo_GlobalOption]
- $option_data.window_shadows = value
- OptionData.save
- else
- @window_shadows = value
- end
- end
-
- end # Game_System
- #==============================================================================
- # ** Window_SystemOptions
- #------------------------------------------------------------------------------
- # This window displays system options on the options screen.
- #==============================================================================
- class Window_SystemOptions < Window_Command
- #--------------------------------------------------------------------------
- # * Alias Method Definitions [Custom]
- #--------------------------------------------------------------------------
- alias_method :window_shadows_win_sysopt_draw_item, :draw_item
- alias_method :window_shadows_win_sysopt_cursor_change, :cursor_change
- alias_method :window_shadows_win_sysopt_make_comm_list, :make_command_list
-
- #--------------------------------------------------------------------------
- # * Create Command List [Alias]
- #--------------------------------------------------------------------------
- def make_command_list
- window_shadows_win_sysopt_make_comm_list
- inject_window_shadows_command
- end
-
- #--------------------------------------------------------------------------
- # * Inject Window Shadows Command [Custom]
- #--------------------------------------------------------------------------
- def inject_window_shadows_command
- anchor_index = @list.find_index { |item|
- item[:symbol] == Hammy::WindowShadows::WINDOW_SHADOWS_INSERT_ANCHOR
- }
-
- if anchor_index
- insert_index = anchor_index + 1
- else
- insert_index = @list.size
- end
-
- vocab = YEA::SYSTEM::COMMAND_VOCAB
-
- window_shadows_command = {
- :name => vocab[:window_shadows][0],
- :symbol => :window_shadows,
- :enabled => true,
- :ext => nil
- }
-
- @list.insert(insert_index, window_shadows_command)
- @help_descriptions[:window_shadows] = vocab[:window_shadows][3]
- end
-
- #--------------------------------------------------------------------------
- # * Draw Item [Alias]
- #--------------------------------------------------------------------------
- def draw_item(index)
- if @list[index][:symbol] == :window_shadows
- reset_font_settings
- rect = item_rect(index)
- contents.clear_rect(rect)
- draw_window_shadows_toggle(rect, index, @list[index][:symbol])
- else
- window_shadows_win_sysopt_draw_item(index)
- end
- end
-
- #--------------------------------------------------------------------------
- # * Draw Window Shadows Toggle [Custom]
- #--------------------------------------------------------------------------
- def draw_window_shadows_toggle(rect, index, symbol)
- name = @list[index][:name]
- draw_text(0, rect.y, contents.width / 2, line_height, name, 1)
-
- enabled = $game_system.window_shadows
-
- dx = contents.width / 2
- change_color(normal_color, !enabled)
- option1 = YEA::SYSTEM::COMMAND_VOCAB[symbol][1]
- draw_text(dx, rect.y, contents.width / 4, line_height, option1, 1)
-
- dx += contents.width / 4
- change_color(normal_color, enabled)
- option2 = YEA::SYSTEM::COMMAND_VOCAB[symbol][2]
- draw_text(dx, rect.y, contents.width / 4, line_height, option2, 1)
- end
-
- #--------------------------------------------------------------------------
- # * Process Cursor Move [Alias]
- #--------------------------------------------------------------------------
- def cursor_change(direction)
- if current_symbol == :window_shadows
- change_window_shadows_toggle(direction)
- else
- window_shadows_win_sysopt_cursor_change(direction)
- end
- end
-
- #--------------------------------------------------------------------------
- # * Change Window Shadows Toggle [Custom]
- #--------------------------------------------------------------------------
- def change_window_shadows_toggle(direction)
- value = direction == :left ? false : true
- current_case = $game_system.window_shadows
-
- $game_system.window_shadows = value
-
- Sound.play_cursor if value != current_case
- draw_item(index)
- end
-
- end # Window_SystemOptions
- #==============================================================================
- #
- # ▼ End of File
- #
- #==============================================================================
复制代码
本贴来自国际rpgmaker官方论坛作者:buddysievers处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/hammy-window-shadows.180665/