How modify a float by another one's % ?

Hello

I want to influence a character’s attack by his weight. So I have a weight value that goes between 460 and 580, I would like to say that depending on the food ingested (1-100) the % of weight changes.
If the food is 50% then the weight will be 520, if it’s 75% then the weight will be 550 etc, but I can’t get the weight to follow the food… Someone can one help please?

Thanks

Now it’s right…

2 Likes

Try Map Range Unclamped.

1 Like

Thanks for the answer, but when I use this my value go to the infinite, I tried put a clamp on it but it stay stuck at 580, this is my nodes, I probably make a mistake. Sorry I’m a noob it’s my first project so I’m not understand everything completely ^^’

Percent gain has to be between 0 and 100.

Also assuming weight starts between 460 and 580, like you said.

I already tried with value range and a clamp, but it still stuck at 580 :frowning:

Try it with weight = 460 and percent gain = 0. What do you get?

Now it’s stuck at 460

Yes, then try percent = 50?

Stuck back to 580

You’re calling this on tick, aren’t you…?

yep

That’s why then.

You only need to call this once. Not every frame…

I see, but if my character eat something he can’t gain weight without tick, no ?

When he eats something, you can call this. Once. You don’t need to call it again, until he eats something else… :wink:

Ohh ok thanks very much !

1 Like

If you want the weight gain to happen gradually ( like over 10 mins ), that’s a whole other ball game…

Well, it’s : If player stay pressed “E” on a target, every 5 seconds he gain 5% food.

1 Like

So 5% every 5 seconds until, what? Is there a limit?

The limit is 100