Branch Node Doesn't Appear To Be Working

Good morning all!

I’m working on a Pokemon game for fun just to practice my UE5 skills. I’m fairly new with UE5 and have maybe about 4 months of experience.

I’m currently trying to incorporate accuracy into my game where as you’ll see in the pics below, I’m using a math expression to calculate the accuracy where currently the result is always 50. Accuracy can be a value between 0 (definite miss) and 100 (definite hit).

I then use a random float in range node to set up the chance of the attack actually hitting. If the random float in range result is greater than or equal to the Accuracy, then the attack will hit.

As shown below, it looks like the branch node is not doing its job, at least from what I can see… There two very different results which in one of them, the random float in range result is way less than the accuracy (notice the blue text in the top left of the image), yet the result still appears as TRUE.

Any ideas what can be causing this? Any input would be fantastic as I’m still quite new at all of this and maybe missed something very obvious.

The branch node very definitely does work :slight_smile:

I’m guessing something up in your custom node.

Thanks for the suggestion! What I’ve tried to do is exclude the math expression and just put a value of 50 in my >= node as shown below. It does look like I’m getting some odd results still where when the random value is greater than the value of 50, it travels down the FALSE route when in this case it should be true.

When you do this

image

the float node gets sampled 3 times :slight_smile:

So each of those wires is getting a different random float.

Omg I didn’t realize that was a thing! I was thinking that it would be copying the random float value to all the strings I printed it to but instead its just giving a random value to each of the strings individually. Problem has been solved. Thank you so much :slight_smile: