Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Force Stop Dashing(SOLVED)

Status
Not open for further replies.
Hello I hope there is a simple answer because I stuck. AGAIN. I try to work pass it but its bugging me. How can I force stop dashing. I have a stamina bar setup it decreases when dashing and increases when not. However when it reaches 0 If the player is still holding shift it will continue to dash regardless. I have YEP plugin and the stop dashing does work if:

stamina is 0 and THEN the player presses shift.
but while dashing and stamina hits 0 it doesn't stop it unless the button is released and then pressed again.

I need a force button release or something along those lines.

-I've tried player movement
-loops won't work
-I'm not an expert on autorun processes but I'll give that a try and see if it works.(tried, did not)

Thank you
 
Last edited:

CT_Bolt

Global Moderator
Staff member
Resource Team
Xy$
0.02
So far I believe using an alias of the "Input.isPressed" function inside "rpg_core.js" to catch what button is pressed then checking if the stamina is > 0 to determine whether dashing can be enabled.

...Sadly I must go to work now but I'll finish checking into this when I get back tonight. (cool)

[doublepost=1537543125,1537461339][/doublepost]I decided on a simpler more effective solution...
JavaScript:
Game_Player.prototype.isDashing = function() {
    var stamina = $gameVariables.value(1);
    return stamina > 0 ? this._dashing : false;
};
Place this in a new .js file and add into the plugins used via plugin manager.
(or download attached file)

What this does:
The function now takes the value of a variable (in this case variable #1) and if it is greater then 0 return true if dashing, else return false.
You would change this line to whatever you use for your stamina.
JavaScript:
var stamina = $gameVariables.value(1);
Compatibility Note:
This is an overwrote function "Game_Player.prototype.isDashing".
So place this above any other plugins that use that function.

Let me know how that works for ya. (cool)

PS. Sorry it took so long.
 

Attachments

Last edited:
It Works!!!!

Its weird because I set up the stamina to recovery after time and if its at 0 it won't subtract anymore when pressing it however once it recovers and I'm pressing it even though it won't dash it will start dashing after recovering which is what I intended but it just didn't work the other way. smh. I did all that in the event page and it stinks that similar things requires rewriting files.

But it was very simple and it works fantastically! I thank you so very much!
 

CT_Bolt

Global Moderator
Staff member
Resource Team
Xy$
0.02
It Works!!!!

Its weird because I set up the stamina to recovery after time and if its at 0 it won't subtract anymore when pressing it however once it recovers and I'm pressing it even though it won't dash it will start dashing after recovering which is what I intended but it just didn't work the other way. smh. I did all that in the event page and it stinks that similar things requires rewriting files.
So true... I've found that it's almost always much easier for me just to script something but eventing does offer advantages too for sure. (cool)

But it was very simple and it works fantastically! I thank you so very much!
Oh wonderful news, glad it works the way you need. No prob. at all. Always happy to help. (cute)(icecream)

Happy Game Making! If you need anything else I'll be here. (hella)(thumbsup)

Thread closed due to this being solved. (glad)
 
Status
Not open for further replies.
Top