Black_Mage icon

Custom Position Message Box RMMV

Black_Mage | PRO | 07/06/22 04:13:58 PM UTC (Edited) | 0 ⭐ | 2546 👁️ | Never ⏰ | []
JavaScript |

4.68 KB

|

None

|

0 👍

/

0 👎

//=============================================================================
// Black Message Box
//=============================================================================
 
//=============================================================================
/*:
 * @plugindesc Enable a way to manually set stuff regarding message window position.
 *
 * @author Black Mage
 *
 * @help
 * ============================================================================
 * How To Use
 * ============================================================================
 * Put this on script call to enable the plugin.
 *      black_custom_window = true
 * Set it to false to disable it.
 *
 * Put this on script call and change "VALUE" to set the X position of the 
 * message box.
 *      black_custom_window_x = VALUE
 *
 * Put this on script call and change "VALUE" to set the Y position of the 
 * message box.
 *      black_custom_window_y = VALUE
 *
 * Put this on script call and change "VALUE" to set the Y position of the 
 * number input box.
 *      black_custom_number_y = VALUE
 *
 * Put this on script call and change "VALUE" to set the height of the
 * choices inside the choice box.
 *      black_cust_choice_height = VALUE
 *
 * Put this on script call and change "VALUE" to set the height of the
 * choice box.
 *      black_cust_choice_box_height = VALUE
 *
 * Put this on script call and change "VALUE" to set the X position of the
 * choice box.
 *      black_cust_choice_x = VALUE
 *
 * Put this on script call and change "VALUE" to set the Y position of the
 * choice box.
 *      black_cust_choice_y = VALUE
 *
 * ============================================================================
 * Changelog
 * ============================================================================
 *
 * Version 2.0 (2021 - 09 - 04)
 * - Add command to change Y position of number input box.
 * - Add command to change height of choices.
 * - add command to change choice box height.
 * - add command to change choice box X and Y position.
 *
 * Version 1.0 (2016 - 01 - 09)
 * - Initial Design
 */
//=============================================================================
 
black_custom_window = false;
black_custom_window_y = this._positionType * (Graphics.boxHeight - this.height) / 2;
black_custom_window_x = 0;
black_custom_number_y = 0;
black_cust_choice_height = 40;
black_cust_choice_box_height = 200;
black_cust_choice_x = 0;
black_cust_choice_y = 0;
 
Window_Message.prototype.updatePlacement = function() {
    this._positionType = $gameMessage.positionType();
    if (!black_custom_window){
        this.y = this._positionType * (Graphics.boxHeight - this.height) / 2;
    } else {
        this.y = black_custom_window_y;
        this.x = black_custom_window_x;
    }
    this._goldWindow.y = this.y > 0 ? 0 : Graphics.boxHeight - this._goldWindow.height;
};
 
Window_NumberInput.prototype.updatePlacement = function() {
    var messageY = this._messageWindow.y;
    var spacing = 8;
    this.width = this.windowWidth();
    this.height = this.windowHeight();
    this.x = ((Graphics.boxWidth - this.width) / 2) - 100;
    if (!black_custom_window){
        if (messageY >= Graphics.boxHeight / 2) {
            this.y = messageY - this.height - spacing;
        } else {
            this.y = messageY + this._messageWindow.height + spacing;
        }
    } else {
        this.y = black_custom_number_y
    }
};
 
Window_NumberInput.prototype.placeButtons = function() {
    var numButtons = this._buttons.length;
    var spacing = 16;
    var totalWidth = -spacing;
    for (var i = 0; i < numButtons; i++) {
        totalWidth += this._buttons[i].width + spacing;
    }
    var x = (this.width - totalWidth) / 2;
    for (var j = 0; j < numButtons; j++) {
        var button = this._buttons[j];
        button.x = x+200;
        button.y = 20//this.buttonY();
        x += button.width + spacing;
    }
};
 
Window_ChoiceList.prototype.itemHeight = function() {
    return black_cust_choice_height;
};
 
Window_ChoiceList.prototype.updatePlacement = function() {
    var positionType = $gameMessage.choicePositionType();
    var messageY = this._messageWindow.y;
    this.width = this.windowWidth();
    if (!black_custom_window){  
        this.height = this.windowHeight();
        switch (positionType) {
        case 0:
            this.x = 0;
            break;
        case 1:
            this.x = (Graphics.boxWidth - this.width) / 2;
            break;
        case 2:
            this.x = Graphics.boxWidth - this.width;
            break;
        }
        if (messageY >= Graphics.boxHeight / 2) {
            this.y = messageY - this.height;
        } else {
            this.y = messageY + this._messageWindow.height;
        }
    } else {
        this.height = black_cust_choice_box_height;
        this.x = black_cust_choice_x;
        this.y = black_cust_choice_y;
    }
};

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎