Silver's Dash Stamina

Discussion in 'JS Plugin Releases (RMMV)' started by SilverDash, Nov 26, 2015.

  1. SilverDash

    SilverDash Veteran Veteran

    Messages:
    389
    Likes Received:
    153
    First Language:
    Dutch
    Primarily Uses:
    RMMV
    Script name: Dash Stamina v2.04
    Author: Squirting Elephant

    [​IMG]

    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.04
    Download Master Demo

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


    Old Versions:
     
    Last edited: Nov 15, 2019
    #1
  2. Yuudai

    Yuudai Burritoman! Veteran

    Messages:
    39
    Likes Received:
    15
    Location:
    Outer Space
    First Language:
    German, English
    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
     
    #2
  3. SilverDash

    SilverDash Veteran Veteran

    Messages:
    389
    Likes Received:
    153
    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.
     
    #3
  4. crackedthesky

    crackedthesky Villager Member

    Messages:
    9
    Likes Received:
    5
    First Language:
    English
    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.
     
    #4
  5. DCF

    DCF Villager Member

    Messages:
    24
    Likes Received:
    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: Dec 1, 2015
    #5
    SilverDash likes this.
  6. crackedthesky

    crackedthesky Villager Member

    Messages:
    9
    Likes Received:
    5
    First Language:
    English
    Thanks DCF, that fixed it for me!
     
    #6
  7. SilverDash

    SilverDash Veteran Veteran

    Messages:
    389
    Likes Received:
    153
    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.

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

    Code:
    $gamePlayer.dashingAllowed()
     
    Last edited by a moderator: Dec 1, 2015
    #7
    DCF likes this.
  8. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    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.
     
    #8
  9. SilverDash

    SilverDash Veteran Veteran

    Messages:
    389
    Likes Received:
    153
    First Language:
    Dutch
    Primarily Uses:
    RMMV
    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: Dec 1, 2015
    #9
  10. DCF

    DCF Villager Member

    Messages:
    24
    Likes Received:
    14
    First Language:
    English
    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
     
    #10
  11. Eff-n-Geoff

    Eff-n-Geoff Veteran Veteran

    Messages:
    182
    Likes Received:
    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?
     
    #11
  12. SilverDash

    SilverDash Veteran Veteran

    Messages:
    389
    Likes Received:
    153
    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).

    I added it in v1.02 if you also use the new addon.

    Also added in v1.02
     
    Last edited by a moderator: Dec 8, 2015
    #12
  13. Eff-n-Geoff

    Eff-n-Geoff Veteran Veteran

    Messages:
    182
    Likes Received:
    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: Dec 8, 2015
    #13
  14. Eff-n-Geoff

    Eff-n-Geoff Veteran Veteran

    Messages:
    182
    Likes Received:
    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: Dec 8, 2015
    #14
  15. SilverDash

    SilverDash Veteran Veteran

    Messages:
    389
    Likes Received:
    153
    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: Dec 8, 2015
    #15
  16. Yuudai

    Yuudai Burritoman! Veteran

    Messages:
    39
    Likes Received:
    15
    Location:
    Outer Space
    First Language:
    German, English
    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.
     
    #16
  17. SilverDash

    SilverDash Veteran Veteran

    Messages:
    389
    Likes Received:
    153
    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.
     
    #17
  18. Yuudai

    Yuudai Burritoman! Veteran

    Messages:
    39
    Likes Received:
    15
    Location:
    Outer Space
    First Language:
    German, English
    Oh okay no problem I will wait for it  B)
     
    #18
  19. SilverDash

    SilverDash Veteran Veteran

    Messages:
    389
    Likes Received:
    153
    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: Jan 1, 2016
    #19
  20. Eff-n-Geoff

    Eff-n-Geoff Veteran Veteran

    Messages:
    182
    Likes Received:
    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.
     
    #20

Share This Page