Filling a bar on button hold works, reducing the value on hold does not.

Hello,

I’m working on a golf project and I am trying to fill a power meter while a key is being pressed. It works as I’d like. The BP is below.

The counterpart to this is another key lowering the bar value/location while being held. If I PRESS the key, it does lower. When the key is held, there is no response. not until i release the key and then the value lowers.

I’m not sure if the same instance of the ‘Launch Speed’ variable needs to be updated. Or if there is just some simple thing I am missing, but I’ve been at this for a couple days now and I am just stuck. The BP for this section is below, please excuse the mess: I was testing a few things out.

Please let me konw if I need to provide any more clarity. Thanks in advance for your response.

Hi demoicheddgehog,

Just looking at the second BP, on the Pressed you should be setting “Is Lowering” to true - that should at least get it past that branch (which isn’t needed as it will always be true).

Thank you for that.

I caught that as soon as I posted it. Great catch. I made that variable so I could replicate the flow using the ‘Is Charging’ boolean in the First BP. I can’t seem to get it to respond to the tick the same way, (pretty sure that’s where my issue stems from).

Yeah probably in the tick - can you share a snapshot of the rest of the tick code?

Of course.

The tick starts off the entire chain. The first bit keeps the spring arm component on the same location as the sphere mesh component. It then kicks out and checks the ‘If Charging’ boolean. If so, it raise the value based on the tick + the button being held. It’s then divided by it’s max value to I could make it an 0.1-1.0 range for the progress bar.

I basically replicated the same process for the lowering function, but (my guess) is that it’s not connecting the tick to the lowering KB input.

How about simplifying it a little by making a positive or negative multiplier instead of the hard coded 1000.0 - then it could be as simple as:

First off, I appreciate the insight. I knew there was a cleaner way to run this, I just couldn’t figure it out.

I have set up the blue print with your changes, and added them into the remaining flow. (Below)

It all still “works”. It let’s you raise and lower the Launch speed and the balls fire at velocity relative to the value.

What isn’t working the hold meter value increasing as the button is held. The value goes up, but the bar only goes up or down is the button is pressed. Holding has no change visually on the bar. This is the thing I’ve been stuck on overall.
(Bar is a simple progress bar widget referencing the ‘Meter Speed’ variable. Image Below)

It’s also automatically going up on it’s own after it’s pressed. Even when the Left arrow (lowering key), the value DOES lower, but raises with no input from the player. I’m guessing it’s a loop somewhere that’s not triggering the stop. I have been unable to discover what that is quite yet.

Thankyou for all of your efforts on this.

No problem!

It might be that the “Meter Power” variable should be separate from the “Charging Amount”:

You are a wizard.

That’s SO MUCH cleaner. Thank you so so much for your time and efforts on this.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.