How do i Branch condition a specific integer?

When im conditioning health bars in the HUD, if healthbars = 5 then the player has 5 health bars and they are drawn on accordingly on the HUD, but i dont see a why to condition a specific value

Compare int

1 Like

Thanks for the quick and good answer!

you can also do a bool check to branch with

  • (less than) <
  • (greater than) >
  • (less than or equal) <=
  • (greater than or equal) >=
  • (not equal to) !=
  • (equal to) ==

Compare int has 3 outputs for those but if you need just a simple 2 condition check for anything of A vs B those are the cleanest with a branch.

Use “Switch on Int”. When you add it, click the “Add pin” button 5 times. You can also right-click and remove the “default” pin (or click to remove it in the Details pane). Plug your health variable into Switch on Int and it’ll handle the branching for you. You can start the branching at any Int (such as 1,2,3,4,5 instead of 0,1,2,3,4). Unfortunately, Switch on Int only increments by 1, so you can’t define your own Int branches. If you need custom Int branches, use Switch on String and cast your Int to a string (just plug it in). You could rename the String pins something like 0, 20, 40, 60, 80, 100.