Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Number input maximum
- // by Astfgl
- // Date: 05/06/2017
- // Free to use both commercially and non commercially, no credits required.
- // Edits and redistribution allowed as long as kept under the same terms of use.
- // Do not remove this header, do not claim as your own.
- //=============================================================================
- /*:
- * @plugindesc Allows setting a maximum number to number input
- * @author Astfgl
- * @help To set a maximum use the following command:
- * $gameMessage.setNumInputMax(number)
- *
- * Ex: $gameMessage.setNumInputMax(100)
- *
- * To remove the maximum use the following command:
- * $gameMessage.removeNumInputMax();
- */
- (function(){
- var _Astfgl_newWNICD = Window_NumberInput.prototype.changeDigit
- Window_NumberInput.prototype.changeDigit = function(up) {
- _Astfgl_newWNICD.call(this,up);
- if (this._maxNumber) {
- if (this._number > this._maxNumber) {
- this._number = this._maxNumber;
- this.refresh();
- }
- }
- }
- Game_Message.prototype.setNumInputMax = function(max) {
- SceneManager._scene._messageWindow._numberWindow._maxNumber = max
- }
- Game_Message.prototype.removeNumInputMax= function() {
- delete SceneManager._scene._messageWindow._numberWindow._maxNumber
- }
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement