Hello,
I have some question I didnt find a clear answer to, so Im asking to you that surely are way more expert than me.
Lemme give some context:
Im trying to solve a problem that is about an alternative to using a couple of Branch nodes.
-I have an actor, this actor has a random Integer assigned between a min-max value that the code will assign to it and display to the player through a WidgetB. Nothing hard, very easy.
But this number is random, as I said, so in order to assign it the right Enum (I need this Enum value in order to display it correctly in grams/1 digit Kg/2digits Kg etc etc…) value I need to do basic math with branches before setting the right Enum.
-The workflow basically is: Random Int between Min-Max → Result Int >= than x, /> than or < than? Branches check → if one of this branches is true then the Enum is setted to the right value.
Example: Random Int assigned is 13000, 13000 is greater than 10000 so assign the Enum = Chilograms.
-This “random Int” is one and only one, is not setted to multiple actors but to one single actor and every time is cleared before setting it again.
Now, my question is, is there a way to zip the code and make it more “elegant” without using 3-4 branches nodes and then assign/set the right enum?
I tried using a Map Var. but the problem, as you can imagine, is the map doesnt know if the Integer belongs to Enum 1 or Enum 2 or Enum 3 because the Int is random generated, so I need anyway to use branches to check that integer before setting the right enum, so making it useless using a map and a for each loop to make a more slim code.
Is there any workaround to this problem or, considering is a random number, the only way is using basic math –> branches –> set Enum?
Thanks for the time reading this no-sense