Basic Math How To

I am trying to read a float variable and decide if its > a value. If it is not larger, I want to leave it alone. If it is larger, I want it to take a value I assign it.

For example…

If A>7 {A=7;}
else{}

Im not sure how to translate this to blueprint. I have a node for Get A… I check it againts the value with > node … Then the output for this is a boolean result. If it is true, how do I go about setting A to a value I choose?

You can use the ‘If’ (called Branch) node to do something based on a condition. The ‘If’ node has a boolean input pin. Connect the boolean output of ‘>’ node to this node. Then create a ‘Set A’ node and connect it to the output pin of ‘If’ node. You can the use the Value field of ‘Set A’ node to provide the value to set it to - in your case ‘7’.

Eg:

here is the documentation about various flow control nodes:

You can use the “Min” node: https://docs.unrealengine.com/latest/INT/BlueprintAPI/Math/Float/Min_float/index.html

One of the input parameter is your float variable, the other will be the value “7”. The result will be the lower value.

Thank you, Branch ended up being exactly what I was looking for.

I take it that you want to “clamp” it?

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Math/Integer/Clamp_int/index.html