Is it possible to make Random Float In Range Static after first number is generated?

So, I am in the process of trying to create a “Damage Dealt” widget for my rpg project so the amount of damage dealt to the enemy ai can float up on the screen for visual effect. I am running into an issue however, the damage dealt is based on a random float in range node to randomize the damage. When I refer to it in the widget to change the value of the floating damage in accordance to the actual damage deal, it is changing numbers rapidly. So I suppose my question is, how do I make the number generated static or stop generating random numbers after it has generated a random number for the damage.

Without seeing what you did… Here are some hints:

Make a boolean variable RandomDamageGenerated and a variable DamageGenerated. After you generate the first damage value, save it in DamageGenerated and set RandomDamageGenerated to true. Before you generate a random damage value you have to check if RandomDamageGenerated == false then you can. Now you’ve control when and how DamageGenerated is saved. Use DamageGenerated as value for your widget.

Hope this helps.

Edit: Static variables works a way different. The core feature is that static variables are static and not dynamic. You can’t change the value at runtime. (Its not the perfect definition but I think its a little bit clear.) So static is not what you’re looking for.

Hi

You could calculate the random float and then assign the value to its own variable.

You could then update the ‘floating text’ to populate from the variable.