Is value range not working?
Hi all, I wanted to use a variable for my character called "Hunger", and it would be clamped to 100 as it's max value. However, upon setting the value range up, it seems like it's still ignored. I thought this was related to the UI at first due to reading another post, but there's a slider range that says that it's used for the UI, and not value range.
Is this bugged, or am I doing something wrong? I don't want to have to manually clamp every instance I want to raise a players hunger or any other variable.
asked Feb 09 '18 at 06:51 AM in Blueprint Scripting
first i would check the value using a print string to ensure that is is the value you want. next it seems like its just not properly updating the value for your ui correct? if your using a progress bar make sure your value has been normalized so its between 0 and 1. the easiest way to do this is to create a second variable, MaxHunger in your case and use the normalize to range node. on this node you just need to plug in your hunger variable to the value and your maxhunger to the range max pin. then you can use the result from the normalizing as the value of your progress bar.
answered Feb 09 '18 at 11:29 PM
If i read your question right, you are concerned about having to clamp the hunger variable on the top end in multiple places in your code. That tells me you need a function that has an input value (food) that adds to hunger with a check to stop at 100. Then call that function verses doing individual math each time.
answered Feb 10 '18 at 01:33 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here