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/28/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 hudFadeInOutActive
- * @text HUD Fade In Out Options Active
- * @default true
- * @type boolean
- * @parent HudMain
- *
- * @param hudFadeInSpeed
- * @text HUD Fade In Speed
- * @default 20
- * @type number
- * @parent HudMain
- *
- * @param hudFadeOutSpeed
- * @text HUD Fade Out Speed
- * @default 5
- * @type number
- * @parent HudMain
- *
- * @param StayVisibleUntilFull
- * @text Stay Visible Until Full
- * @type boolean
- * @default true
- * @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 EnableDashAmount
- * @text Set Stamina Amount to enable Dash
- * @default 40
- * @parent MainSettings
- *
- * @param EnableDashSE
- * @text Set Enable Dash Sound Effect (SE)
- * @type @type struct<SFX>
- *
- * @param RunOutOfStaminaSE
- * @text Set Sound Effect (SE) when run out of stamina
- * @type @type struct<SFX>
- *
- * @param RecoverAmount
- * @text Set Recover Amount
- * @default 1
- * @parent MainSettings
- *
- * @param disableDashSwitchID
- * @text Set Switch for disable dash
- * @type switch
- * @default 10
- * @parent MainSettings
- */
- /*~struct~SFX:
- * @param name
- * @text path
- * @type file
- * @dir audio/se
- * @require 1
- *
- * @param volume
- * @desc Max = 150 | Min = 0
- * @type number
- * @min 0
- * @max 100
- * @default 100
- *
- * @param pitch
- * @desc Max = 150 | Min = 0
- * @type number
- * @min 0
- * @max 150
- * @default 100
- *
- * @param pan
- * @desc Max = 100 | Min = 0
- * @type number
- * @min 0
- * @max 100
- * @default 100
- */
- 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']);
- DSIVER144.enableDashAmount = Number(params['EnableDashAmount']);
- DSIVER144.enableDashSE = JSON.parse(params['EnableDashSE']);
- DSIVER144.enableDashSE.volume = Number(DSIVER144.enableDashSE.volume);
- DSIVER144.enableDashSE.pitch = Number(DSIVER144.enableDashSE.pitch);
- DSIVER144.enableDashSE.pan = Number(DSIVER144.enableDashSE.pan);
- DSIVER144.outOfStaminaSE = JSON.parse(params['RunOutOfStaminaSE']);
- DSIVER144.outOfStaminaSE.volume = Number(DSIVER144.enableDashSE.volume);
- DSIVER144.outOfStaminaSE.pitch = Number(DSIVER144.enableDashSE.pitch);
- DSIVER144.outOfStaminaSE.pan = Number(DSIVER144.enableDashSE.pan);
- DSIVER144.fadeInSpeed = Number(params['hudFadeInSpeed'] || 20);
- DSIVER144.fadeOutSpeed = Number(params['hudFadeOutSpeed'] || 5);
- DSIVER144.fadeInOutActive = (params['hudFadeInOutActive'] || 'true');
- DSIVER144.hudStayUntilFull = (params['StayVisibleUntilFull'] || 'true');
- 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._sprite = new Sprite();
- this._sprite.x = this.x + this.padding;
- this._sprite.y = this.y + this.padding;
- this._sprite.bitmap = new Bitmap(this.contents.width, this.contents.height);
- this._sprite.opacity = 255;
- console.log(this._sprite);
- this.addChild(this._sprite);
- if (dsi.fadeInOutActive === 'true')
- this.changeOpacity(0);
- this.refresh();
- };
- Window_DashStamina.prototype.changeOpacity = function(opacity) {
- //this.backOpacity = opacity;
- this.opacity = opacity;
- this._sprite.opacity = opacity;
- }
- 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');
- this._sprite.bitmap.clear();
- this._sprite.bitmap.blt(this.contents,0,0,this.contents.width, this.contents.height, 0, 0, 0, 0);
- this.contents.clear();
- };
- 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._dashStaminaIncreaseFlag = false;
- this._dashDelayTime = dsi.staminaTimer;
- };
- Game_Player.prototype.updateDashing = function() {
- if (this._dashing === true && this.isMoving()) {
- if (dashWindow && dashWindow.opacity < 255 && dsi.fadeInOutActive === 'true') {
- dashWindow.changeOpacity(dashWindow.opacity + dsi.fadeInSpeed);
- }
- if ($gameVariables.value(dsi.curStaminaVarID) > 0) {
- this._showBar = true;
- if (this._dashDelayTime === 0) {
- $gameVariables.setValue(dsi.curStaminaVarID, $gameVariables.value(dsi.curStaminaVarID) - dsi.burnAmount);
- this._dashDelayTime = dsi.staminaTimer;
- if ($gameVariables.value(dsi.curStaminaVarID) <= 0 && this._canDash) {
- $gameVariables.setValue(dsi.curStaminaVarID, 0);
- this._dashing = false;
- this._canDash = false;
- AudioManager.playStaticSe(dsi.outOfStaminaSE);
- }
- if (dashWindow) dashWindow.refresh();
- } else {
- this._dashDelayTime -= 1;
- }
- }
- }
- if (this._dashing && !this.isMoving()) {
- this._dashing = false;
- }
- if (this._showBar && $gameVariables.value(dsi.curStaminaVarID) < $gameVariables.value(dsi.maxStaminaVarID) && dsi.fadeInOutActive === 'true' && dsi.hudStayUntilFull === 'true') {
- dashWindow.changeOpacity(255);
- }
- if (this._dashing === false) {
- if (dashWindow && dashWindow.opacity > 0 && dsi.fadeInOutActive === 'true') {
- dashWindow.changeOpacity(dashWindow.opacity - dsi.fadeOutSpeed);
- }
- 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;
- if ($gameVariables.value(dsi.curStaminaVarID) >= dsi.enableDashAmount && !this._canDash) {
- this._canDash = true;
- AudioManager.playStaticSe(dsi.enableDashSE);
- }
- if ($gameVariables.value(dsi.curStaminaVarID) >= $gameVariables.value(dsi.maxStaminaVarID)) {
- this._showBar = false;
- $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