How do I get the For Loop to loop a certain amount of times?

So I am making an endless runner and I have a tile that loops consistently with the for loop node. I have another tile level that I want to transition into after a certain amount of loops. How would I go about doing this. Please ask any questions if im not making things clear. Thank you!


If this is an endless runner, shouldn’t the sequence node be hooked up to event tick instead of begin play?

Also, the on completed execution pin will be called once the for loop completes its runs.

Not entirely sure if this is what you meant but here:

or

1 Like

Perfect, something so simple but I didnt realize lol. To answer your other question the event begin play works perfectly fine. Also wouldnt an event tick be more taxing?

If its something that’s continuous, then you will likely wanna use an event tick or Event by timer (allows you to control the functions frequency). (If your game keeps spawning tiles until you lose/win)

What you have right now spawns every single title upon begin play.

Don’t take anything I say granted as I am still relatively new.

I would do something like this instead:

Then

Then if you ever want to change the type anywhere in your code (set to none to stop spawning too)

Its an Enum… create it by going to the content browser and search:

Screenshot 2024-02-10 213806

Is that a switch on Int node on the bottom pic

Edited my post above to make it more clear for you, the node you are refering to is Switch On ‘Enum type’.

Simply drag off your enum and type switch on… like so:

Incase you dont know what im talking about:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.