Nerine

Veteran
Veteran
Joined
Oct 3, 2020
Messages
34
Reaction score
15
First Language
Polish
Primarily Uses
RMMZ
Hello, I was wondering if there is a plugin that will allow to change the Window style(for all menus) to a different png file using plugin commands?
 

Tarzanthecat

(Meow)
Veteran
Joined
Jan 18, 2017
Messages
93
Reaction score
66
First Language
English
Primarily Uses
N/A
You can use the resource manager to import a custom window skin.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,370
Reaction score
1,779
First Language
EN
Primarily Uses
RMMZ
Use a different windowskin for a specific type of window, e.g. Window_Gold:
JavaScript:
Window_Gold.prototype.loadWindowskin = function() {
  this.windowskin = ImageManager.loadSystem('WindowGold');
};
Or, allow swapping the default windowskin mid-game via a Script command:
JavaScript:
/*:
 * @target MZ
 * @plugindesc Reassign the windowskin mid-game.
 * @author Caethyril
 * @help You can change the windowskin mid-game using a Script command, e.g.
 *    ChangeWindow.skin = 'Window2';
 * 
 * All windowskin images should be stored under img/system.
 * The default windowskin will be Window.png.
 * 
 * This plugin is written for RPG Maker MZ.
 */

($ => {
'use strict';

    // include skin name in save files under this identifier
    const SAVKEY = 'windowskin';

    // variable skin name
    Object.defineProperty($, 'skin', {
        get: ( ) => $._s ||= 'Window',
        set: (v) => { if ($._s !== v) $._s = v, refreshSkin(); },
        configurable: true
    });

    // refreshes active display elements
    let refreshSkin = function() {
        ColorManager.loadWindowskin();
        SceneManager._scene._windowLayer?.children.forEach(c => c.loadWindowskin?.());
    };

    // overrides to reference variable skin name
    ColorManager.loadWindowskin = function() {  // colour map (bottom-right)
        this._windowskin = ImageManager.loadSystem($.skin);
    };
    Window_Base.prototype.loadWindowskin = function() {  // window parts
        this.windowskin = ImageManager.loadSystem($.skin);
    };

    // alias to initialise skin name on new game
    void (alias => {
        DataManager.setupNewGame = function() {
            alias.apply(this, arguments), $.skin = '';
        };
    })(DataManager.setupNewGame);

    // alias to include skin name in save data
    void (alias => {
        DataManager.makeSaveContents = function() {
            const o = alias.apply(this, arguments);
            o[SAVKEY] = $.skin;
            return o;
        };
    })(DataManager.makeSaveContents);

    // alias to extract skin name from save data
    void (alias => {
        DataManager.extractSaveContents = function(contents) {
            alias.apply(this, arguments);
            $.skin = contents[SAVKEY];
        };
    })(DataManager.extractSaveContents);

})(window['ChangeWindow'] ||= {});
To use one of these:
  1. Copy the code into a text editor (e.g. Notepad),
  2. Save it as a .js file (Save As > File Type: All Files, Filename: whatever.js),
  3. Import via the Plugin Manager,
  4. Save your project to apply plugin changes,
  5. Test!
(Seems like both of these might be popular requests, so I'll make a note to include them in one of my plugins at some point~)
 

Nerine

Veteran
Veteran
Joined
Oct 3, 2020
Messages
34
Reaction score
15
First Language
Polish
Primarily Uses
RMMZ
Use a different windowskin for a specific type of window, e.g. Window_Gold:
JavaScript:
Window_Gold.prototype.loadWindowskin = function() {[/INDENT]
[INDENT]  this.windowskin = ImageManager.loadSystem('WindowGold');[/INDENT]
[INDENT]};
Or, allow swapping the default windowskin mid-game via a Script command:
JavaScript:
/*:[/INDENT]
[INDENT]* @target MZ[/INDENT]
[INDENT]* @plugindesc Reassign the windowskin mid-game.[/INDENT]
[INDENT]* @author Caethyril[/INDENT]
[INDENT]* @help You can change the windowskin mid-game using a Script command, e.g.[/INDENT]
[INDENT]*    ChangeWindow.skin = 'Window2';[/INDENT]
[INDENT]*[/INDENT]
[INDENT]* All windowskin images should be stored under img/system.[/INDENT]
[INDENT]* The default windowskin will be Window.png.[/INDENT]
[INDENT]*[/INDENT]
[INDENT]* This plugin is written for RPG Maker MZ.[/INDENT]
[INDENT]*/[/INDENT]
[INDENT][/INDENT]
[INDENT]($ => {[/INDENT]
[INDENT]'use strict';[/INDENT]
[INDENT][/INDENT]
[INDENT]    // include skin name in save files under this identifier[/INDENT]
[INDENT]    const SAVKEY = 'windowskin';[/INDENT]
[INDENT][/INDENT]
[INDENT]    // variable skin name[/INDENT]
[INDENT]    Object.defineProperty($, 'skin', {[/INDENT]
[INDENT]        get: ( ) => $._s ||= 'Window',[/INDENT]
[INDENT]        set: (v) => { if ($._s !== v) $._s = v, refreshSkin(); },[/INDENT]
[INDENT]        configurable: true[/INDENT]
[INDENT]    });[/INDENT]
[INDENT][/INDENT]
[INDENT]    // refreshes active display elements[/INDENT]
[INDENT]    let refreshSkin = function() {[/INDENT]
[INDENT]        ColorManager.loadWindowskin();[/INDENT]
[INDENT]        SceneManager._scene._windowLayer?.children.forEach(c => c.loadWindowskin?.());[/INDENT]
[INDENT]    };[/INDENT]
[INDENT][/INDENT]
[INDENT]    // overrides to reference variable skin name[/INDENT]
[INDENT]    ColorManager.loadWindowskin = function() {  // colour map (bottom-right)[/INDENT]
[INDENT]        this._windowskin = ImageManager.loadSystem($.skin);[/INDENT]
[INDENT]    };[/INDENT]
[INDENT]    Window_Base.prototype.loadWindowskin = function() {  // window parts[/INDENT]
[INDENT]        this.windowskin = ImageManager.loadSystem($.skin);[/INDENT]
[INDENT]    };[/INDENT]
[INDENT][/INDENT]
[INDENT]    // alias to initialise skin name on new game[/INDENT]
[INDENT]    void (alias => {[/INDENT]
[INDENT]        DataManager.setupNewGame = function() {[/INDENT]
[INDENT]            alias.apply(this, arguments), $.skin = '';[/INDENT]
[INDENT]        };[/INDENT]
[INDENT]    })(DataManager.setupNewGame);[/INDENT]
[INDENT][/INDENT]
[INDENT]    // alias to include skin name in save data[/INDENT]
[INDENT]    void (alias => {[/INDENT]
[INDENT]        DataManager.makeSaveContents = function() {[/INDENT]
[INDENT]            const o = alias.apply(this, arguments);[/INDENT]
[INDENT]            o[SAVKEY] = $.skin;[/INDENT]
[INDENT]            return o;[/INDENT]
[INDENT]        };[/INDENT]
[INDENT]    })(DataManager.makeSaveContents);[/INDENT]
[INDENT][/INDENT]
[INDENT]    // alias to extract skin name from save data[/INDENT]
[INDENT]    void (alias => {[/INDENT]
[INDENT]        DataManager.extractSaveContents = function(contents) {[/INDENT]
[INDENT]            alias.apply(this, arguments);[/INDENT]
[INDENT]            $.skin = contents[SAVKEY];[/INDENT]
[INDENT]        };[/INDENT]
[INDENT]    })(DataManager.extractSaveContents);[/INDENT]
[INDENT][/INDENT]
[INDENT]})(window['ChangeWindow'] ||= {});
To use one of these:
  1. Copy the code into a text editor (e.g. Notepad),
  2. Save it as a .js file (Save As > File Type: All Files, Filename: whatever.js),
  3. Import via the Plugin Manager,
  4. Save your project to apply plugin changes,
  5. Test!
(Seems like both of these might be popular requests, so I'll make a note to include them in one of my plugins at some point~)
Thank you.
 

Latest Threads

Latest Posts

Latest Profile Posts

I managed to review my previous lessons on Learn MV and fixed a lot of things. Yay! :kaopride:
I've decided "Attack on Equestria" should be released first... hence this new ARG channel! https://www.youtube.com/channel/UClKiUI8xOVx9dsF4kRXUmxw
Check it out, and subscribe! The ARG will lead up to the video game. It's not a creepy game, but I just thought it should follow ARG standards.
For anyone interested in my project M - i finally made a gamethread about it :D

Forum statistics

Threads
110,409
Messages
1,053,088
Members
143,474
Latest member
Arsyloth
Top