Advertisement
dsiver144

DSI Limited Dashing [MV]

Jan 27th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*:
  2.  * @plugindesc Plugin used to disable dashing & stuff.
  3.  * <DSI Limited Dash>
  4.  * @author dsiver144
  5.  *
  6.  * @help Last Updated: 1/27/2018
  7.  * Maybe you don't need help for this plugin, lol. Just play around with those
  8.  * variables.
  9.  *
  10.  * @param defaultMaxStamina
  11.  * @text Set Default Max Stamina
  12.  * @default 100
  13.  *
  14.  * @param maxStaminaVariable
  15.  * @text Set Max Stamina Variable ID
  16.  * @type variable
  17.  * @default 10
  18.  *
  19.  * @param currentStaminaVariable
  20.  * @text Set Current Stamina Variable ID
  21.  * @type variable
  22.  * @default 11
  23.  *
  24.  * @param StaminaTimer
  25.  * @text Set Stamina Timer
  26.  * @default 10
  27.  *
  28.  * @param BurnAmount
  29.  * @text Set Burn Amount
  30.  * @default 5
  31.  *
  32.  * @param RecoverAmount
  33.  * @text Set Recover Amount
  34.  * @default 1
  35.  *
  36.  * @param disableDashSwitchID
  37.  * @text Set Switch for disable dash
  38.  * @type switch
  39.  * @default 10
  40. */
  41.  
  42. var DSIVER144 = DSIVER144 || {};
  43.  
  44. var params = $plugins.filter(function(p) { return p.description.contains('<DSI Limited Dash>'); })[0].parameters;
  45.     DSIVER144.maxStamina = Number(params['defaultMaxStamina'] || 100);
  46.     DSIVER144.maxStaminaVarID = Number(params['maxStaminaVariable'] || 10);
  47.     DSIVER144.curStaminaVarID = Number(params['currentStaminaVariable'] || 11);
  48.     DSIVER144.staminaTimer = Number(params['StaminaTimer'] || 10);
  49.     DSIVER144.burnAmount = Number(params['BurnAmount'] || 5);
  50.     DSIVER144.recoverAmount = Number(params['RecoverAmount'] || 1);
  51.     DSIVER144.disableDashSwID = Number(params['disableDashSwitchID'] || 10);
  52.  
  53. (function(dsi){
  54.     var _alias_Game_Player_initMembers = Game_Player.prototype.initMembers;
  55.     Game_Player.prototype.initMembers = function() {
  56.         _alias_Game_Player_initMembers.call(this);
  57.         $gameVariables.setValue(dsi.maxStaminaVarID, dsi.maxStamina);
  58.         $gameVariables.setValue(dsi.curStaminaVarID, dsi.maxStamina);
  59.         this._canDash = true;
  60.         this._dashDelayTime = dsi.staminaTimer;
  61.     };
  62.    
  63.     Game_Player.prototype.updateDashing = function() {
  64.         if (this._dashing === true) {
  65.             if ($gameVariables.value(dsi.curStaminaVarID) > 0) {
  66.                 if (this._dashDelayTime === 0) {
  67.                     $gameVariables.setValue(dsi.curStaminaVarID, $gameVariables.value(dsi.curStaminaVarID) - dsi.burnAmount);
  68.                     this._dashDelayTime = dsi.staminaTimer;
  69.                     console.log($gameVariables.value(dsi.curStaminaVarID));
  70.                     if ($gameVariables.value(dsi.curStaminaVarID) <= 0) {
  71.                         $gameVariables.setValue(dsi.curStaminaVarID, 0);
  72.                         this._dashing = false;
  73.                         this._canDash = false;
  74.                     }
  75.                 } else {
  76.                     this._dashDelayTime -= 1;
  77.                 }
  78.             }
  79.         } else {
  80.             if ($gameVariables.value(dsi.curStaminaVarID) < $gameVariables.value(dsi.maxStaminaVarID)) {
  81.                 if (this._dashDelayTime === 0) {
  82.                    $gameVariables.setValue(dsi.curStaminaVarID, $gameVariables.value(dsi.curStaminaVarID) + dsi.recoverAmount);
  83.                     this._dashDelayTime = dsi.staminaTimer;
  84.                     console.log($gameVariables.value(dsi.curStaminaVarID));
  85.                     if ($gameVariables.value(dsi.curStaminaVarID) >= 40) {
  86.                         this._canDash = true;
  87.                     }
  88.                     if ($gameVariables.value(dsi.curStaminaVarID) >= $gameVariables.value(dsi.maxStaminaVarID)) {
  89.                         $gameVariables.setValue(dsi.curStaminaVarID, $gameVariables.value(dsi.maxStaminaVarID));
  90.                     }
  91.                 } else {
  92.                     this._dashDelayTime -= 1;
  93.                 }
  94.             }
  95.         }
  96.         if (this.isMoving()) {
  97.             return;
  98.         }
  99.         if (this.canMove() && !this.isInVehicle() && !$gameMap.isDashDisabled() && this._canDash && !$gameSwitches.value(dsi.disableDashSwID)) {
  100.             this._dashing = this.isDashButtonPressed() || $gameTemp.isDestinationValid();
  101.         } else {
  102.             this._dashing = false;
  103.         }
  104.     };
  105. })(DSIVER144);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement