Unreal Engine 4 - Sprinting and Stamina Bar (Part 2)

  Рет қаралды 17,183

Titanic Games

Titanic Games

Күн бұрын

In this video I will show you how to fix up some of the issues we had in the previous video ,like making the character stop sprinting after they run out of stamina. If you have any questions or want to know how to customize your movement more, feel free to ask. And if you like the videos and want to see more, please consider supporting us on Patreon / titanicgames for more tutorials and great games to come.

Пікірлер: 47
@diffraction163
@diffraction163 5 жыл бұрын
Simpler fix: Add a variable (boolean) called Sprinting. On "Pressed" set this to "true", on release to "false" and then add a branch right behind the increase and decrease stamina. cdn.discordapp.com/attachments/225448446956404738/553926052125081601/unknown.png
@Tree3D
@Tree3D 6 жыл бұрын
I found an easier way to fix the two events firing at the same time and screwing up the bar. I made a Boolean variable that would set based on whether the sprint key was pressed or released. Based on that, I used branches to tell the timer if it needed to stop or not! It's easier to look at since you won't have a bunch of criss-crossing wires and have to deal with duplicate nodes and such
@MrBrunisio
@MrBrunisio 2 жыл бұрын
That was a good idea, thank you. To anyone thinking, you can create a boolean and set it to true if sprinting and false when releasing the button, and also use it after the custom events to check if it's true or not, and then proceed with the same structure from the last video (and the first modification of this one) or else immedeately clear and invalidate time.
@_Prometheus_Dev
@_Prometheus_Dev 3 жыл бұрын
Phenomenal video. Quite a complex system for sprinting, but well worth it considering you don't have to fire off of the event tick. Good stuff man.
@marcuss206
@marcuss206 5 жыл бұрын
Solid tutorial man thanks for uploading
@QWERTY-qh9po
@QWERTY-qh9po 4 жыл бұрын
thank you for a sprint that does not use the event tick.. was looking for this
@chickenfryedgames4405
@chickenfryedgames4405 3 жыл бұрын
Thank you, Works perfectly!
@rottedthegame
@rottedthegame 4 жыл бұрын
sweet little tip, Add a clamp on the branch for decrease stamina, it will not go below 0, or above max : ) That way your stamina reading on your bar is always precise.
@TheAutoDIYGuy
@TheAutoDIYGuy 3 жыл бұрын
thank you so much for this tutorial. One thing I noticed, is that if you hold down shift without moving, the stamina bar will still decrease.
@dropfx7290
@dropfx7290 5 жыл бұрын
thank you so much man :3
@GordonSeal
@GordonSeal 6 жыл бұрын
What I did, I put a "Clear and Invalidate Timer by Handle" directly after the Sprint Button released and connected that with the rest of the "Increase Stamina" Function. The Handle I connected to "Set Timer by Event" of the DecreaseStamina. This way, whenever I release the sprintkey, it clears the timer and after that starts the stamina regeneration. Not sure if that is the best way to do, but it's a clean solution and it works perfectly.
@Meta_Interior
@Meta_Interior 4 жыл бұрын
thank you so much very good
@jovaneybernard2206
@jovaneybernard2206 6 жыл бұрын
Thanks so much bro, U DUH BEST!!!!!!!!!!!
@darkigg
@darkigg 3 жыл бұрын
thanks
@CJ-ky1tg
@CJ-ky1tg 4 жыл бұрын
Could you do swimming too. And also when the character gets up from crouch, he's abit off the ground
@Graber23
@Graber23 6 жыл бұрын
Yes sir that is good.
@unrealengine4991
@unrealengine4991 5 жыл бұрын
THANX
@bradynglines5522
@bradynglines5522 7 жыл бұрын
Not sure if this issue was found out but if you are jumping while sprinting, when you land, the stamina bar stops increasing or decreasing. You have to push the sprint button again to reset. Do you know of any fixes for this? Thanks.
@earneststewart5507
@earneststewart5507 6 жыл бұрын
why not ill comment on this love it but you can shorten it by putting a regen rate in a update stamina function and just hook the original clear and invalidate to the walk speed set first branch in the same spot with the true going to the first walk speed set and shorten the code down to a total of 14 pieces but great video definitely changeable now to set up my lv system for walk run and stamina growth keep at it
@SomeGuy-gs4fv
@SomeGuy-gs4fv 7 жыл бұрын
@ Titanic Games, whenever I am sprinting, if I release the sprint button, the stamina will not regenerate. It will also not regenerate from 0. Help EDIT: I just realized that the "Current Stamina >= Max stamina" was incorrect. I had "Current stamina >= current stamina" That was a problem
@illuha2uha
@illuha2uha 3 жыл бұрын
thanks for the video but i found a bug. when you just press shift nothing actually happens but stamina decreases. How to fix this?
@Orrex945
@Orrex945 3 жыл бұрын
I did exactly like that but my stamina isn't re generating.
@myapathy
@myapathy 4 жыл бұрын
I am trying to implement this into a sidescroller project. Stamina increases and decreases as you would expect. However when i release the shift key i can no longer move. Once my Stamina has regenerated I can hit the Shift key and move at max speed. Any ideas? I have tried a few things with no luck. Viewing the blueprint while playing everything looks like it should be working. ( i can upload screenshots of my blueprint if you think it would help. )
3 жыл бұрын
If I just press the shift, the bar goes down, how can I prevent this from happening if I press only it?
@MedelAcademy
@MedelAcademy 7 жыл бұрын
Hi, how could I make the stamina don't decrease when the player isn't moving but you're pressing Left Shift? Great tutorial, fast and effective Congrats!
@GordonSeal
@GordonSeal 6 жыл бұрын
If you haven't figured it out by yet (I'm sure you have), what you need to do is to use velocity: "Get Velocity" (target should be your player-character) -> "Vector Length" -> "Is Great Than" (I used 10) --> connect that to a Branch condition and hook it into your sprint function at the beginning.
@keyk2040
@keyk2040 4 жыл бұрын
@@GordonSeal thanks that helped me
@williambaumann1843
@williambaumann1843 4 жыл бұрын
I know this is a very old tutorial, but it worked very good for me. I had a question, is there a way to increase the stamina regen rate when the character is not moving?I have been trying to figure it out but i cannot seem to get anything to work.
@bernardosardinha
@bernardosardinha 4 жыл бұрын
Did you try booleans? I would make a "IsMoving?"bool, if true Stamina Regen -> X If false -> set Stamina regen X * Y
@williambaumann1843
@williambaumann1843 4 жыл бұрын
@@bernardosardinha That method kinda worked but it also caused other weird issues with the stamina/sprint input. What I ended up doing was creating a function that gets the character movement. I was able to use that to change the regen rate when not moving. I was also able to use it to prevent the player from using stamina by pressing the shift key when not moving.
@seanhoward9924
@seanhoward9924 4 жыл бұрын
did this works great until the bar hit 0 and would not refill until i hit the button again but the function that it decreases and increases are there
@m00ntvx4
@m00ntvx4 4 жыл бұрын
works, i appreciate it! btw is their a way i can customize the bar so it doesn't look so eh?
@BiggieRat420
@BiggieRat420 4 жыл бұрын
the stamina button only goes down when i press the key, not when i hold it
@ccmesh1646
@ccmesh1646 7 жыл бұрын
I have a problem, my percent bar goes minus, so I have to wait additional seconds for it to recharge if I keep pressing shift. Also I am working with Launch Character(dodge mechanic) instead of max speed I have 3 charges, each time I press shift I lose 1 charge but it recharges after 2 seconds. If I'm left without charges I can still dodge but my bar goes minus. I tired doing "if current stamina is
@ccmesh1646
@ccmesh1646 7 жыл бұрын
Is there a way to disable the LeftShiftKey ?
@TrendingPendingVideos
@TrendingPendingVideos 7 жыл бұрын
what do u mean disable it just goto edit project settings then input??
@martinmada3956
@martinmada3956 7 жыл бұрын
Hi :) How to make this working on multiplayer game please? My stamina bar is always empty on Client
@titanicgames4785
@titanicgames4785 7 жыл бұрын
Hi there. Unfortunately I don't know much about multiplayer games and networking, but I believe you would want to create a HUD widget for each player and then create events off the timer that are called by the server to update the stamina values. And make sure the stamina variables are set to replicated. Sorry I can't be of more help but I hope that helps you get an idea of what to do.
@v4sk362
@v4sk362 4 жыл бұрын
I think the problem u had arround 7:30 was that u had looping enabled
@mmk6921
@mmk6921 2 жыл бұрын
Watching this on 2021, it worked for me thank you very much for the tutorial. But if you want the progress bar not decreased while holding a Shift Button without any movement, you should add the velocity, vector length and branch before hooking up into sprint input. I also have the question how to make character can't run after stamina is reaching 0%, and must wait until stamina is completely full to 100%? I have made a branch for the "true" condition to check if the "Current Stamina == 0" after pressing Shift button. But the problem is after character stamina reaching 0% and the progress bar is increasing to at least 1%, the character is still running. I want to make my character can't run untill the progress bar is completely full (100%). Is anyone know how to do this? Thank You..
@themouseinthehouse8484
@themouseinthehouse8484 2 жыл бұрын
Hi there any suggestion on how to set up the vector and velocity? I would really appreciate if you know a valid source that explains properly vectors, I have been struggling with those for ages.. cheers
@dinobot28
@dinobot28 5 жыл бұрын
I've updated upon this system, if anyone new to unreal (edited cause i said unity but that's the last engine i was learning) finds this comment i.imgur.com/x2TkfOZ.jpg / i.imgur.com/fp2sZvH.jpg Hoping it allows these links to imgur but that's my clean line diagram using this + improvements to allow stamina to recover when standing still, oddly enough i learned about "do once" today and actually got it implemented into this new system without problems, i've been bug testing as i go with this entire learning experience and have been overcoming so many obstacles and making improvements to code i've found using my own knowledge of programming.
@jello788
@jello788 3 жыл бұрын
can you help me with some bugs i have? :)
@clausewitz7011
@clausewitz7011 7 жыл бұрын
sry sir, I have problem in sprint system I want to "S" buttom cant use sprint How to make, thank you.
@jaxonhandt6837
@jaxonhandt6837 7 жыл бұрын
Hi there. If you are simply wanting to use a different button press than the one I showed then there are two ways you can do it. First, you could replace the InputAction Sprint event in the character blueprint with the "S" key input event. Just hook up the Pressed and Released Nodes the same way. Otherwise you could go into the Project Settings and under Input you can find the Sprint action mapping we added in the previous tutorial (Go to Edit->Project Settings->Input->Action Mappings). Then add a key by pressing the + button next to Sprint and then choose the S key in the drop down bar of the new key binding. If this isn't what you were hoping for then let me know. I hope that helps!
@LightDrag00n
@LightDrag00n 6 жыл бұрын
Well, it does not work at all. But if I press LShift it descreases Stamina even when Idle and recharges. There's something wrong with this tutorial... :(
@punkXking
@punkXking 5 жыл бұрын
same thing with me. Did you happen to find a fix
Unreal Engine 4 - AI Roam
9:22
Titanic Games
Рет қаралды 65 М.
Why Unreal Engine 5.4 is a Game Changer
12:46
Unreal Sensei
Рет қаралды 1 МЛН
I’m just a kid 🥹🥰 LeoNata family #shorts
00:12
LeoNata Family
Рет қаралды 19 МЛН
FOOLED THE GUARD🤢
00:54
INO
Рет қаралды 63 МЛН
The day of the sea 🌊 🤣❤️ #demariki
00:22
Demariki
Рет қаралды 95 МЛН
Unreal Engine 4 - Adding Basic Movement (With controller support)
14:11
Unreal Engine 4 - Jumping and Double Jumping
9:04
Titanic Games
Рет қаралды 75 М.
Unreal Engine 4 - Improved Basic Health Bar
6:40
Titanic Games
Рет қаралды 17 М.
Unreal Engine 4 - Leveling, Experience, and Skill Points (Part 4)
14:42
Unreal Engine 4 - Adding Sprint, Crouch, Jump (Part 3)
14:45
Titanic Games
Рет қаралды 83 М.
Unreal Engine 4 - AI Chase Player
7:19
Titanic Games
Рет қаралды 59 М.
Unreal Engine Materials in 6 Levels of Complexity
44:12
pwnisher
Рет қаралды 158 М.
Learning Unreal Engine in One Month to make a Game!
15:25
Will Hess
Рет қаралды 49 М.
WoT Blitz. Late Night Birthday Lotto + Gifts and Presents
1:7:55
World of Tanks Blitz
Рет қаралды 462 М.
😨 Это реально Самый Высокий миф в Майнкрафт
37:29