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:
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:
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:
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:
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:
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:
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
本贴来自国际rpgmaker官方论坛作者:buddysievers处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/hammy-window-shadows.180665/