Download

Update decreasing progress bar to decrease faster by using input ?

Hi everyone,
This might be very simple but i can’t figure out how to do? I’ll explain

The progress bar is decresing on event tick with a timeline set to 100 to 0 in 60 seconds.
This is in the Character blueprint.

If LeftClick if true (pressed) i would like the progress bar to decrease faster. And if LeftClick is released the progress should just keep the “default” event tick decresing value at the current state.
But the timeline seems to take priority and the progress only update when the input is pressed even when i use the new set “current energy” value when LeftClick is released ?
Later it will be possible to gain energy so the maximum time can be more than 60 seconds for 100 to 0 energy so it’s might also be a problem ?

I ll be glad to use some logics of yours to figure it out :slight_smile: Thanks :slight_smile:

You cant mix tick and timeline like that. In tick your timeline will play 60 times per second (if your fps is 60).
Create a new event “DecreaseEnergy”, create Timeline from 0 to 1 float (like 1 second). Get current energy and substract (-) from timeline track. Set current energy and connect with Update output from timeline. It will decrease energy by 1 for 1 second (and you can decrease more if left click if pressed).
On Finished output call the same function “DecreaseEnergy” (if your energy > 0, if you need this condition to break a loop) and it will create a loop.

Thanks Mr.Wood :slight_smile:
It works :slight_smile: Decrease is set with begin play
I hope this is correct let me know if it’s not exactly optimize as you said thanks again :slight_smile:

Glad it helped.
Note that this is endless loop. Maybe you can put condition if CurrentEnergy>0 just after DecreaseEvent (before timeline).
And also on Update exit from timeline connect Is Checked? condition:
True: Current energy - (New Track 0 * 2) => Set current energy. This means that it will reduce energy twice as much when Left click is pressed.
False::Current energy - New Track 0 => Set Current energy

In this way the reduction of energy will not be dependent on frame per second.

And note that this will decrease CurrentEnergy by one every second which means it will decrease CurrentEnergy by 60 for 1 minute. If you want to decrease 100, you need to substract by 1.6666 every second :slight_smile: