Black_Mage

Custom Position Message Box RMMV

Jan 9th, 2016 (edited)
2,080
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Black Message Box
  3. //=============================================================================
  4.  
  5. //=============================================================================
  6. /*:
  7.  * @plugindesc Enable a way to manually set stuff regarding message window position.
  8.  *
  9.  * @author Black Mage
  10.  *
  11.  * @help
  12.  * ============================================================================
  13.  * How To Use
  14.  * ============================================================================
  15.  * Put this on script call to enable the plugin.
  16.  *      black_custom_window = true
  17.  * Set it to false to disable it.
  18.  *
  19.  * Put this on script call and change "VALUE" to set the X position of the
  20.  * message box.
  21.  *      black_custom_window_x = VALUE
  22.  *
  23.  * Put this on script call and change "VALUE" to set the Y position of the
  24.  * message box.
  25.  *      black_custom_window_y = VALUE
  26.  *
  27.  * Put this on script call and change "VALUE" to set the Y position of the
  28.  * number input box.
  29.  *      black_custom_number_y = VALUE
  30.  *
  31.  * Put this on script call and change "VALUE" to set the height of the
  32.  * choices inside the choice box.
  33.  *      black_cust_choice_height = VALUE
  34.  *
  35.  * Put this on script call and change "VALUE" to set the height of the
  36.  * choice box.
  37.  *      black_cust_choice_box_height = VALUE
  38.  *
  39.  * Put this on script call and change "VALUE" to set the X position of the
  40.  * choice box.
  41.  *      black_cust_choice_x = VALUE
  42.  *
  43.  * Put this on script call and change "VALUE" to set the Y position of the
  44.  * choice box.
  45.  *      black_cust_choice_y = VALUE
  46.  *
  47.  * ============================================================================
  48.  * Changelog
  49.  * ============================================================================
  50.  *
  51.  * Version 2.0 (2021 - 09 - 04)
  52.  * - Add command to change Y position of number input box.
  53.  * - Add command to change height of choices.
  54.  * - add command to change choice box height.
  55.  * - add command to change choice box X and Y position.
  56.  *
  57.  * Version 1.0 (2016 - 01 - 09)
  58.  * - Initial Design
  59.  */
  60. //=============================================================================
  61.  
  62. black_custom_window = false;
  63. black_custom_window_y = this._positionType * (Graphics.boxHeight - this.height) / 2;
  64. black_custom_window_x = 0;
  65. black_custom_number_y = 0;
  66. black_cust_choice_height = 40;
  67. black_cust_choice_box_height = 200;
  68. black_cust_choice_x = 0;
  69. black_cust_choice_y = 0;
  70.  
  71. Window_Message.prototype.updatePlacement = function() {
  72.     this._positionType = $gameMessage.positionType();
  73.     if (!black_custom_window){
  74.         this.y = this._positionType * (Graphics.boxHeight - this.height) / 2;
  75.     } else {
  76.         this.y = black_custom_window_y;
  77.         this.x = black_custom_window_x;
  78.     }
  79.     this._goldWindow.y = this.y > 0 ? 0 : Graphics.boxHeight - this._goldWindow.height;
  80. };
  81.  
  82. Window_NumberInput.prototype.updatePlacement = function() {
  83.     var messageY = this._messageWindow.y;
  84.     var spacing = 8;
  85.     this.width = this.windowWidth();
  86.     this.height = this.windowHeight();
  87.     this.x = ((Graphics.boxWidth - this.width) / 2) - 100;
  88.     if (!black_custom_window){
  89.         if (messageY >= Graphics.boxHeight / 2) {
  90.             this.y = messageY - this.height - spacing;
  91.         } else {
  92.             this.y = messageY + this._messageWindow.height + spacing;
  93.         }
  94.     } else {
  95.         this.y = black_custom_number_y
  96.     }
  97. };
  98.  
  99. Window_NumberInput.prototype.placeButtons = function() {
  100.     var numButtons = this._buttons.length;
  101.     var spacing = 16;
  102.     var totalWidth = -spacing;
  103.     for (var i = 0; i < numButtons; i++) {
  104.         totalWidth += this._buttons[i].width + spacing;
  105.     }
  106.     var x = (this.width - totalWidth) / 2;
  107.     for (var j = 0; j < numButtons; j++) {
  108.         var button = this._buttons[j];
  109.         button.x = x+200;
  110.         button.y = 20//this.buttonY();
  111.         x += button.width + spacing;
  112.     }
  113. };
  114.  
  115. Window_ChoiceList.prototype.itemHeight = function() {
  116.     return black_cust_choice_height;
  117. };
  118.  
  119. Window_ChoiceList.prototype.updatePlacement = function() {
  120.     var positionType = $gameMessage.choicePositionType();
  121.     var messageY = this._messageWindow.y;
  122.     this.width = this.windowWidth();
  123.     if (!black_custom_window){ 
  124.         this.height = this.windowHeight();
  125.         switch (positionType) {
  126.         case 0:
  127.             this.x = 0;
  128.             break;
  129.         case 1:
  130.             this.x = (Graphics.boxWidth - this.width) / 2;
  131.             break;
  132.         case 2:
  133.             this.x = Graphics.boxWidth - this.width;
  134.             break;
  135.         }
  136.         if (messageY >= Graphics.boxHeight / 2) {
  137.             this.y = messageY - this.height;
  138.         } else {
  139.             this.y = messageY + this._messageWindow.height;
  140.         }
  141.     } else {
  142.         this.height = black_cust_choice_box_height;
  143.         this.x = black_cust_choice_x;
  144.         this.y = black_cust_choice_y;
  145.     }
  146. };
Add Comment
Please, Sign In to add comment