Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*:
- * @plugindesc Plugin used to disable dashing & stuff.
- * <DSI Limited Dash>
- * @author dsiver144
- *
- * @help Last Updated: 1/27/2018
- * Maybe you don't need help for this plugin, lol. Just play around with those
- * variables.
- *
- * @param HudMain
- * @text HUD Settings
- *
- * @param HudDisable
- * @text Disable HUD
- * @type boolean
- * @on Enable
- * @off Disable
- * @parent HudMain
- *
- * @param HudDisableSwitch
- * @text HUD Disable Switch
- * @type switch
- * @default 9
- * @parent HudMain
- *
- * @param hudX
- * @text HUD X
- * @type number
- * @default 5
- * @parent HudMain
- *
- * @param hudY
- * @text HUD Y
- * @type number
- * @default 5
- * @parent HudMain
- *
- * @param hudText
- * @text HUD Text
- * @default Stamina
- * @parent HudMain
- *
- * @param hudGaugeColor1
- * @text HUD Gauge Color 1
- * @default #F7B646
- * @parent HudMain
- * @param hudGaugeColor2
- * @text HUD Gauge Color 2
- * @default #DA8A3B
- * @parent HudMain
- *
- * @param MainSettings
- * @text Main Settings
- *
- * @param defaultMaxStamina
- * @text Set Default Max Stamina
- * @default 100
- * @parent MainSettings
- *
- * @param maxStaminaVariable
- * @text Set Max Stamina Variable ID
- * @type variable
- * @default 10
- * @parent MainSettings
- *
- * @param currentStaminaVariable
- * @text Set Current Stamina Variable ID
- * @type variable
- * @default 11
- * @parent MainSettings
- *
- * @param StaminaTimer
- * @text Set Stamina Timer
- * @default 10
- * @parent MainSettings
- *
- * @param BurnAmount
- * @text Set Burn Amount
- * @default 5
- * @parent MainSettings
- *
- * @param RecoverAmount
- * @text Set Recover Amount
- * @default 1
- * @parent MainSettings
- *
- * @param disableDashSwitchID
- * @text Set Switch for disable dash
- * @type switch
- * @default 10
- * @parent MainSettings
- */
- var DSIVER144 = DSIVER144 || {};
- var params = $plugins.filter(function(p) { return p.description.contains('<DSI Limited Dash>'); })[0].parameters;
- DSIVER144.maxStamina = Number(params['defaultMaxStamina'] || 100);
- DSIVER144.maxStaminaVarID = Number(params['maxStaminaVariable'] || 10);
- DSIVER144.curStaminaVarID = Number(params['currentStaminaVariable'] || 11);
- DSIVER144.staminaTimer = Number(params['StaminaTimer'] || 10);
- DSIVER144.burnAmount = Number(params['BurnAmount'] || 5);
- DSIVER144.recoverAmount = Number(params['RecoverAmount'] || 1);
- DSIVER144.disableDashSwID = Number(params['disableDashSwitchID'] || 10);
- DSIVER144.hudX = Number(params['hudX']);
- DSIVER144.hudY = Number(params['hudY']);
- DSIVER144.hudText = params['hudText'];
- DSIVER144.hudColor1 = params['hudGaugeColor1'];
- DSIVER144.hudColor2 = params['hudGaugeColor2'];
- DSIVER144.hudDisable = params['HudDisable'];
- DSIVER144.hudDisableSwitch = Number(params['HudDisableSwitch']);
- console.log(DSIVER144);
- (function(dsi){
- //function Window_DashStamina
- var dashWindow;
- function Window_DashStamina() {
- this.initialize.apply(this, arguments);
- }
- Window_DashStamina.prototype = Object.create(Window_Base.prototype);
- Window_DashStamina.prototype.constructor = Window_DashStamina;
- Window_DashStamina.prototype.initialize = function(x, y) {
- var width = this.windowWidth();
- var height = this.windowHeight();
- Window_Base.prototype.initialize.call(this, x, y, width, height);
- this.refresh();
- };
- Window_DashStamina.prototype.windowWidth = function() {
- return 300;
- };
- Window_DashStamina.prototype.windowHeight = function() {
- return this.fittingHeight(1);
- };
- Window_DashStamina.prototype.refresh = function() {
- var x = this.textPadding();
- var width = this.contents.width - this.textPadding() * 2;
- this.contents.clear();
- if ($gameSwitches.value(dsi.hudDisableSwitch) === true) {
- this.hide();
- return;
- } else {
- this.show();
- }
- var color1 = dsi.hudColor1;
- var color2 = dsi.hudColor2;
- this.contents.fontSize = 19;
- var rate = $gameVariables.value(dsi.curStaminaVarID) / $gameVariables.value(dsi.maxStaminaVarID);
- this.drawGauge(0,0,width,rate,color1,color2);
- this.drawText((rate * 100).toFixed(0) + '%',0,-7, width, 'right');
- this.drawText(dsi.hudText,0,-7,width, 'left');
- };
- var _alias_Scene_Map_createAllWindows = Scene_Map.prototype.createAllWindows;
- Scene_Map.prototype.createAllWindows = function() {
- _alias_Scene_Map_createAllWindows.call(this);
- if (dsi.hudDisable !== 'true')
- this.createDashStaminaWindow();
- };
- Scene_Map.prototype.createDashStaminaWindow = function() {
- this._staminaWindow = new Window_DashStamina(dsi.hudX,dsi.hudY);
- dashWindow = this._staminaWindow;
- this.addChild(this._staminaWindow);
- };
- var _alias_Game_Player_initMembers = Game_Player.prototype.initMembers;
- Game_Player.prototype.initMembers = function() {
- _alias_Game_Player_initMembers.call(this);
- $gameVariables.setValue(dsi.maxStaminaVarID, dsi.maxStamina);
- $gameVariables.setValue(dsi.curStaminaVarID, dsi.maxStamina);
- this._canDash = true;
- this._dashDelayTime = dsi.staminaTimer;
- };
- Game_Player.prototype.updateDashing = function() {
- if (this._dashing === true && this.isMoving()) {
- if ($gameVariables.value(dsi.curStaminaVarID) > 0) {
- if (this._dashDelayTime === 0) {
- $gameVariables.setValue(dsi.curStaminaVarID, $gameVariables.value(dsi.curStaminaVarID) - dsi.burnAmount);
- this._dashDelayTime = dsi.staminaTimer;
- console.log($gameVariables.value(dsi.curStaminaVarID));
- if ($gameVariables.value(dsi.curStaminaVarID) <= 0) {
- $gameVariables.setValue(dsi.curStaminaVarID, 0);
- this._dashing = false;
- this._canDash = false;
- }
- if (dashWindow) dashWindow.refresh();
- } else {
- this._dashDelayTime -= 1;
- }
- }
- } else {
- if ($gameVariables.value(dsi.curStaminaVarID) < $gameVariables.value(dsi.maxStaminaVarID)) {
- if (this._dashDelayTime === 0) {
- $gameVariables.setValue(dsi.curStaminaVarID, $gameVariables.value(dsi.curStaminaVarID) + dsi.recoverAmount);
- this._dashDelayTime = dsi.staminaTimer;
- console.log($gameVariables.value(dsi.curStaminaVarID));
- if ($gameVariables.value(dsi.curStaminaVarID) >= 40) {
- this._canDash = true;
- }
- if ($gameVariables.value(dsi.curStaminaVarID) >= $gameVariables.value(dsi.maxStaminaVarID)) {
- $gameVariables.setValue(dsi.curStaminaVarID, $gameVariables.value(dsi.maxStaminaVarID));
- }
- if (dashWindow) dashWindow.refresh();
- } else {
- this._dashDelayTime -= 1;
- }
- }
- }
- if (this.isMoving()) {
- return;
- }
- if (this.canMove() && !this.isInVehicle() && !$gameMap.isDashDisabled() && this._canDash && !$gameSwitches.value(dsi.disableDashSwID)) {
- this._dashing = this.isDashButtonPressed() || $gameTemp.isDestinationValid();
- } else {
- this._dashing = false;
- }
- };
- })(DSIVER144);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement