# How to randomly select a float input?

Hey there! I’ve recently tried to implement bullet spread/bloom.
I wanted to do it smoothly, so that overtime, the longer you aim, the more accurate the bullet is gonna hit. I did the first step by creating a timeline, that smoothly transitions from the max spread value all the way to zero. Then I didn’t want it to shoot in only one direction. So I was thinking about randomly selecting an input, where the value should be added. But I for the life of me cannot figure it out. I tried different multigate options, different array nodes and such. But it is not really working.

How do you randomly select a FLOAT output you want to use?

1 Like

Not sure how you want it to work exactly, but you could try experimenting with:

We start at factor 2 and it goes down to 1 after 1s. The TL’s output could generate a value whose range is ever decreasing:

When we start firing the range is -20 <> 20, after 1s the random range would be -10<>10. You will need to massage the values and the curve to suit your needs, ofc.

There might be better ways, the 1st thing that came to mind.

A maybe tip - TLs can dynamically load external curves - that’s one way to make each gun (that holds such curves) have different bloom while still using 1 TL for all guns. May be irrelevant, though.

1 Like

Yeah, sorry, I do not think we understood each other. The timeline works as it is. I meant, that I want to sometimes set the value from the timeline for pin A. Sometimes for pin B and so on. I need a way to randomly select the float input.
But thank you nonetheless, because this will be helpful for future mechanics .

Nevermind. I figured it out, instead of setting the timeline value as the offset I use that + a random float, so thanks again, because I wouldn’t even have thought about using a random float there.

I’d set a min spread float. Then using the TL alpha to multiply the spread based on how long you hold to steady. So long holds get lower spread/deviation.

1 Like