No announcement yet.

Gradually increase score on death UMG

  • Filter
  • Time
  • Show
Clear All
new posts

    Gradually increase score on death UMG

    Hey all, I'm a bit of a beginner in UE 4 so excuse me if you don't understand what I'm talking about.

    So I've made a game based on the Endless Runner tutorials found here -

    I have made a death UMG that is added to the viewport when the character dies. I have numbers on the death screen that will display the players distance and the players total amount of coins (both of which I already have an existing variable for). However, I don't want these numbers to just appear, I would like them to gradually increase (an example of this can be found in this users video, When the character dies, instead of the numbers just appearing, they gradually increase)

    Does anyone know how to blueprint this??

    Not sure if this is the best way of doing it, I made it in about 2 minutes really quickly. In the UMG, I made 3 variables, an integer (TempScore), float (ScoreTickTimer) and bool (IncrementScore). All defaulted to 0, 0.0 and false.

    On Begin Play, set the Increment Score to true.

    On Tick, check if Increment Score = true, if it does then create a simple timer by getting DeltaTime + ScoreTimer. If this value is >= 0.05 (You can change this value to be however fast you want the value to increment in seconds. For example; in this image, the score will increase every 0.05 seconds. If you change this to 1.0, then the score will increment by 1 every second.) Then if the value is greater than 0.05 we want to reset it so that it can start incrementing again from 0.

    Then we increment TempScore by +1 and check if this TempScore is equal to the Player's score. If it is equal then we don't want to increment anymore so set IncrementScore to false. Otherwise if it's not equal, we want to set the text element on the HUD to be the TempScore.

    Note: To get the player, on BeginPlay you can "GetOwningPlayerPawn", cast this to your character and promote it to a variable.

    Click image for larger version

Name:	Score.png
Views:	1
Size:	221.8 KB
ID:	1132376


      I want the exact same thing, if you have time could you look at a thread I created and let me know how I could attach what you made to the delta for the score to gradually increment???
      Last edited by JohnADaniels; 12-25-2017, 05:43 PM.