I was wondering if there was a simple way to increase a variable while it is true, and decrease it at the same rate when it is false. I am trying to create a simple timed event, where the player must hold down a button for a set amount of time, with the timer dropping if the button is released before the count is finished.
I understand the logic, but how would I do this in blueprints? I can’t use if and else statements.
Have you tried using the Branch node? You should be able to use the Branch node for if/else statements. Using that on event tick or a timed function seems like it would do the job if I’m understanding you correctly.
I tried doing this with onhover and it didn’t work, so I recreated what you did and it still doesn’t work.
What exactly does not work? Is your input (F) enabled? Speed has a Value greater than 0?
Oh wow, I’m just terrible. I had speed set to 0
Tick → If(ButtonDown) →
Counter = Counter + DeltaTime x Speed
else
Counter = Counter - DeltaTime x Speed
Speed is simply How much you want to add to your Counter per second. The Clamp is optional but it keeps your Value between Min and Max so you dont go -100000 if you dont push the Button