Huge switch statements; is there a way to run code in order without checks?

Edit: Found Multigate is what I wanted but it breaks after adding 30+ outputs, so it isn’t working. It simply won’t run if I have more than 30 outputs. Anyone know why?

I am trying to make a mini-music game that has about 500 beats. On each beat it may run a different code. Is it ok to use a Switch on Int statement (counting the beats) for 500 of them? After adding 30 the editor’s Switch statement becomes weird (dissapears when I Add pin, need to scroll back up to make it appear again) and so adding 500 would take crazy long.

What would help this and save the game to do a huge check is to just have a repeatable execution node that proceeds to the next node after the previous has ran. Something like:

you are looking for the Sequence node. as awful as it sounds. lol.

if you have a problem with 500 on a single sequence node, just split them up to levels, so for example the first sequence will have 10 outputs, each leading to another sequence node…etc…

tip: nodes menu (right click in blueprints graph) contains drop-down stuff by categories. sequence is in “Flow Control” category, which is very useful and in my opinion everybody has to learn all of them (not too many) to be effective. it’s worthy.

good luck :slight_smile:

Hey Arty,
Thanks for your answer, however Sequence isn’t what I’m looking for since it executes all outputs at the “same time”. What I want is only one output executed whenever it is being inputted.

then you should use MultiGate node, from the same section (Flow Control), it plays “the next output” each time it gets an execution input.

It was the first thing I tried, but MultiGate node seems to only support up to 30 outputs; anything beyond that returns an error.
I think I will just go with switch on int statements for now; I do notice a delay but I’ll deal with it somehow!

If you aren’t doing something unique on each beat, but instead are doing something unique on every 2nd, 4th, 8th beat etc. you could use a modulo node and a branch. I’ve used this before when doing stuff with music, on the up and downbeats, modulo 2 and 4 in common time.