Sprinting And Stamina - Unreal Engine 5 Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 มิ.ย. 2024
  • Hey guys, in today's video I'm going to be showing you how to create a sprinting (running) system with stamina that drains and refills. The stamina will also be displayed on-screen for the player to see in a progress bar.
    #UE5 #UnrealEngine5 #UE5Tutorial
    ___________________________________________________________________________
    00:00 - Intro
    00:13 - Overview
    01:07 - Sprinting
    05:29 - Stamina
    12:05 - Displaying The Stamina On-Screen
    16:15 - Final Overview
    16:40 - Outro
    ___________________________________________________________________________
    If you enjoy make sure to subscribe: / @mattaspland
    Join My Discord Server: / discord
    Follow Me On Twitter: / matt_aspland
    Follow Me On Instagram: / matt_aspland_
    All My Social Media Links: linktr.ee/MattAspland
    ___________________________________________________________________________
    If you want to support me, there are many different ways of doing so. This is by no means expected or required. It is just a nice support :)
    Patreon: / mattaspland
    PayPal: paypal.me/mattaspland?country...
    Ko-Fi: ko-fi.com/mattaspland
    Thank you :)
    ___________________________________________________________________________
    To access the project files and screenshots from the video, check out my Patreon above!
    My Public Video List: trello.com/b/7vJgXzBm
    Unreal Engine 4 Tutorials Playlist: • Unreal Engine 4 Tutorials
    The Basics Of Nodes Playlist: • The Basics Of Nodes In...
    ___________________________________________________________________________
    ♫Outro Song♫
    ●Kronicle - Chill Noons

ความคิดเห็น • 265

  • @AvB.83
    @AvB.83 2 ปีที่แล้ว +5

    Thank you very much! Before this day I had never added a new movement to UE, a widget, or anything like a stamina system... three hours later, I can walk, jog or sprint, the later draining the stamina at different speeds. Very easy to understand & straight forward.

  • @RedCat_Noodle
    @RedCat_Noodle 11 วันที่ผ่านมา

    I know this an older video but it still holds up and I could follow it even as a beginner! Thank you so much.

  • @mrsniffles2528
    @mrsniffles2528 4 หลายเดือนก่อน +2

    Perfect guide you are a legend. I followed other guides that were so complex and they didn't even work. Your is simple and perfect

  • @stathiszoulakis9599
    @stathiszoulakis9599 8 หลายเดือนก่อน +1

    thank you so much , i always watch your video once and copy everything you do to get it working and then i view the video again and i focus to understand what and why you do in the video.started learning unreal engine again , i totaly understand how the stamina works now

  • @cristobalink2413
    @cristobalink2413 10 หลายเดือนก่อน

    oh man thank you for this amazing tutorial, really easy to follow and worked at the first try :D

  • @nislaav6712
    @nislaav6712 ปีที่แล้ว

    All worked perfectly, thanks a ton!

  • @stoneageprogrammer432
    @stoneageprogrammer432 ปีที่แล้ว +7

    Hey, I want to say THANK YOU FOR MAKING THIS TUTORIAL! I followed it, I added sprint to my player character in my game, and it works perfectly. You go a little fast in the tutorial, but that's okay, it teaches me to listen. I'm gonna watch a lot more of your tutorials, you are great, and please keep making UE5 tutorials for beginners like me. Thank you again.

  • @user-od4ge6ko5l
    @user-od4ge6ko5l 18 วันที่ผ่านมา

    This is a great and clear tutorial, really helped clean up my stamina system. Thanks

  • @thegeeeeeeeeee
    @thegeeeeeeeeee ปีที่แล้ว

    Great tutorial! Works like a charm

  • @obijohn1
    @obijohn1 ปีที่แล้ว +1

    thanks so much for your work. As a noob this way of learning is fantastic

  • @identitea_
    @identitea_ ปีที่แล้ว

    Helped me so much!! Thanks a bunch.

  • @inspiredexpired9137
    @inspiredexpired9137 หลายเดือนก่อน

    Well that was perfect. Thanks! got a sub!

  • @DavidGWilliams1981
    @DavidGWilliams1981 2 ปีที่แล้ว

    Works perfectly, thanks.

  • @GutStabber
    @GutStabber 3 หลายเดือนก่อน

    Very good video, well done ! nice explanations!

  • @phantomslayer9714
    @phantomslayer9714 2 ปีที่แล้ว +1

    Hi, thanks for your videos , I started learning unreal yesterday. So far all your content helped me so much in learning . Thank you so much ! Keep up the great content . An idea for something new 😅. Maybe make a video showing how to make stamina decrease when swing a weapon

  • @scarpheel
    @scarpheel 2 ปีที่แล้ว

    You are truly my saviour

  • @Skyrim973
    @Skyrim973 25 วันที่ผ่านมา

    Very nice. You can set W key in inputs, for run, The player does not need to press any button, just stop for a while to rest.. And it will stop run and star walking at the end. You could multiply your stamina by 10 by eating food or sleeping, for a certain time..

  • @Castroo
    @Castroo ปีที่แล้ว +1

    Thanks bro, I recommend people to make other things by what you learned from this video like making character slow walk by pressing alt and so on, will help in remembering it later.

  • @theetashopunkster338
    @theetashopunkster338 ปีที่แล้ว

    what an awesome vid, thanks bro!

  • @offirbaruch7895
    @offirbaruch7895 ปีที่แล้ว +22

    Matt. Excellent guide.
    Just one remark.
    I would really recommend you to use Event dispatchers in the drain/regen events instead of binding functions in the widget. Dispatchers event will only call upon change of stamina and will not perform the check every frame like your guide mentioned.

    • @xssplater1
      @xssplater1 ปีที่แล้ว +1

      Thank you!👍

    • @FarmerJoe-fs4nv
      @FarmerJoe-fs4nv หลายเดือนก่อน

      Hey bro, may I ask how this can be done and what this improves upon? (Performance, Accuracy, Etc.)

  • @TwinGeminiStudio
    @TwinGeminiStudio 6 หลายเดือนก่อน

    Wow. Amazing. Thank you.

  • @playbyan1453
    @playbyan1453 ปีที่แล้ว

    Good tutorial, also beginner friendly too

  • @thelostangel45
    @thelostangel45 6 หลายเดือนก่อน

    Well, thats two for the night, thanks again!

  • @MCgrant360
    @MCgrant360 10 หลายเดือนก่อน +1

    I have been suck on this for a long time, Due to an "infinite" loop. When i found this video, i was excited to find out what i was doing wrong. Thanks for another great tutorial, Matt!

    • @KTW_Monterrattian
      @KTW_Monterrattian 8 หลายเดือนก่อน

      How did you fix your infinite loop error

    • @KTW_Monterrattian
      @KTW_Monterrattian 8 หลายเดือนก่อน

      Cause I’m having a similar issue

    • @MCgrant360
      @MCgrant360 8 หลายเดือนก่อน

      It was back when I was trying to figure it out my self. I don't know why the code on the video should cause an error. Maybe check over your code once more.

    • @cosmicgub1014
      @cosmicgub1014 3 หลายเดือนก่อน

      ​@@KTW_Monterrattian in character blueprint delete the "STAMINA REGEN" node and keep it only in stop sprinting function

  • @raccoon_05
    @raccoon_05 ปีที่แล้ว +1

    Great tutorial. Got a nice stamina system in my game thanks to you!

  • @Medricito
    @Medricito 2 ปีที่แล้ว +1

    Hi! This Was A Amazing Tutorial, I Wanted To Implement One More Function With The Stamina Bar, When The Character Stop Sprinting, I Want It To Wait For A Few Seconds Before Starting To Fill The Stamina Bar Again, Thank You So Much!

    • @bl1zz4rd.
      @bl1zz4rd. ปีที่แล้ว

      can you add a delay before the command?

    • @coincape433
      @coincape433 ปีที่แล้ว +2

      on stop sprinting just do a custom event instead of regen I it called regen delay then put the delay part and then the regen part.

    • @SpasticLlama
      @SpasticLlama ปีที่แล้ว

      @@coincape433 I know this is months old but I didn't see anyone give you a response to this and I wanted to say thank you because this was driving me crazy

  • @Mohamed88Hassan
    @Mohamed88Hassan 4 หลายเดือนก่อน

    I really love ur videos u r amazing keep going body , ty 😇

  • @samuraiyt4453
    @samuraiyt4453 2 ปีที่แล้ว

    Perfect for my game!

  • @ickebong5890
    @ickebong5890 ปีที่แล้ว +41

    to get rid of the losing stamina while pressing shift and not moving do this
    Where you set inputAction Sprint Pressed/released create (get velocity) then connect it to a !== and connect that to a branch (b + left click). Delete the connection between Pressed and start sprinting and instead connect it to the branch you just created. Connect the true value of the branch to the start sprinting, now its fixed :D

    • @brady9621
      @brady9621 ปีที่แล้ว +1

      Still didnt work

    • @spyn5574
      @spyn5574 ปีที่แล้ว +1

      its working but when i stop pressing the button to move forward its continues to take energy away from me...

    • @vasi3005
      @vasi3005 ปีที่แล้ว +1

      @@spyn5574 Just connect the "Released" to another Stop Sprinting node. It wont fix everything but that is something that solves a lot :)

    • @MidnightTheFolf
      @MidnightTheFolf ปีที่แล้ว +1

      This helped me a lot, but I had another problem after, while holding forward and sprint, then letting go of forward, your stamina would still decrease. An easy fix is to connect all the nodes attached to the Branch to the Drain Stamina custom event, and connect True from the Branch to the Set Stamina.
      (EDIT. I also put the nodes on the Event Tick, with an == Vector and connected True to the Regen Stamina. Also you can call Stop Sprinting after you call Regen Stamina, make a Branch and check for if move input is ignored with "Is Move Input Ignored", then copy Stop Sprinting and Regen Stamina to the end and connect True. This fixed the problem where if you hold forward and sprint, then let go of forward to come to a stop and hold it again, I'd still be at sprint speed, but no stamina would be used.)

    • @bsg8761
      @bsg8761 ปีที่แล้ว

      Sorry I'm late.
      If you guys want it the way I did where press+no movement =shows no draining bar. Holding shift+no movement =showing bar then + movement= adding drain, and moving+holding shift=show bar and drain.
      Do exactly as this comment says.
      On pressed set the display widget first - connect it to this branch created like above first. On fail run the sprint code.
      On true run a short delay even default, then connect the delay to the start of the branch.

  • @kresus10
    @kresus10 7 หลายเดือนก่อน

    Amazing.

  • @ErodonTV
    @ErodonTV ปีที่แล้ว

    Great video thanks!! Is there a way to just increase speed by increments on button press or do we need Cpp for that ?

  • @brunovelez4329
    @brunovelez4329 ปีที่แล้ว

    Great!!

  • @lossapote
    @lossapote 2 ปีที่แล้ว +1

    I love your videos. I wish if you can do a tutorial of lock-on to an enemy

  • @agus11125
    @agus11125 ปีที่แล้ว

    good video, I used float values for the stamina properties

  • @DarkPlayerBr
    @DarkPlayerBr 4 หลายเดือนก่อน

    great tutorial 🕶

  • @Venomulta
    @Venomulta ปีที่แล้ว +1

    Matt I really appricate your effort of making those tutorials you are one of a kind.
    do you have petreon or anything so we can support you for the good work ?
    again Thanks a lot !!

    • @MattAspland
      @MattAspland  ปีที่แล้ว +1

      Thanks for your support mate, super happy I could help! :)
      I do indeed have a Patreon yes, thanks again!
      www.patreon.com/MattAspland

  • @HaydenHancock0
    @HaydenHancock0 8 หลายเดือนก่อน +6

    Great tutorial! There are a couple of issues that I found.
    - Stamina will decrease if you press the sprint key (even if not moving)
    - When tapping the sprint key, the stamina progress bar doesn't get to 100

    • @sycho_zer0edits451
      @sycho_zer0edits451 4 หลายเดือนก่อน

      how to fix it?

    • @GangsterFrankensteinComputer
      @GangsterFrankensteinComputer 3 หลายเดือนก่อน

      @@sycho_zer0edits451 add a branch before draining stamina to detect velocity on x and y axis.

    • @larsbrockob
      @larsbrockob 2 หลายเดือนก่อน

      @@sycho_zer0edits451 Add a branch right after your Drain Stamina Custom Event in the Player Character. To set the condition get ´Get Velocity´ (Target is ´self´) Out of the ´Get Velocity´ return value get a "Vector Lenght". Then Out of the Vector Lenght Return Value get a ´Greater´Operator and set the second value to ´0´. That creates a Boolean Condition (Red Output) that must be connected to the Branch Condition you created in Step 01 of my description. Connect the ´True´ of that branch to your existing code (Must be the Execution Path of Set Stamina, i think.). No go to the end of your Drain Stamina Code and Copy the Delay and the Drain Stamina Call that you´ve placed after the "Is Sprinting=true" Branch. Paste this to the beginning of the code and connect it to the False Output of your "GetVelocity-VectorLenght-Greater´0´ Branch that you´ve created in Step 01.
      Out of that Drain Stamina get another branch (I call it "Branch X" here for an easier understanding).
      Now Copy and paste the Get Velocity&Vector Length you just created and add a "Less" Operator to the Return Value of Vecor Lenght. Set the Second Value to 0.1. Drag out of the Boolean Condition (Red Dot) and connect it to the Condition of "Branch X".
      That will Gain your Stamina, even if you still press the Sprint Button after you stopped moving in Sprint.
      I hope it´s easy to understand?!?! Otherwise feel free to ask.

    • @thehobbist5544
      @thehobbist5544 หลายเดือนก่อน

      Did you ever find a fix?

    • @GangsterFrankensteinComputer
      @GangsterFrankensteinComputer หลายเดือนก่อน

      I'm pretty certain I replied with a fix. Definitely replied as I got a notification, no clue why my comment was deleted.
      Anyway, you can fix the stamina drain while not moving, by adding a True/False for player velocity in order to perform the Sprint.

  • @tehf00n
    @tehf00n 2 ปีที่แล้ว

    Strange but you keep doing tutorials on things I've just done. :D

  • @devformation
    @devformation 2 ปีที่แล้ว

    Thanks alot!

  • @Lendu_
    @Lendu_ 4 หลายเดือนก่อน +2

    for those who have the bug of the regen and drain at the same time, change the trigerred to started in the input action

    • @luisnache9688
      @luisnache9688 4 หลายเดือนก่อน

      Hey man, sorry to bother you, but, i did the dash movement and i don't know how to connect it with the stamina, could you help me out please?

    • @Lendu_
      @Lendu_ 4 หลายเดือนก่อน +1

      @@luisnache9688 you have to create a function referenced by the sprint input action that make the reference of a custom event

    • @luisnache9688
      @luisnache9688 4 หลายเดือนก่อน

      @@Lendu_ this is so complicate, i don't wanna bother anyone, but how do i do that?, i sorry!, it's my second day on this and most videos aren't focused on this type of answers

    • @Lendu_
      @Lendu_ 4 หลายเดือนก่อน

      @@luisnache9688 i don't know what is so complicate for you

  • @toufu_studio
    @toufu_studio ปีที่แล้ว

    Thanks for the great tutorial!
    May I use the content presented in your tutorial in my game?

  • @user-kv6sg3gq2d
    @user-kv6sg3gq2d หลายเดือนก่อน

    nice

  • @sonofzues8414
    @sonofzues8414 ปีที่แล้ว

    Thank you very much

  • @o0jager0o81
    @o0jager0o81 ปีที่แล้ว

    thanks so much

  • @JustMe1272
    @JustMe1272 8 หลายเดือนก่อน

    one note: By writing the code and just run the game to check if it really works but visible to the viewer. There should be checks.
    Otherwise great tutorial thanks!

  • @hoomankollol6379
    @hoomankollol6379 2 ปีที่แล้ว

    👌👌👌👌

  • @wesss9353
    @wesss9353 2 ปีที่แล้ว +5

    sound effect for when sprinting? foot and breathing
    How about a level up system like fallout when you can increase the amount of stamina after a character upgrade.
    General character upgrade tutorial will be great

    • @Urzart
      @Urzart ปีที่แล้ว +4

      Idk if you still need the breathing, but here it goes:
      In the drain stamina -> connect the stop sprinting function to -> "Spawn sound at location" node -> connect location to -> "GetActorLocation" node.
      That's for a heavy breathing after running

    • @wesss9353
      @wesss9353 ปีที่แล้ว

      @@Urzart thank you for the assistance

  • @Venomulta
    @Venomulta ปีที่แล้ว +2

    Hey Matt could you tell me how can I make delay for one second to regen stamina ?

  • @paraboy5629
    @paraboy5629 2 ปีที่แล้ว

    👍👍❤️❤️

  • @MrTreeGuy
    @MrTreeGuy 2 ปีที่แล้ว +18

    Hey matt! I was wondering if you could make a tutorial on how to save variables such as booleans intergers etc. even when u quit the game those variables are still saved. Thanks for reading!

  • @johnmiller4998
    @johnmiller4998 ปีที่แล้ว +2

    hey guys so if you get an error about not having bp third person inherit player controlller heres the fix
    The warning message is because you are trying to cast a PlayerController into a Character (never gonna happen)… But, the solution is very simple! Just replace the “Get Player Controller” node with a “Get Player Pawn” node. Hope this helps!

  • @KaiJohnson-zf7ci
    @KaiJohnson-zf7ci 9 หลายเดือนก่อน +1

    matt for some reason I cant get event begin play, there is already one of them, could I have some tips?

  • @flowercrowned3550
    @flowercrowned3550 5 หลายเดือนก่อน +1

    I had the same issue that a lot of others had with the stamina depleting even when you stopped sprinting and I found the issue (at least mine). I went into the "Stop Sprinting" function and unchecked the "Is Sprinting?" checkbox, because if the character is NOT sprinting, we should regenerate the stamina.
    At 3:55 he unticks the box. I completely missed that as I was following along lol

    • @hunterjenkins576
      @hunterjenkins576 8 วันที่ผ่านมา +1

      holy shit you are right lol I did all the things everyone else did in the other comments but you should be at the top this is the solution to the problem we're all facing, thank you man

  • @svallone7725
    @svallone7725 ปีที่แล้ว

    How would you make main character limp from damage, attack or from falling? any tutorials or help with it???
    & luv your tutorials man… thank you so much… 👨‍💻🌎

  • @vum3819
    @vum3819 2 ปีที่แล้ว +1

    Hi Matt! Can you make a crouching tutorial for Unreal Engine 5. Thanks you.

  • @WM_Plays
    @WM_Plays ปีที่แล้ว

    can you make it so when you jump you drain stamina? Also great tutorial!

  • @TheRealLM_FN
    @TheRealLM_FN ปีที่แล้ว +1

    my project seems to priorize the default speed. When the defaut is 300, the walking in 300 and the run is 600, its locked up to 300 in both walking and sprinting. It glitch and seems like the player is locked in a grid snapp

  • @astralstormgamestudios1259
    @astralstormgamestudios1259 6 หลายเดือนก่อน

    What's the reason for making functions when you could make it right in the event graph? Is functions a cleaner and more reliable way?

  • @KylezUwU
    @KylezUwU 11 หลายเดือนก่อน

    Anyway to have it so you cant sprint until the stamina is fully regen?
    Also when standing I still use stamina. Comments on this cant seem ro resolve the issue.

  • @simondelguste
    @simondelguste ปีที่แล้ว +1

    Hello ! Great video, as always ! I was just wondering : is there a simple way to make the stamina bar showing only when we press the sprint button ? Thank you so much for your answer !

    • @magegames6202
      @magegames6202 10 หลายเดือนก่อน +1

      make a widget for just the stamina bar on the on pressed for sprint create that widget add to viewport on the released event add a remove from parent node and plug in the blue line from the created widget then when you run it appears and when you stop it vanishes you can add a delay before the remove widget so players can see it start regening before vanishing

    • @simondelguste
      @simondelguste 10 หลายเดือนก่อน +1

      @@magegames6202 Thank you so much for this tip ! Will try it asap !! 🙏🙏🙏

    • @magegames6202
      @magegames6202 10 หลายเดือนก่อน +1

      If you get confused let me know and I'll post a video showing you how I did mine I have it working how you're talking about doing it

  • @ApocalypsFroid
    @ApocalypsFroid ปีที่แล้ว

    hello sr. can you make experience bar to get when kill monster ?

  • @crazypopcorn7801
    @crazypopcorn7801 ปีที่แล้ว +2

    it's working but even if my character is standind still, if I hold left shift the stamina starts consuming, can someone tell me how to fix it?

  • @user-oe6go2nz4f
    @user-oe6go2nz4f ปีที่แล้ว

    hello I want to ask if my character was stop and Iwas press the shift at the same time but I dont want to minus my stamina how should I do

  • @32bitbailey
    @32bitbailey 2 ปีที่แล้ว

    hey! quick question do you think there is a way to implement this into a boost system for a racing game? thanks again :D

  • @Rapid412
    @Rapid412 ปีที่แล้ว

    Hey, so have been trying to add a Event begin Play to my BP but it wont let me, please help

  • @punkx4044
    @punkx4044 9 หลายเดือนก่อน

    very greate tutorial!! but can you help me with another problem which is related to speed? I'm trying to create a character movement like in the game Super Mario Bros. Mario starts walking at low speed and gradually accelerates (without pressing additional buttons). In Unreal Engine, the player uses the same movement speed (starts walking at the same speed, continues walking at the same speed and stops instantly) Thank you!

  • @gustavbechmann8952
    @gustavbechmann8952 8 หลายเดือนก่อน

    How would you create a delay after you stop sprinting, before you regen stamina?

  • @d5k4capy62
    @d5k4capy62 ปีที่แล้ว

    ty

    • @d5k4capy62
      @d5k4capy62 ปีที่แล้ว

      @@brainrotw yes

  • @LaceUpBrah
    @LaceUpBrah 9 หลายเดือนก่อน

    Something is really strange, I've literally double checked and everything works as intended in game but the stamina widget doesn't change at all like it would be empty at all times even though it isn't.

  • @elious611
    @elious611 10 หลายเดือนก่อน

    When i create an event begin play, only the one create will stay stopping me from moving, is there a way to fix this?

  • @spiderraptor95
    @spiderraptor95 10 หลายเดือนก่อน

    Great Tutorial! I was able to use this perfectly on a UE4 project I've been working on. Although in my project, I have a main menu. And I noticed that the stamina bar appears on my Main Menu. Do you know how I would be able to remove the Stamina widget from the menu so it only shows in my actual game level?

    • @patrickclausen6922
      @patrickclausen6922 9 หลายเดือนก่อน

      Either make the main menu a seperate level or hide the widget. That would be my guess

  • @magegames6202
    @magegames6202 10 หลายเดือนก่อน

    i used niceshadows tutorial for making a round stamina bar anyway to link that to this i can change the percen manually but i want it to do it in real time automatically or maybe you can show us how to make a round stamina bar like breath of the wilds or genshin

  • @ayaanhaque6340
    @ayaanhaque6340 2 ปีที่แล้ว

    Hi Matt. Could you make a tutorial on a sinking ship? Like a cannonball/bullet puts a hole in it and causes water to flood in. Because the default UE5 water isn't completely physicalized, You could spawn in a Niagra Fluid at the impact point and cause it to flood the ship, maybe setting a specific weight in the process that could sink the boat.

    • @wesss9353
      @wesss9353 2 ปีที่แล้ว

      Sea of thieves?

  • @thecrusader1673
    @thecrusader1673 6 หลายเดือนก่อน +1

    If you're consuming stamina while standing still then this is how you fix it.
    Acquire a "Get Velocity" blueprint and from it's Return Value connect it to a "Not Equal Exactly (Vector)" , then create a branch and connect the "Not Equal Exactly (Vector)" to it's condition. From "Input Action Sprint" reconnect "Pressed" to the Branch, connect the "True" from the branch to "Start Sprinting" and connect the "False" to Stop Sprinting".
    Now you may not consume stamina upon standing still but if start sprinting and then immediately stop and continue holding down shift, you will continue to consume stamina. To fix this last problem you must get your movement input action and connect "Pressed" to the branch and "Released" to stop sprinting just like your sprint input action.

    • @boigebbz930
      @boigebbz930 6 หลายเดือนก่อน

      The top is very helpful and clear but I'm still having trouble with the last part. I can't find the movement input that you are talking about.

    • @thecrusader1673
      @thecrusader1673 6 หลายเดือนก่อน

      @@boigebbz930 Ah, there is no movement input action in the tutorial but it is assumed that you have input actions for WASD so you can move around. I had an enhanced input action that covered moving for forward, left, right and back.

    • @thehobbist5544
      @thehobbist5544 หลายเดือนก่อน

      If you are having this issue in the first place, go into the "stop sprinting" function and just uncheck the "IsSprinting?" box under the set node.

  • @ghosteso6797
    @ghosteso6797 ปีที่แล้ว

    I’ve followed this through twice and I’m unsure what’s going wrong. Instead of regen stamina at event begin play, my project is regenining stamina when I press the keybind I set up to sprint?? Can anyone help!?

  • @ABC5-mk9jc
    @ABC5-mk9jc 2 หลายเดือนก่อน

    Hi everyone, if suddenly you find stamina isn't working make sure you've set max stamina to a number like 100 instead of leaving it at 0 by mistake.

  • @pettybeats2731
    @pettybeats2731 2 ปีที่แล้ว

    Would you be able to help me find a tutorial for my 3D game where I want there to be 3 lives and once they are all used up it goes to a game over screen? ( I already have it so that once my character dies the level respawns but there is no system in place for him to run out of lives)

    • @tehf00n
      @tehf00n 2 ปีที่แล้ว +1

      You simply use the respawn example on the Unreal documentation and when you fire the OnDestroyed event, check if you have lives left, subtract one from your lives. If it hits 0, goto your game over widget.

  • @tigertazdaisyban
    @tigertazdaisyban ปีที่แล้ว

    how would you make this a power up?

  • @oliverbrown9634
    @oliverbrown9634 ปีที่แล้ว +1

    at 2:11, for some reason, rather than having when key pressed and when key released i have unnamed and axis value, which is a float output. how do I fix this?

    • @TheRealLM_FN
      @TheRealLM_FN ปีที่แล้ว +1

      the input you created is an axis input, should be an action input

  • @Axel0689
    @Axel0689 7 หลายเดือนก่อน

    Can this mechanics be linked to other actions, such as rolling or other? That is, as I perform rolling, I consume stamina. And when I get to a specific percentage, I cannot perform rolling.

    • @painpega
      @painpega 6 หลายเดือนก่อน +2

      I managed to do it for jumping, so I imagine you can do it with rolling too. I used the default jump and literally just copy pasted the drain stamina section and connected it to the blue Jump box next to the EIA. Make sure to delete the Stop Sprinting box connected to the true section of the first branch. Then you can change the value in the Subtract node to make jumping take as much stamina as you want
      I imagine you would do the same thing with any other mechanic as it's really just a keyboard input with that functionality added to the end of it

  • @nocapsfpv8509
    @nocapsfpv8509 ปีที่แล้ว

    Been leanring UE5 for about a week now. When I start to play , I begin to sprint but when I release left shift the character doesn't stop sprinting. The stamina doeant deleat smoothely . When you start to spring it take a few seconds and the stamina bar goes to about 20 percent full . Never all the way down. Then it never regenerates. I have watched this video many many times and tried some tweaks but nothing seems to work . Any suggestions would be greatly appreciated!
    Update . I was able to get most everything working . However I am having trouble with the stamina bar not depleting fast enough while sprinting. It also regenerates way to fast . Thank you .

    • @notion8329
      @notion8329 ปีที่แล้ว +1

      You can make your stamina drain faster by decreasing the delay time or changing how much gets depleted. Same goes for regenerating the stamina.. Keep in mind if you change the delay time don't also change the add/subtracting stamina value.. Because then you will end up in the same predicament
      Delay time => Higher the value the slower it regenerates or depletes.. Lower the value the faster it regenerates or depletes.

  • @duckyducktape4205
    @duckyducktape4205 6 หลายเดือนก่อน

    help at 14:00 „get stam“ doesnt show up

  • @JerrysCousinn
    @JerrysCousinn 2 หลายเดือนก่อน

    My only issue I am having is when my character dies and respawns the stamina bar does not fill back up when I posses a new BP_Thirdperson. The function works perfect, it just doesnt show that the bar is filled back up after death and respawn

  • @prishongamer300
    @prishongamer300 10 หลายเดือนก่อน

    How are you get event beiginingplay

  • @mthangtrng8056
    @mthangtrng8056 8 หลายเดือนก่อน

    how can I create another beginplay event?

  • @sk.mahdeemahbubsamy2857
    @sk.mahdeemahbubsamy2857 2 ปีที่แล้ว

    Can you please make a tutorial.on how to make a hacking mini-game in unreal engine like the bypass mini-game in Mass Effect?

  • @Skeltcher
    @Skeltcher 2 ปีที่แล้ว

    I followed your guide on how to create a health bar, I was wondering if there is any way to show all the widgets on the same screen. It would make it easier to position them correctly.

    • @MVzin771
      @MVzin771 2 ปีที่แล้ว +2

      just duplicate the health bar widget just to align the stamina bar with the health bar and delete the heath bar from the new one
      and then in your begin play event just add a Sequence node and connect the health bar on "then 1" and the stamina on "then 0"

    • @Skeltcher
      @Skeltcher 2 ปีที่แล้ว +2

      @@MVzin771 Thanks, i'll try that!

  • @agentshadow6618
    @agentshadow6618 7 หลายเดือนก่อน

    I have issue please anyone help, how can i make chracter run when he is holding shift

  • @leosky789
    @leosky789 ปีที่แล้ว

    I'm stopping but my stamina run away from me. I wondered why. Because I recheck everything. What's the problem here?

  • @deanthedev
    @deanthedev 3 หลายเดือนก่อน

    Great tutorial. But if I stay still and hold shift stamina goes down.

  • @tianzlatev3119
    @tianzlatev3119 ปีที่แล้ว +1

    how to make jumping take stamina?

  • @charzardking9419
    @charzardking9419 หลายเดือนก่อน

    how come mine does not drain the stamina like at all and why does it also not stop sprinting when I don't hit sprint it walks when I don't hit but when I do once the character is running for the rest of the code

  • @devastaterboy8227
    @devastaterboy8227 5 หลายเดือนก่อน

    I have a problem my stamina bar is not decreasing when I release l shift

  • @drgrass80
    @drgrass80 ปีที่แล้ว +2

    I have one issue the event begins play i can't use two of them because u have the one already so how did u get the second

    • @RinateZ
      @RinateZ ปีที่แล้ว +3

      If you still don't have a solution try adding "Sequence" connected to "Event BeginPlay" which will have two outputs of "Event BeginPlay" or more. That's what I did at least.

    • @WarIsntOver
      @WarIsntOver ปีที่แล้ว

      @@RinateZ Thanks, this helped me.

  • @UltraMonS12
    @UltraMonS12 ปีที่แล้ว

    How Can I make this work In Multiplayer

  • @yberkiwi7347
    @yberkiwi7347 ปีที่แล้ว +25

    there''s one issue, u drain stamina when u press shift, even if u're not moving

    • @ajfraser224
      @ajfraser224 ปีที่แล้ว +5

      I guess there is probably some kind of IF statement you could use for this, like disable left shift if the character is not moving

    • @chikinfinguh
      @chikinfinguh ปีที่แล้ว +2

      make your axis mappings for forward/backward/left/right into a 2d vector length and check if it is == to 0 and then that should connect to a branch which will check if the player is moving or not

    • @dark11demon11
      @dark11demon11 ปีที่แล้ว

      @@chikinfinguh in this case you won't generate stamina when you just walk...

    • @chikinfinguh
      @chikinfinguh ปีที่แล้ว

      @@dark11demon11 generating stamina and draining stamina should be different functions. so they won't effect each other

    • @dark11demon11
      @dark11demon11 ปีที่แล้ว

      @@chikinfinguh wait I just woke up and wrote something that not what I meant. So disregard first message. the two functions are supposed to be symmetrical. I'll experiment in code. I remember Either you not gaining stamina while shift, or you won't be able to run again still holding shift and press W. But I need to get to code to see where I left last night

  • @MegaSmithGaming539
    @MegaSmithGaming539 ปีที่แล้ว

    Great tutorial! The only problem im having is that i dont start a game walking. I start and im sprinting with no stamina loss then i press sprint and it goes normal, any ideas?

    • @eliahmimon222
      @eliahmimon222 ปีที่แล้ว +1

      Change your default max speed on your character movement to the walk speed you made

  • @name_isme3245
    @name_isme3245 4 หลายเดือนก่อน

    hey, i want to make it so if you press shift before moving it still sprints. i tried making it so that when you press wasd it checks if your prssing sprint then calling start sprint on true, but that only worked when pressing 2 movment keys. any help apreciated. Edit: i also on start sprint it will check your velocity to determin if you sould sprint.

    • @weebdesu1224
      @weebdesu1224 2 หลายเดือนก่อน

      Unreal has built in function names Is Moving on Ground that returns a bool if the player is walking or driving on the ground. You can use that to determine to sprint or not.
      Edit : Thats not working, dunno why. But you could get velocity of character movement component and take its vector length then check if its bigger than 0. If it is that means the character is moving.

  • @xxspecterxx
    @xxspecterxx 11 ชั่วโมงที่ผ่านมา

    I can’t figure to change the drain speed, I also drain stamina when not moving

  • @luxon1232
    @luxon1232 ปีที่แล้ว

    in the widget, I can't move my progress bar and I can't make it bigger, can someone help me? (I don't speak English)