Progress Bar Going Past 100%

Honestly probably just setting this up wrong but I’m going nuts here.

I have a handful of progress bars and a randomized system that gives you either better or worse stats every time you start. So I’m working with one of the bars (Energy) and when I set the energy variable connected to the bar to above 100 (so say 300), it will fill the bar to 100% and only be at 100 of 300, then continues to ‘fill’ as I add energy despite being at 100% filled.

How do I get it to scale the percentage with the overall amount?

Here’s the set up in the widget

Here’s my (probably pretty badly coded) increase and decrease of Energy

1 Like

If you just put a clamp node here, you’ll be fine

But you’re right, the other code is producing dodgy results :slight_smile:

Like, should this be on the false pin?

This will also push anything over 85 too far

A clamp? Oh jeez I didn’t even think of that, lemme try that out.

And yeah it’s meant to be on the true line, it’s basically stopping it from going past the max amount. So if energy ends up greater than max energy, it drops it back to max energy. It was on a tutorial I saw, and been using it since. I’m sure there’s a better way to do this though.

Edit

Sorry I haven’t worked with clamps much before (still pretty new to all this)
Am I putting the minimum and maximum Energy in (0 and then connecting the energy into max)?

1 Like

It’s up to you, but I’d say the clamp needs to be 0 and 1, because that’s the valid range for the bar. We’re just trying to keep the bar in check there :slight_smile:

Hmm a clamp going from 0 to 1 (and trying 0 to max energy) both don’t seem to work. The bar still reaches max at 100 instead of what the max energy is set to, while the energy variable continues to fill up to its max.

Edit

Let me just grab a video of what’s going on real quick

Here’s a visual in game, displaying what the Energy variable number is at and on the yellow bar bottom right that it does not start draining until Energy is below 100

In the widget, the bar only goes from 0 - 1. That’s why you’re dividing by 100.

Then do I have to use a different method to increase the maximum energy level? I can’t show 100% of 300 instead of 100% of 100?

Try this

( second bit )

This is what I’ve done exactly, but I’m trying to set the progress bar value above 100 (1:46 in the video) and it does not display properly, that’s the problem.

So I’m just wondering if I have to go about giving the players ‘more’ energy by doing it a different way.

The bar always goes from 0-1.

If you want the players to have max energy of 300, just divide by 300 before passing to the widget :slight_smile:

1 Like

Ohhhhhhhhh okay hold on let me try this.

Alright now I’m confused :joy: I set it up like this so it could be dynamic (I have multiple values Max Energy can be) but that just somehow locks Energy to 100 no matter what Max Energy is set to…

1 Like

You’ve got the right idea.

If the max is 100, and the player has 100, then 100/100 = 1 full bar.

If you change the max to 200, and the player has 100, 100/200 = .5 a bar.

Yeah this is what I thought but for some reason when I set it up like this it’s locking Max Energy to 100, not the value I want (say, 300)

When the stats are randomized, say it sets Max Energy to 300 which should then cause this to divide by 300, when I check in game I can’t go over 100 anymore.

(Not going over 100%, going over 100 of the 300 value)

Uhhhhhhh not entrely sure what happened but I detached and reattached Max Energy to the division node and it’s all working now..?

Thanks a bunch for the help!

1 Like

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