◆Comment:Stamina system, modifies speed directly rather than toggling dash mode.
: :Compatible with forced move routes.
: :Does not require a plugin.
: :Toggled by shift key (see Conditional Branch).
◆Comment:----------------------------------------------------------------------
◆Comment:Default speed 4.
: :Set using script call so it doesn't interfere with player movement.
◆Script:$gamePlayer.setMoveSpeed(4);
◆Comment:Check if player is currently moving.
◆If:Script:var p = $gamePlayer, d = p.getInputDirection(); p.isMoving() || (d > 0 && p.canPass(p.x, p.y, d)) || $gameTemp.isDestinationValid()
◆Control Switches:#0003 Moving = ON
◆
:Else
◆Control Switches:#0003 Moving = OFF
◆
:End
◆Comment:Check if breathlessness has worn off.
◆If:Breathless is ON
◆Comment:Re-enable dashing after regaining some stamina
◆If:Stamina ≥ 150
◆Control Switches:#0002 Breathless = OFF
◆Plugin Command:EnableDashing
◆Comment:Undo opacity change (see below)
◆Move Picture:#6, Upper Left (598,22), (50%,100%), 255, Normal, 1 frame
◆
:End
◆
:End
◆Comment:Update stamina based on current motion.
◆If:Moving is ON
◆If:Breathless is OFF
◆If:Button [Shift] is pressed down
◆Comment:Dashing!
◆Script:$gamePlayer.setMoveSpeed(5);
◆Control Variables:#0001 Stamina -= 8
◆
:Else
◆Comment:Walking!
◆Control Variables:#0001 Stamina += 2
◆
:End
◆
:Else
◆Comment:Walking! (Out of breath.)
◆Control Variables:#0001 Stamina += 2
◆
:End
◆
:Else
◆Comment:Standing!
◆Control Variables:#0001 Stamina += 5
◆
:End
◆Comment:Apply min/max stamina
◆If:Stamina ≤ 0
◆Control Variables:#0001 Stamina = 0
◆Comment:Also become out of breath at zero stamina, which disables dashing
◆Control Switches:#0002 Breathless = ON
◆Comment:Let's make the gauge 50% transparent while recovering!
◆Move Picture:#6, Upper Left (598,22), (0%,100%), 128, Normal, 1 frame
◆Comment:And make the player character show some emotion~
◆Show Balloon Icon:Player, Sweat
◆
:Else
◆If:Stamina > 300
◆Control Variables:#0001 Stamina = 300
◆
:End
◆
:End
◆Comment:Rescale the stamina gauge to reflect current stamina value!
: :Via script call to avoid a tedious number of branches. >_>
◆Comment:Script vars:
: : - picId is the ID of the picture you're using
: : - duration is how many frames the picture takes to rescale
: : - fullScale is the width scale of the gauge picture when full (100 = "100%")
: : - staminaVarId is the ID of the game variable used for stamina
: : - staminaMax is the maximum value of the stamina variable
◆Script:var picId = 6, duration = 6, fullScale = 100;
: :var staminaVarId = 1, staminaMax = 300;
: :// Change the above values as needed //
: :var scale = $gameVariables.value(staminaVarId) / staminaMax;
: :var pic = $gameScreen.picture(picId);
: :pic._duration = duration;
: :pic._targetScaleX = fullScale * scale;
◆Comment:Repeat again in 1/10 second = 6 frames.
◆Wait:6 frames