Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-----------------------------------------------------------------------------
- // Chapter Window by Makeratore
- // BEFORE INSTALLING THE PLUGIN, PLEASE MAKE SURE THAT THE PLUGIN FILE NAME IS "chapterWindow", OTHERWISE IT WON'T WORK!
- // This plugin provides a new simple window to display a text for a chapter name or whatever.
- //-----------------------------------------------------------------------------
- // For: RPG Maker MV
- // chapterWindow.js
- //-----------------------------------------------------------------------------
- // 15/07/2016 - Version 4.0 - Compatible with Galv's plugin
- // 07/07/2016 - Version 3.0 - Unified the gold window with the chapter window and added a new parameter for the background type
- // 30/06/2016 - Version 2.2 - Bug fix of play time
- // 30/06/2016 - Version 2.1 - Bug fix and added a parameter for the window position
- // 30/06/2016 - Version 2.0 - Adds new plugin commands and new icons
- // 29/06/2016 - Version 1.0 - Release
- //-----------------------------------------------------------------------------
- // TERMS AND CONDITIONS
- // You can use this plugin in commercial and non-commercial projects.
- // Please, provide credits to Makeratore.
- //
- // This plugin can be found at:
- // http://www.rpg2s.net/forum/
- //-----------------------------------------------------------------------------
- var Imported = Imported || {};
- Imported.chapterWindow = true;
- //-----------------------------------------------------------------------------
- /*:
- *
- * @plugindesc This plugin provides a new simple window to display a text for a chapter name or whatever. Version: 4.0
- *
- * @author Makeratore
- *
- * @param Additional text
- * @desc Insert here the first line of text to be displayed. Default: Chapter:.
- * @default Chapter:
- *
- * @param Initial chapter text
- * @desc This is the second line of text. Default: A new adventure.
- * @default A new adventure
- *
- * @param Use Icon
- * @desc Set this parameter to "true" or "false" if you want to display the first icon or not. Default: false.
- * @default false
- *
- * @param Use Icon 2
- * @desc Set this parameter to "true" or "false" if you want to display the second icon or not. Default: false.
- * @default false
- *
- * @param Use Icon 3
- * @desc Set this parameter to "true" or "false" if you want to display the third icon or not. Default: false.
- * @default false
- *
- * @param Icon
- * @desc Set the second icon. Insert a valid icon index number. Default: 79.
- * @default 79
- *
- * @param Icon 2
- * @desc Set the first icon. Insert a valid icon index number. Default: 87.
- * @default 87
- *
- * @param Icon 3
- * @desc Set a custom third icon for the play time. Insert a valid icon index number. Default: 83.
- * @default 83
- *
- * @param Font size
- * @desc Set a custom font size for the text. Default: 25.
- * @default 25
- *
- * @param Window position
- * @desc You can set a custom window position. Higher the number, higher the window will be. Default: 0
- * @default 0
- *
- * @param Background type
- * @desc Set a custom background type for the chapter window. It can be 1 or 0. Default: 0
- * @default 0
- *
- * @param Use with Galv's plugin
- * @desc If you're also using the Galv's plugin, set this parameter to true. Default: false
- * @default false
- *
- * @param Single text
- * @desc If you're using the Galv's plugin, write here the text. Default: text
- * @default text
- *
- * @help TERMS AND CONDITIONS
- * You can use this plugin in commercial and non-commercial projects.
- * Please, provide credits to Makeratore.
- *
- * BEFORE INSTALLING THE PLUGIN, PLEASE MAKE SURE THAT THE
- * PLUGIN FILE NAME IS "chapterWindow", OTHERWISE IT WON'T WORK!
- *
- * INSTRUCTIONS
- * There are 12 plugin commands.
- * - "changeAdditionalText X": changes the first line of text.
- * Set X to a text to be displayed.
- * - "changeAdditionalTextIcon X": changes the icon for the first line of text.
- * Set X to a valid icon index number.
- * - "changeChapterUseIcon X": makes the first icon display or not.
- * Set X to "true" or "false".
- * - "changeChapterName X": changes the second line of text.
- * Change X to a text to be displayed.
- * - "changeChapterIcon X": changes the second icon.
- * Change X to a valid icon index number.
- * -"changeUseIcon2 X": makes the second icon display or not.
- * Set X to "true" or "false".
- * - "changeIcon3 X": changes the third icon
- * Set X to a valid icon index number.
- * - "changeUseIcon3 X": makes the third icon display or not.
- * Set X to "true" or "false".
- * - "changeFontSize X": changes the font size for the text.
- * Set X to a custom number to change the size.
- * -"changeChapterWindowPosition X": changes the chapter window position.
- * Higher the number, higher the window will be. Set X to a custom number.
- * -"changeChapterBackgroundType X": changes the window background type.
- * Set X to 1 or 0.
- * -"changeChapterSingleText X": type here the text to be displayed.
- * Set X to the text you want.
- *
- */
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- // Code
- //-----------------------------------------------------------------------------
- (function() {
- var parameters = PluginManager.parameters('chapterWindow');
- var additionalText = String(parameters['Additional text']);
- var chapterName = String(parameters['Initial chapter text']);
- var iconIndex = Number(parameters['Icon']);
- var iconAdditionalText = Number(parameters['Icon 2']);
- var icon3 = Number(parameters['Icon 3']);
- var useIcon = String(parameters['Use Icon']).trim() == "true";
- var useIcon2 = String(parameters['Use Icon 2']).trim() == "true";
- var useIcon3 = String(parameters['Use Icon 3']).trim() == "true";
- var fontSize = Number(parameters['Font size']);
- var windowPosition = Number(parameters['Window position']);
- var varBackgroundType = Number(parameters['Background type']);
- var useGalvPlugin = String(parameters["Use with Galv's plugin"]).trim() == "true";
- var singleText = String(parameters['Single text']);
- var textHere = chapterName;
- var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
- Game_Interpreter.prototype.pluginCommand = function(command, args) {
- _Game_Interpreter_pluginCommand.call(this, command, args);
- if(command == "changeChapterName") {
- textHere = "";
- for(i = 0; i < args.length; i++) {
- textHere += String(args[i]);
- textHere += " ";
- }
- } else if (command == "changeChapterIcon") {
- iconIndex = Number(args);
- } else if (command == "changeChapterUseIcon") {
- useIcon = String(args).trim() == "true";
- } else if (command == "changeFontSize") {
- fontSize = Number(args);
- } else if (command == "changeAdditionalText") {
- additionalText = "";
- for(i = 0; i < args.length; i++) {
- additionalText += String(args[i]);
- additionalText += " ";
- }
- } else if (command == "changeAdditionalTextIcon") {
- iconAdditionalText = Number(args);
- } else if (command == "changeUseIcon2") {
- useIcon2 = String(args).trim() == "true";
- } else if (command == "changeUseIcon3") {
- useIcon3 = String(args).trim() == "true";
- } else if (command == "changeIcon3") {
- icon3 = Number(args);
- } else if (command == "changeChapterWindowPosition") {
- windowPosition = Number(args);
- } else if (command == "changeChapterBackgroundType") {
- varBackgroundType = Number(args);
- } else if (command == "changeChapterSingleText") {
- singleText = "";
- for (i = 0; i < args.length; i++) {
- singleText += String(args[i]);
- singleText += " ";
- }
- }
- };
- Window_MenuStatus.prototype.windowHeight = function() {
- if (!useGalvPlugin) {
- return Graphics.boxHeight;
- } else {
- return Graphics.boxHeight - 70;
- }
- };
- function Window_Chapter() {
- this.initialize.apply(this, arguments);
- }
- Window_Chapter.prototype = Object.create(Window_Base.prototype);
- Window_Chapter.prototype.constructor = Window_Chapter;
- Window_Chapter.prototype.initialize = function(x, y) {
- var width = this.windowWidth();
- var height = this.windowHeight();
- Window_Base.prototype.initialize.call(this, x, y, width, height);
- this.setBackgroundType(varBackgroundType);
- this.refresh();
- };
- Window_Chapter.prototype.windowWidth = function() {
- if (!useGalvPlugin) {
- return 240
- } else {
- return Graphics.boxWidth;
- }
- };
- Window_Chapter.prototype.windowHeight = function() {
- if (!useGalvPlugin) {
- return 170;
- } else {
- return 70;
- }
- };
- Window_Chapter.prototype.standardFontSize = function() {
- return fontSize;
- };
- Window_Chapter.prototype.value = function() {
- return $gameParty.gold();
- };
- Window_Chapter.prototype.currencyUnit = function() {
- return TextManager.currencyUnit;
- };
- Window_Chapter.prototype.refresh = function() {
- var x = this.textPadding();
- var width = this.contents.width - this.textPadding() * 2;
- this.contents.clear();
- if (!useGalvPlugin) {
- if (useIcon) {
- this.drawIcon(iconAdditionalText, 0, 0);
- this.drawTextEx(additionalText, 40, 0);
- } else if (!useIcon) {
- this.drawTextEx(additionalText, 0, 0);
- }
- if (useIcon2) {
- this.drawIcon(iconIndex, 0, 35);
- this.drawTextEx(textHere, 40, 35);
- } else if(!useIcon2) {
- this.drawTextEx(textHere, 0, 35);
- }
- if (useIcon3) {
- this.drawIcon(icon3, 0, 70);
- this.drawTextEx($gameSystem.playtimeText(), 40, 70);
- } else if (!useIcon3) {
- this.drawTextEx($gameSystem.playtimeText(), 0, 70);
- }
- this.drawCurrencyValue(this.value(), this.currencyUnit(), x, 100, width);
- } else {
- if (useIcon) {
- this.drawIcon(iconAdditionalText, 0, 0);
- this.drawTextEx(singleText, 40, 0);
- } else if (!useIcon) {
- this.drawTextEx(singleText, 0, 0);
- }
- if (useIcon3) {
- this.drawIcon(icon3, Graphics.boxWidth / 2 - 40, 0);
- this.drawTextEx($gameSystem.playtimeText(), Graphics.boxWidth / 2, 0);
- } else if (!useIcon3) {
- this.drawTextEx($gameSystem.playtimeText(), Graphics.boxWidth / 2, 0);
- }
- this.drawCurrencyValue(this.value(), this.currencyUnit(), x, 0, width);
- }
- };
- // Window_Chapter.prototype.refresh = function() {
- // var x = this.textPadding();
- // var width = this.contents.width - this.textPadding() * 2;
- // this.contents.clear();
- // if (useIcon) {
- // this.drawIcon(iconAdditionalText, 0, 0);
- // this.drawTextEx(additionalText, 40, 0);
- // } else if (!useIcon) {
- // this.drawTextEx(additionalText, 0, 0);
- // }
- // if (useIcon2) {
- // this.drawIcon(iconIndex, 0, 35);
- // this.drawTextEx(textHere, 40, 35);
- // } else if(!useIcon2) {
- // this.drawTextEx(textHere, 0, 35);
- // }
- // if (useIcon3) {
- // this.drawIcon(icon3, 0, 70);
- // this.drawTextEx($gameSystem.playtimeText(), 40, 70);
- // } else if (!useIcon3) {
- // this.drawTextEx($gameSystem.playtimeText(), 0, 70);
- // }
- // this.drawCurrencyValue(this.value(), this.currencyUnit(), x, 100, width);
- // };
- Window_Chapter.prototype.open = function() {
- this.refresh();
- Window_Base.prototype.open.call(this);
- };
- Scene_Menu.prototype.create = function() {
- Scene_MenuBase.prototype.create.call(this);
- this.createCommandWindow();
- this.createStatusWindow();
- this.createChapterWindow();
- };
- var _Scene_Menu_update = Scene_Menu.prototype.update;
- Scene_Menu.prototype.update = function() {
- _Scene_Menu_update.call(this);
- this._chapterWindow.refresh();
- };
- Scene_Menu.prototype.createChapterWindow = function() {
- this._chapterWindow = new Window_Chapter(0, 0);
- this._chapterWindow.y = Graphics.boxHeight - this._chapterWindow.height - windowPosition;
- this.addWindow(this._chapterWindow);
- };
- })();
- //-----------------------------------------------------------------------------
- // End of plugin
- //-----------------------------------------------------------------------------
Add Comment
Please, Sign In to add comment