public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers
Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: Dash Stamina
  • Original author: SilverDash
  • Original date: October 31, 2015
  • Source thread: https://forums.rpgmakerweb.com/threads/dash-stamina.48680/
  • Source forum path: Game Development Engines > RPG Maker Javascript Plugins > JS Plugins In Development

Summary

Update 1.00 was released. Goto here from now on   Old stuff: Spoiler

Archived First Post

Update 1.00 was released. Goto here from now on
 

Old stuff:

Stamina Plugin
Author: Silver

Features:
- Disables dashing on the map when you run out of stamina.
- Has a stamina threshold so you don't automatically start dashing again at 1 stamina.
- Comes with an optional stamina bar with an optional percentage value in it.
- Can optionally automatically hide the stamina window.
- The bar changes color depending on the stamina value (NOT a gradient!).
- Does not consume stamina when the player can not walk (example: attempts to dash into a wall).
- Optional: slide the stamina window in/out instead of just hiding it.
- Optional: make the stamina's window invisible but not the stamina bar (use opacity parameter).
- Optional allow the stamina regen to increase in speed the longer you let it consecutively regenerate using a custom function in a parameter.
- Disable stamina consumption on specific maps (like overworlds) by using a map notetag.
- Disable stamina consumption by using a gameswitch.
- Increase/decrease max stamina.
- Optionally show the value, percentage, both or none of the current stamina in the stamina bar.
- Optional Window can slide in/out.
- Max stamina can be manually set in case you'd like to control the max stamina yourself.
- Window can be made invisible so you only see the stamina bar (use opacity parameter).
- You control how the stamina regenerates with a custom parameter-equation.


Planned features (no promises):
- Maybe some day allow player stats like the highest/lowest/average agility/level of all partymembers to influence the max stamina.
- "Perhaps make the stamina bar green when you can dash again so it makes it clear.". I will look into that, maybe make it flash once. Not sure how to best inform the player about this yet.

Known bugs:
- none

Screenshot:
Protected download


Script:

 
Code:
//=============================================================================// SilvStamina.js// Version: 1.0//=============================================================================/*: * @plugindesc v1.00 Basic dashing stamina script.   <SilverStamina> * @author Silver * * @param Show Stamina Window * @desc true/false * @default true * * @param Window X * @desc X-location of stamina window. If window-alignment is set to Right, this will act as an offset value instead * @default 10 * * @param Window Y * @desc Y-location of stamina window. If window-alignment is set to Top, this will act as an offset value instead * @default 10 * * @param Window Width * @desc width of the stamina window * @default 170 * * @param Window Height * @desc height of the stamina window * @default 72 * * @param Window Horizontal Alignment * @desc Left/Right * @default Left * * @param Window Vertical Alignment * @desc Top/Bottom * @default Top * * @param Stamina Decrease * @desc Amount of stamina subtracted per update (use a positive number) * @default 1 * * @param Stamina Max * @desc Maximum amount of stamina * @default 300 * * @param Stamina Recovery Delay * @desc delay in update-calls before recovering stamina when not dashing * @default 180 * * @param Stamina Recovery Rate * @desc How fast stamina is recovered (only when recovering) * @default 0.3 * * @param Stamina AutoDash Threshold * @desc Do not automatically dash again before stamina is above this threshold (%) when recovering stamina. (0-100) * @default 40 * * @param Stamina Gauge Rectangle * @desc The gauge rectangle. Format: x y width height * @default 0 -20 132 24 * * @param Stamina Gauge Color 1 * @desc Bar gradient color1 (start of bar) in hex * @default #009900 * * @param Stamina Gauge Color 2 * @desc Bar gradient color2 (end of bar) in hex * @default #CC0000 * * @param Draw Stamina Value * @desc Draw text in stamina bar? Accepted values: absolute/percentage/both/none * @default percentage * * @param Font Size * @desc Size for stamina value * @default 20 * * @param Auto Hide Stamina Window * @desc Automatically hide the stamina window if it's at max stamina for a specific period of time? true/false * @default true * * @param Hide Stamina Window Delay * @desc After how many updates the stamina window should hide itself (if it remains at max stamina) * @default 160 * * @param Stamina Window Opacity * @desc Stamina window opacity. Set to 0 to hide the window (will still show the bar). * @default 255 * * @param Window Slideout Direction * @desc What direction to slide the stamina window out to. NoSlide/Left/Top/Right/Bottom * @default Left * * @param Window Slideout Speed * @desc How fast the window slides in&out * @default 2 * * @param Stamina Regen Formula * @desc The formula for how fast to regenerate stamina over longer period of time. "Base" is the recovery rate. Case sensitive! * @default base + Math.sqrt(x/50); * * @param Disable Stamina Consumption GameSwitch * @desc The gameswitch to use to disable stamina consumption (or -1 to use none). ON = disabled. * @default -1 * * @param Window Z-Index * @desc Window Z-Index. Value must be > 0. * @default 1 * * @param Plugin Command Identifier * @desc Do not change if you do not know what this is! * @default stamina * * @help * ------------------------------------- * Plugin Commands (not case sensitive): * ------------------------------------- * * Stamina Refill * Instantly refills all of your stamina. * * Stamina Set <value> * Instantly sets your stamina to the specified percentage (0-100). * Example to set your stamina bar to 64: Stamina Set 64 * * Stamina Deplete * Instantly sets your stamina to 0. * * Stamina ShowWindow * Shows the stamina window. Does not work if you disabled the stamina window. * * Stamina HideWindow * Hides the stamina window. Does not work if you disabled the stamina window. * Also does not work if the stamina is currently regenerating. * * Stamina RefillHide * Instantly refills all of your stamina and also hides the stamina window. * * Stamina SetMax <value> * Sets a new max-stamina value. * * Stamina IncreaseMax <value> * Increases max stamina by the specified value. You can also use negative values. * ------------------------------------- * Map notetags * ------------------------------------- * * <dstam_disable:> * Prevents stamina consumption on this map. Not that if the "Disable Stamina Consumption GameSwitch" * is turned ON then you consume no stamina anyway. * */var Silv = Silv || {};Silv.Parameters = $plugins.filter(function(p) { return p.description.contains('<SilverStamina>'); })[0].parameters;Silv.DashStamina = Silv.DashStamina || {};Silv.DashStamina.Window = null;Silv.DashStamina.ScreenIsFading = false;Silv.DashStamina.ShowWindow = Silv.Parameters['Show Stamina Window'].toLowerCase() == 'true';Silv.DashStamina.Window_X = parseInt(Silv.Parameters['Window X']);Silv.DashStamina.Window_Y = parseInt(Silv.Parameters['Window Y']);Silv.DashStamina.WindowWidth = parseInt(Silv.Parameters['Window Width']);Silv.DashStamina.WindowHeight = parseInt(Silv.Parameters['Window Height']);Silv.DashStamina.WindowHorizontalAlignment = (Silv.Parameters['Window Horizontal Alignment']).toLowerCase();Silv.DashStamina.WindowVerticalAlignment = (Silv.Parameters['Window Vertical Alignment']).toLowerCase();Silv.DashStamina.StaminaDecrease = parseInt(Silv.Parameters['Stamina Decrease']);Silv.DashStamina.StaminaMax = parseInt(Silv.Parameters['Stamina Max']);Silv.DashStamina.StaminaRecoveryDelay = parseInt(Silv.Parameters['Stamina Recovery Delay']);Silv.DashStamina.StaminaRecoveryRate = parseInt(Silv.Parameters['Stamina Recovery Rate']);Silv.DashStamina.StaminaAutoDashThreshold = parseInt(Silv.Parameters['Stamina AutoDash Threshold']);Silv.DashStamina.StaminaGaugeRectangle = {x: parseInt(Silv.Parameters['Stamina Gauge Rectangle'].split(' ')[0]), y: parseInt(Silv.Parameters['Stamina Gauge Rectangle'].split(' ')[1]), width: parseInt(Silv.Parameters['Stamina Gauge Rectangle'].split(' ')[2]), height: parseInt(Silv.Parameters['Stamina Gauge Rectangle'].split(' ')[3])};Silv.DashStamina.StaminaGaugeColor1 = (Silv.Parameters['Stamina Gauge Color 1']).toUpperCase();Silv.DashStamina.StaminaGaugeColor2 = (Silv.Parameters['Stamina Gauge Color 2']).toUpperCase();Silv.DashStamina.DrawStaminaValue = Silv.Parameters['Draw Stamina Value'].toLowerCase();Silv.DashStamina.FontSize = parseInt(Silv.Parameters['Font Size']);Silv.DashStamina.AutoHideStaminaWindow = Silv.Parameters['Auto Hide Stamina Window'].toLowerCase() == 'true';Silv.DashStamina.HideStaminaWindowDelay = parseInt(Silv.Parameters['Hide Stamina Window Delay']);Silv.DashStamina.WindowOpacity = parseInt(Silv.Parameters['Stamina Window Opacity']);Silv.DashStamina.WindowSlideOutDir = Silv.Parameters['Window Slideout Direction'].toLowerCase();Silv.DashStamina.WindowSlideOutSpeed = parseFloat(Silv.Parameters['Window Slideout Speed']);Silv.DashStamina.RegenFormula = Silv.Parameters['Stamina Regen Formula'];Silv.DashStamina.DisableGameSwitch = parseInt(Silv.Parameters['Disable Stamina Consumption GameSwitch']);Silv.DashStamina.Window_Z = parseInt(Silv.Parameters['Window Z-Index']);Silv.DashStamina.PluginCmdId = Silv.Parameters['Plugin Command Identifier'];// Do not just show the minimap on top of a faded-out screen.var alias_silv_stamina_updateFadeOut = Game_Screen.prototype.updateFadeOut;Game_Screen.prototype.updateFadeOut = function() {    alias_silv_stamina_updateFadeOut.call(this);        if (this._brightness < 255) // (this._fadeOutDuration > 0)    {        Silv.DashStamina.Window.visible = false;        Silv.DashStamina.ScreenIsFading = true;    }    else    {        Silv.DashStamina.ScreenIsFading = false;    }};(function(){//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Utility Functions//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Usage: alert(rgbToHex(0, 51, 255)); // #0033ff  function componentToHex(c) {    var hex = c.toString(16);    return hex.length == 1 ? "0" + hex : hex;  }  function rgbToHex(r, g,  {    return "#" + componentToHex(r) + componentToHex(g) + componentToHex(;  } // Usage: alert( hexToRgb("#0033ff").g ); // "51";function hexToRgb(hex) {    var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);    return result ? {        r: parseInt(result[1], 16),        g: parseInt(result[2], 16),        b: parseInt(result[3], 16)    } : null;}//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Stamina stuff//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Hook into the main loopvar alias_updateMain = Scene_Map.prototype.updateMain;Scene_Map.prototype.updateMain = function(){    alias_updateMain.apply(this, arguments);    Game_Player.prototype.updateStamina();    if (Silv.DashStamina.ShowWindow) { Silv.DashStamina.Window.update(); }}Game_Player.prototype.hasStaminaConsumption = function(){    if ($gameSwitches.value(Silv.DashStamina.DisableGameSwitch)) { return false; }    if (!$gamePlayer.mapConsumeStamina) { return false; }    return true;}// Update stamina amountGame_Player.prototype.updateStamina = function(){        this.isConsumingStamina = ($gamePlayer.isDashing() && $gamePlayer.isMoving() && $gamePlayer.hasStaminaConsumption());    if (this.isConsumingStamina)    {        $gamePlayer.dashStamina -= Silv.DashStamina.StaminaDecrease;        if ($gamePlayer.dashStamina < 0) { $gamePlayer.dashStamina = 0; }        $gamePlayer.isRecoveringStamina = false;        if (Silv.DashStamina.ShowWindow && !Silv.DashStamina.ScreenIsFading) { Silv.DashStamina.Window.showMe(); }    }    else // not currently consuming stamina    {                if ($gamePlayer.isRecoveringStamina)        {            $gamePlayer.staminaRecoveryTimeCnt++;            if ($gamePlayer.dashStamina < $gamePlayer.dashStaminaMax) // Recover the stamina            {                // Recover stamina                $gamePlayer.dashStamina += $gamePlayer.calculateStaminaRegen(Silv.DashStamina.StaminaRecoveryRate);                if ($gamePlayer.dashStamina > $gamePlayer.dashStaminaMax) { $gamePlayer.dashStamina = $gamePlayer.dashStaminaMax; }                                    if (Silv.DashStamina.ShowWindow && !Silv.DashStamina.ScreenIsFading) { Silv.DashStamina.Window.showMe(); }            }            else // Already at max stamina, find out when to hide the window if applicable and do so if possible            {                // If the stamina window is used, attempt to autohide it if applicable                if (Silv.DashStamina.ShowWindow && Silv.DashStamina.AutoHideStaminaWindow)                {                    $gamePlayer.hideStaminaWindowDelayCnt += 1;                    if ($gamePlayer.hideStaminaWindowDelayCnt >= Silv.DashStamina.HideStaminaWindowDelay)                    {                        Silv.DashStamina.Window.hideMe();                        $gamePlayer.hideStaminaWindowDelayCnt = 0;                    }                }                                }        }        else // not currently recovering stamina, so find out when to start recovering it and do so if required        {            $gamePlayer.staminaRecoveryTimeCnt = 0;            $gamePlayer.staminaRecoveryDelayCnt += 1;            if ($gamePlayer.staminaRecoveryDelayCnt >= Silv.DashStamina.StaminaRecoveryDelay)            {                $gamePlayer.staminaRecoveryDelayCnt = 0;                $gamePlayer.isRecoveringStamina = true;            }        }    }     $gamePlayer.dashStaminaPerc = $gamePlayer.dashStamina / parseFloat($gamePlayer.dashStaminaMax);}Game_Player.prototype.calculateStaminaRegen = function(){    var base = Silv.DashStamina.StaminaRecoveryRate;    var x = $gamePlayer.staminaRecoveryTimeCnt;    return eval(Silv.DashStamina.RegenFormula);}// Initialize variables in $gamePlayervar alias_Game_PlayerInitialize = Game_Player.prototype.initialize;Game_Player.prototype.initialize = function(){    alias_Game_PlayerInitialize.apply(this, arguments);    this.dashStamina = this.dashStaminaMax = Silv.DashStamina.StaminaMax;    this.staminaRecoveryDelayCnt = 0; // counter for when to start recovering stamina    this.staminaRecoveryTimeCnt = 0; // counter for how long the player has been recovering stamina (in frames)    this.isRecoveringStamina = false;    this.dashStaminaPerc = 1.0;    this.hideStaminaWindowDelayCnt = 0;    this.isConsumingStamina = false;}// Disable dashing when no stamina.var alias_updateDashing = Game_Player.prototype.updateDashing;Game_Player.prototype.updateDashing = function(){    alias_updateDashing.apply(this, arguments);    if ($gamePlayer.dashStamina == 0) { this._dashing = false; };    if ($gamePlayer.isRecoveringStamina && ($gamePlayer.dashStamina < Silv.DashStamina.StaminaAutoDashThreshold)) { this._dashing = false; };} //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// DashStamina Window//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////function Window_DashStamina() { this.initialize.apply(this, arguments); }// Inherit from Window_BaseWindow_DashStamina.prototype = Object.create(Window_Base.prototype);// Set ConstructorWindow_DashStamina.prototype.constructor = Window_DashStamina;Window_DashStamina.prototype.standardFontSize = function() { return Silv.DashStamina.FontSize; }var sliding;var isFullySlidedOut;var isFullySlidedIn;var slideDirection = {x: 0, y: 0 };var originalWinLoc = {x: 0, y: 0 };// ConstructorWindow_DashStamina.prototype.initialize = function(x, y, width, height){    Window_Base.prototype.initialize.call(this, x, y, width, height);    this._helpWindow = null;    this._handlers = {};    this._touching = false;    this.deactivate();    this.opacity = Silv.DashStamina.WindowOpacity;    this.sliding = 'none';    this.isFullySlidedOut = false;    this.isFullySlidedIn = true;    originalWinLoc.x = x; // for some reason "this." is not allowed here    originalWinLoc.y = y; // for some reason "this." is not allowed here        this.update();};// UpdateWindow_DashStamina.prototype.update = function(){    if (Silv.DashStamina.ScreenIsFading)    {        this.visible = false;    }    else    {        Window_Base.prototype.update.call(this);        this.drawStaminaWindow(0, 0, Silv.DashStamina.StaminaGaugeRectangle.width);        this.updateSliding();    }};Window_DashStamina.prototype.drawStaminaGauge = function(x, y, width, height, rate){    var fillW = Math.floor(width * rate);    var gaugeY = y + this.lineHeight() - 8;    this.contents.fillRect(x, gaugeY, width, height, this.gaugeBackColor());    this.contents.fillRect (x, gaugeY, fillW, height, this.CalculateBarColour())};Window_DashStamina.prototype.drawStaminaWindow = function(x, y, width){    this.contents.clear();    this.drawStaminaGauge(Silv.DashStamina.StaminaGaugeRectangle.x, Silv.DashStamina.StaminaGaugeRectangle.y, Silv.DashStamina.StaminaGaugeRectangle.width, Silv.DashStamina.StaminaGaugeRectangle.height, $gamePlayer.dashStaminaPerc);    var text;    switch(Silv.DashStamina.DrawStaminaValue) // allowed values: absolute/percentage/both/none    {        case 'absolute':            text = parseInt($gamePlayer.dashStamina) + '/' + parseInt($gamePlayer.dashStaminaMax)            break;        case 'percentage':            text = Math.round($gamePlayer.dashStaminaPerc * 100) + '%';            break;        case 'both':            text = parseInt($gamePlayer.dashStamina) + '/' + parseInt($gamePlayer.dashStaminaMax) + ' (' + Math.round($gamePlayer.dashStaminaPerc * 100) + '%)';            break;        case 'none':            return;            break;        default:            throw 'ERROR: drawStaminaWindow missing case-statement or incorrect Silv.DashStamina.DrawStaminaValue value. Value: ' + Silv.DashStamina.DrawStaminaValue;        break;    }        this.resetTextColor();    this.drawText(text, x, y + 1, width, 'center');}// Calculate what colour the bar should be between the two colors depending on the percentage value of the current-stamina value.Window_DashStamina.prototype.CalculateBarColour = function(){    var c1 = hexToRgb(Silv.DashStamina.StaminaGaugeColor1);    var c2 = hexToRgb(Silv.DashStamina.StaminaGaugeColor2);            var ratio = $gamePlayer.dashStaminaPerc;    var hex = function(x) {        x = x.toString(16);        return (x.length == 1) ? '0' + x : x;    };    var r = Math.ceil(c1.r * ratio + c2.r * (1-ratio));    var g = Math.ceil(c1.g * ratio + c2.g * (1-ratio));    var b = Math.ceil(c1.b * ratio + c2.b * (1-ratio));    var middle = '#' + hex(r) + hex(g) + hex(;    return middle;}Window_DashStamina.prototype.showMe = function(){    //if (this.visible) { return; };    if (this.isFullySlidedIn)    {        this.visible = true;        return;    }        if (Silv.DashStamina.WindowSlideOutDir == 'noslide' || this.visible == false) { this.visible = true; }    else    {        this.sliding = 'in';        switch (Silv.DashStamina.WindowSlideOutDir)        {            case 'top':                slideDirection.x = 0;                slideDirection.y = 1;                break;            case 'left':                slideDirection.x = 1;                slideDirection.y = 0;                break;            case 'right':                slideDirection.x = -1;                slideDirection.y = 0;                break;            case 'bottom':                slideDirection.x = 0;                slideDirection.y = -1;                break;            default:                throw 'Window_DashStamina.prototype.HideMe: Unknown switch value: ' + Silv.DashStamina.WindowSlideOutDir;        }    }}Window_DashStamina.prototype.hideMe = function(){    if (!this.visible || this.isFullySlidedOut) { return; };        if (Silv.DashStamina.WindowSlideOutDir == 'noslide') { this.visible = false; }    else    {        this.sliding = 'out';        switch (Silv.DashStamina.WindowSlideOutDir)        {            case 'top':                slideDirection.x = 0;                slideDirection.y = -1;                break;            case 'left':                slideDirection.x = -1;                slideDirection.y = 0;                break;            case 'right':                slideDirection.x = 1;                slideDirection.y = 0;                break;            case 'bottom':                slideDirection.x = 0;                slideDirection.y = 1;                break;            default:                throw 'Window_DashStamina.prototype.HideMe: Unknown switch value: ' + Silv.DashStamina.WindowSlideOutDir;        }    }}Window_DashStamina.prototype.handleSlidingEnd = function(){    if(this.sliding == 'in')    {        // Stop sliding in        if (slideDirection.x  == 1 && this.x > originalWinLoc.x ||            slideDirection.x  == -1 && this.x < originalWinLoc.x ||            slideDirection.y  == 1 && this.y > originalWinLoc.y ||            slideDirection.y  == -1 && this.y < originalWinLoc.y)        {            this.sliding = 'none';            this.isFullySlidedIn = true;        }    }    else    {        // Stop sliding out        if (this.x < -this.width || x > Graphics._width + this.width ||            this.y < -this.height || x > Graphics._height + this.height)        {            this.sliding = 'none';            this.isFullySlidedOut = true;        }    }}Window_DashStamina.prototype.updateSliding = function(){    if (this.sliding == 'none') { return; }    this.x += slideDirection.x * Silv.DashStamina.WindowSlideOutSpeed;    this.y += slideDirection.y * Silv.DashStamina.WindowSlideOutSpeed;        this.isFullySlidedOut = false;    this.isFullySlidedIn = false;        this.handleSlidingEnd();}var alias_Stamina_SceneBase_StartFadeIn = Scene_Base.prototype.startFadeIn;Scene_Base.prototype.startFadeIn = function(){    alias_Stamina_SceneBase_StartFadeIn.apply(this, arguments)       if (Silv.DashStamina.Window != null) { Silv.DashStamina.Window.visible = false; }};/*var alias_Stamina_SceneBase_StartFadeOut = Scene_Base.prototype.startFadeOut;Scene_Base.prototype.startFadeOut = function(){    alias_Stamina_SceneBase_StartFadeOut.apply(this, arguments)}*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Create the stamina window//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Scene_Map.prototype.createDashWindow = function(){    // Does the map consume stamina?    $gamePlayer.mapConsumeStamina = !('dstam_disable' in $dataMap.meta);    if(Silv.DashStamina.ShowWindow)    {        x = 0;        if (Silv.DashStamina.WindowHorizontalAlignment == 'right') { x = Graphics.width - Silv.DashStamina.WindowWidth; }        y = 0;        if (Silv.DashStamina.WindowVerticalAlignment == 'bottom') { y = Graphics.height - Silv.DashStamina.WindowHeight; }                if (Silv.DashStamina.Window != null) { this.removeWindow(Silv.DashStamina.Window); }                Silv.DashStamina.Window = new Window_DashStamina(x + Silv.DashStamina.Window_X, y + Silv.DashStamina.Window_Y, Silv.DashStamina.WindowWidth, Silv.DashStamina.WindowHeight);                this.addChild(Silv.DashStamina.Window, Silv.DashStamina.Window_Z);        if (Silv.DashStamina.AutoHideStaminaWindow) { Silv.DashStamina.Window.visible = false; }    }}// Omg why does RPG Maker not have this method by default...Scene_Base.prototype.removeWindow = function(window){    var index = this.children.indexOf(window);    if (index > -1) { this.children.splice(index, 1); }}var alias_createStaminaDisplayObjects = Scene_Map.prototype.createDisplayObjects;Scene_Map.prototype.createDisplayObjects = function(){    alias_createStaminaDisplayObjects.call(this);    this.createDashWindow();};//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Saving & Loading//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////var alias_silv_stamina_makeSaveContents = DataManager.makeSaveContents;DataManager.makeSaveContents = function(){    contents = alias_silv_stamina_makeSaveContents.call(this);    contents.dashStamina = $gamePlayer.dashStamina;    contents.dashStaminaMax = $gamePlayer.dashStaminaMax;    return contents;}var alias_silv_stamina_extractSaveContents = DataManager.extractSaveContents;DataManager.extractSaveContents = function(contents){    alias_silv_stamina_extractSaveContents.call(this, contents);    $gamePlayer.dashStamina = contents.dashStamina;    $gamePlayer.dashStaminaMax = contents.dashStaminaMax;}//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Plugin Command// Note: The items are separated by spaces. The command is the first word and any following words are args. args is an array.//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand = function(command, args){    _Game_Interpreter_pluginCommand.call(this, command, args);    if (command.toLowerCase() == Silv.DashStamina.PluginCmdId) { PluginCommand(command, args); }}function PluginCommand(cmd, args){    switch(args[0].toLowerCase())    {        case 'refill':            $gamePlayer.dashStamina = $gamePlayer.dashStaminaMax;            break;        case 'deplete':            $gamePlayer.dashStamina = 0;            break;        case 'set':            var perc = parseInt(args[1]);            perc = Math.max(0, Math.min(100, perc)); // clamp value between 0-100            $gamePlayer.dashStamina = $gamePlayer.dashStaminaMax * (perc / 100.0);        break;        case 'showwindow':            if (Silv.DashStamina.Window != null)            {                $gamePlayer.hideStaminaWindowDelayCnt = 0;                Silv.DashStamina.Window.visible = true;            }            break;        case 'refillhide':            $gamePlayer.dashStamina = $gamePlayer.dashStaminaMax;        case 'hidewindow':            if (Silv.DashStamina.Window != null)            {                $gamePlayer.hideStaminaWindowDelayCnt = Silv.DashStamina.HideStaminaWindowDelay;                Silv.DashStamina.Window.visible = false;            }            break;        case 'setmax':            $gamePlayer.dashStaminaMax = Math.max(1, parseInt(args[1]));            if ($gamePlayer.dashStamina > $gamePlayer.dashStaminaMax) { $gamePlayer.dashStamina = $gamePlayer.dashStaminaMax; }            break;        case 'increasemax':            $gamePlayer.dashStaminaMax += parseInt(args[1]);            if ($gamePlayer.dashStaminaMax < 1) { $gamePlayer.dashStaminaMax = 1; }            if ($gamePlayer.dashStamina > $gamePlayer.dashStaminaMax) { $gamePlayer.dashStamina = $gamePlayer.dashStaminaMax; }            break;        default:            throw 'Stamina PluginCommand invalid command: ' + args[0];            break;    }}//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////})();

Features Mentioned

  • Disables dashing on the map when you run out of stamina.
  • Has a stamina threshold so you don't automatically start dashing again at 1 stamina.
  • Comes with an optional stamina bar with an optional percentage value in it.
  • Can optionally automatically hide the stamina window.
  • The bar changes color depending on the stamina value (NOT a gradient!).
  • Does not consume stamina when the player can not walk (example: attempts to dash into a wall).
  • Optional: slide the stamina window in/out instead of just hiding it.
  • Optional: make the stamina's window invisible but not the stamina bar (use opacity parameter).
  • Optional allow the stamina regen to increase in speed the longer you let it consecutively regenerate using a custom function in a parameter.
  • Disable stamina consumption on specific maps (like overworlds) by using a map notetag.
  • Disable stamina consumption by using a gameswitch.
  • Increase/decrease max stamina.
  • Optionally show the value, percentage, both or none of the current stamina in the stamina bar.
  • Optional Window can slide in/out.
  • Max stamina can be manually set in case you'd like to control the max stamina yourself.
  • Window can be made invisible so you only see the stamina bar (use opacity parameter).
  • You control how the stamina regenerates with a custom parameter-equation.
  • Planned features (no promises):

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download

Referenced Images / Attachments

stm bar.png
stm bar.png
Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#009900#cc0000#0033ff#039#rpg-maker-archive

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar