Silver's Dash Stamina

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
405
Reaction score
158
First Language
Dutch
Primarily Uses
RMMV
Script name: Dash Stamina v2.05
Author: Squirting Elephant



Features:
- Disables dashing on the map when you run out of stamina.
- Items can replenish, lower, refill, deplete and change maximum stamina (only from the menu, not during battle).
- 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.
- The window can hide it self automatically during dialogs.
- 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.
- Can show custom text in front of the stamina-gauge.
- Can disable dashing entirely on a map (with map-notetag and plugins commands).
- Etc. etc. etc.


Script:
Download v2.05
Download Master Demo

License:
License: Attribution 4.0 International (CC BY 4.0) (https://creativecommons.org/licenses/by/4.0/)


Old Versions:
 
Last edited:

Yuudai

Burritoman!
Veteran
Joined
Dec 16, 2014
Messages
39
Reaction score
16
First Language
German, English
Primarily Uses
Loving this plugin so far, I always felt there should be some limitations to the dashing! now there is thank you!

may I suggest some features?

It would be really cool if you could show the text "Stamina" or "Stamina Bar" in the window just for the visuals!

also how about you could use <stamina refill> note tag in the items notebox so you could find/craft/make stamina potions?

anyway great work! keep it up
 

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
405
Reaction score
158
First Language
Dutch
Primarily Uses
RMMV
Not sure about potions, I would have to make a key-binding so you can quickly & instantly refill stamina while running (which requires a dependency script :( ), or maybe give unlimited stamina for x-tiles instead. But would anyone really want to buy it as a player? They would have to be dirt-cheap. Unless of course you make a topdown hack 'n slash game.

But maybe potions that increase max-stamina up to a certain limit.
 

crackedthesky

Villager
Member
Joined
Jun 27, 2014
Messages
9
Reaction score
6
First Language
English
Primarily Uses
Hey, just downloaded this, and I can't get it to work. As soon as I try to run my game, it crashes and gives me "ReferenceError: x is not defined"


Does this even with no other scripts enabled.
 

DCF

Villager
Member
Joined
Feb 6, 2014
Messages
24
Reaction score
14
First Language
English
Great plugin. This feature is nearly essential for anyone building onscreen encounters since it enables the player to be faster than the enemy while dashing and slower when walking in a meaningful way.

I encountered the same bug as the previous poster. Simple fix:

Line 617

x = 0;

replace

var x = 0;

Line 619

y = 0;

replace

var y = 0;

Line 584

|| x >

replace

|| this.x >

Line 585

|| x >

replace

|| this.y >

One suggestion, you may want to consider adding some plugin commands or provide javascript examples on how to extract dashing values for use in other code. Example, in an enemies on map game, one might want to force a surprise encounter if the player encounters an enemy while out of stamina.

Can you confirm js below is correct or make recommendations for how to extract the information below:

$gamePlayer.dashStamina; //returns current stamina

($gamePlayer.dashStamina == 0 || ( !(gamePlayer.wasDashing) && $gamePlayer.requiresThresholdAmount )); //returns true if low stamina is preventing dashing, otherwise returns false

Thanks!

-DCF
 
Last edited by a moderator:

crackedthesky

Villager
Member
Joined
Jun 27, 2014
Messages
9
Reaction score
6
First Language
English
Primarily Uses
Thanks DCF, that fixed it for me!
 

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
405
Reaction score
158
First Language
Dutch
Primarily Uses
RMMV
Thanks for reporting that. This happens because RPG Maker has a problem/bug with strict-mode. Crashes on some platforms, not on others. I recently fixed this in my other plugins but forgot it for this one. Sorry.

Update:

v1.01 (1 December 2015)
  - Removed strict-mode because... Possible bug in RPG Maker...
  - Refactored and fixed semicolons and missing var-keywords.

  - Added $gamePlayer.dashingAllowed() so other scripts can check it as well.

Can you confirm js below is correct or make recommendations for how to extract the information below:

$gamePlayer.dashStamina; //returns current stamina

($gamePlayer.dashStamina == 0 || ( !(gamePlayer.wasDashing) && $gamePlayer.requiresThresholdAmount )); //returns true if low stamina is preventing dashing, otherwise returns false
Both confirmed. But I made you a function instead now:

Code:
$gamePlayer.dashingAllowed()
 
Last edited by a moderator:
  • Like
Reactions: DCF

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
857
First Language
German
Primarily Uses
Strict mode works fine for all of my plugins in multiple browsers and "desktop" version. Just remember to initialize every variable with "var" and you should be safe.
 

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
405
Reaction score
158
First Language
Dutch
Primarily Uses
RMMV
Strict mode works fine for all of my plugins in multiple browsers and "desktop" version. Just remember to initialize every variable with "var" and you should be safe.
It does not work properly (for me). See my topic about it: http://forums.rpgmakerweb.com/index.php?/topic/51603-use-strict-mode-unreliable/

So I rather just remove it. Crashes on some platforms, not on others. There are some 'workarounds' but still the fact that it behaves different depending on platform or even PC used, is enough reason for me to scrap it.

Could make a video to proof it but why bother. It simply is not 100% reliable. It may work for you and maybe for 20 other people. The one exception is enough reason to not use it.
 
Last edited by a moderator:

DCF

Villager
Member
Joined
Feb 6, 2014
Messages
24
Reaction score
14
First Language
English
Thanks for reporting that. This happens because RPG Maker has a problem/bug with strict-mode. Crashes on some platforms, not on others. I recently fixed this in my other plugins but forgot it for this one. Sorry.

Update:

v1.01 (1 December 2015)

  - Removed strict-mode because... Possible bug in RPG Maker...

  - Refactored and fixed semicolons and missing var-keywords.

  - Added $gamePlayer.dashingAllowed() so other scripts can check it as well.

Both confirmed. But I made you a function instead now:

$gamePlayer.dashingAllowed()
Thanks, I've tested the new version and it works without modification. Also, thank you for adding the function. That's a big help!

-DCF
 

Eff-n-Geoff

Veteran
Veteran
Joined
Oct 26, 2015
Messages
182
Reaction score
7
First Language
English
This is a really nice script, thank you so much!

Is there a way to call the stamina amount into a variable so I can display it alongside others in the OrangeHud?
 

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
405
Reaction score
158
First Language
Dutch
Primarily Uses
RMMV
UPDATE (parameters were changed)

v1.02 (12 December 2015)
  - Dashing for the current map can now be entirely disabled with a map-notetag and switched with a plugin command at any time.
  - Created a simple plugin addon to store the player-stamina in a global game-variable.
  - Enabled custom text to be drawn in front of the Stamina Window.
  - New feature: items can replenish, lower, refill and deplete stamina and change the maximum stamina (only in the menu, not in battle).

Is there a way to call the stamina amount into a variable so I can display it alongside others in the OrangeHud?
I added it in v1.02 if you also use the new addon.

may I suggest some features?
It would be really cool if you could show the text "Stamina" or "Stamina Bar" in the window just for the visuals!

also how about you could use <stamina refill> note tag in the items notebox so you could find/craft/make stamina potions?
Also added in v1.02
 
Last edited by a moderator:

Eff-n-Geoff

Veteran
Veteran
Joined
Oct 26, 2015
Messages
182
Reaction score
7
First Language
English
Wow, I had no expectations for this to be added so fast ... unreal! Thank you so much!

I've added the additional plugin and have set it to store in variable 2 which I have titled Stamina, I have then added a new Orangehud line but it doesn't seem to be showing up in the game ... My first custom Orangehud line does.

** SOLVED THIS BIT **

I used the Orangehud multiple variables plugin and bingo it all works beautifully! Thank you!

Screen Shot 2015-12-07 at 20.13.16.png

Screen Shot 2015-12-07 at 20.13.24.png
 
Last edited by a moderator:

Eff-n-Geoff

Veteran
Veteran
Joined
Oct 26, 2015
Messages
182
Reaction score
7
First Language
English
Oops, sorry - last one I promise!!!

Can we decrease the stamina useage by a decimal value - such as 0.25? I've changed the max stamina value to be 100 so that I can put it as a percentage, and now it runs out way too quick :p
 
Last edited by a moderator:

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
405
Reaction score
158
First Language
Dutch
Primarily Uses
RMMV
No you can't. It parses integers (whole numbers) all over the place.

What you can do however is just set the max-stamina value to 10.000 (100x100). Basically you just multiply your percentage x100 too. so 0.25 becomes 25. Also make sure to adjust the algorithm for regenerating stamina then and the result should be the same as using percentages.
 
Last edited by a moderator:

Yuudai

Burritoman!
Veteran
Joined
Dec 16, 2014
Messages
39
Reaction score
16
First Language
German, English
Primarily Uses
UPDATE (parameters were changed)

v1.02 (12 December 2015)

  - Dashing for the current map can now be entirely disabled with a map-notetag and switched with a plugin command at any time.

  - Created a simple plugin addon to store the player-stamina in a global game-variable.

  - Enabled custom text to be drawn in front of the Stamina Window.

  - New feature: items can replenish, lower, refill and deplete stamina and change the maximum stamina (only in the menu, not in battle).
Thank you very much! awesome update! :D

Is there any way to adjust the X position of the Text? I would like to put it above the gauge if possible.
 

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
405
Reaction score
158
First Language
Dutch
Primarily Uses
RMMV
No I'm sorry, full control over positioning of the text is not (yet) supported. It would require quite a bit of extra parameters and I didn't know people want the text so customized. Maybe next version.
 

Yuudai

Burritoman!
Veteran
Joined
Dec 16, 2014
Messages
39
Reaction score
16
First Language
German, English
Primarily Uses
Oh okay no problem I will wait for it  B)
 

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
405
Reaction score
158
First Language
Dutch
Primarily Uses
RMMV
Update v1.03 (01 January 2016)
- Used my new coding standards & refactored.
- Switched to the Imported variable.
- Fixed an accidental duplicate alias.
- Fixed a bug in Scene_Map.prototype.updateMain() (which just so happened to cause no side-effects).

The new code works the same as the old one, but performs better. For the end-user, nothing really changed but I would recommend to use this new version instead.
 
Last edited by a moderator:

Eff-n-Geoff

Veteran
Veteran
Joined
Oct 26, 2015
Messages
182
Reaction score
7
First Language
English
Hi there SilverDash, i'm running into an issue with events causing a fadeout with the updated version of the script ... it's giving the old 'null' error message.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Broke: Dont move. -boring. -passive. -uncreative. Woke: Bewegen Sie Nicht! +authoritative. +foreign. +reminds your son that he's a garden gnome now.
My girlfriend left a note on the fridge saying 'This isn't working, goodbye.' I opened the refrigerator and it works just fine. Weird.
BCj
Could someone translate something from Japanese to English for me?
You know, I sometimes ponder if working on the story and details is more necessary than the game itself. Its... technically work, just not direct.

Like for me specifically I never stop evolving the story based on what avenues I can approach in gameplay and then I get anxious thinking "hey good thing I thought about that now instead of later". Repeat ad nauseam.
World Of Final Fantasy Livestream~!
(Ft. Kaliga)

Forum statistics

Threads
94,385
Messages
920,529
Members
124,158
Latest member
schico
Top