Nerine

Veteran
Veteran
Joined
Oct 3, 2020
Messages
40
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,414
Reaction score
1,823
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
40
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'm proud of what I have achieved with my project. Don't mind with the Spanish, Ill add more languages.
Our garage has been so full since moving we haven't been able to get our car in. Storm night before last (no hail), storms forecast for last night & today. I convinced hubby we should clean out the garage and we managed to get it done and get the car in. Hail last night! Just in time!
Taller RTP Characters, Rewrite Dialogues w/ AI, & Simple Event AI & Shooting | RPG Maker News #37


No water this time, just trying for a majestic cliffside... The cave snuck in because I liked it. Now I guess I need a mini cave map or "secret" for it. :kaoswt:

Forum statistics

Threads
111,278
Messages
1,059,845
Members
144,578
Latest member
rodeorodent
Top