MV Make player lose stamina when jump

Hi. My engine is RPG Maker MV.

Im using two plugins:
Silver's Dash Stamina (by Squirting Elephant) (It makes the dash ability limited by stamina)
Galv's Jump Ability by Galv (The player can jump by pressing a key)

However, theres no way to limit the amount of times the player can jump. I want to make the jump action cost 25% of total stamina, and if the player's stamina deplete, he cant dash or jump.

Can someone help me with that?

Here's both plugins:

Reading through the DashStamina, the values are stored in $gamePlayer.dashStaminaMax and $gamePlayer.dashStamina. So...in GALV_JumpAbility, go to line 183, and edit it to look like this:
Code:
if (this.canMove() && Input.isJumpTriggered('jump') && ($gamePlayer.dashStamina/$gamePlayer.dashStaminaMax>.25)) {

Then, at the end of the next function (do_jump), add:
Code:
$gamePlayer.decreaseStamina(25);
1622678390414.png


Thanks a lot for your help. Unfortunately, it's not working. 🙁

EDIT: I recorded what happened after i applied what you told me to do. .

As you can see, there is a 'delay' between the jump and the eventual decrease in stamina. My goal is that each jump consumes 25% of the total stamina, that is, if the player has 100% stamina, he can do 4 consecutive jumps before having to wait for the stamina to charge again.
Thanks a lot for your help. Unfortunately, it's not working. 🙁
That is not the instructions I gave you. I told you to add the second line at the end of the do_jump function. Not in the moveByInput function where it says do_jump.

So scroll down to line 196, press Enter, put that new line of code in there.

Also, I misread or mistyped or something...I made it check for 25 percent, but spend 25 points. So that line should read:
Code:
$gamePlayer.decreaseStamina($gamePlayer.dashStaminaMax*0.25);
Now its working! It decreases 25% of stamina when the player jumps. Thank you very much.

There's just one more problem - the value shown in the hud (top left corner) doesn't update after the jump. The hud only updates when the player runs (which is the traditional way in which stamina is reduced). That is, if I take two jumps, the top left corner will still show 100%. Then when the player runs, it instantly goes to 50%.

I hope it's not asking too much, but if you have the time and can help me with that, I would be very grateful!
It would've been smart for the plugin author to make that go automatically 😛

But try this...after the decreaseStamina bit that you added, add one more line and put $gamePlayer.updateStamina();
It works perfectly. Thank you very much, my friend.

Original thread: https://forums.rpgmakerweb.com/threads/make-player-lose-stamina-when-jump.137078/