I am creating a Tetris like game and am currently working on the drop script. I have a timeline set up in a macro to move my piece down one slot inside of the class blueprint for my piece. Then in the level blueprint I calculate how many moves it needs to make then the macro loops (x) number of times. I am a long time programmer but knew to UE and game programming in general so this is the part that is confusing me. Even if I have it set to run the loop only three times it still says infinite loop found. After my research and hours of tutorial videos I have gathered that the loops must complete in between game ticks, not on a separate thread. Seeing as the timeline runs through many ticks I assume this is the problem. I have tried every way I can think of to rewrite the looping to no avail. Short of rewriting the animation sequences on the onTick event in the level blueprint and remove the timeline but I feel like there is a work around to repeat timelines. And thoughts, help hints would be greatly appreciated.
I know this is not really an answer to your problem, but I wanted to suggest to use a timer instead of a timeline when you need a recurringly fireing event.
Using Timers in Blueprints
From what I’m seeing this is to have the function called on each tick for a set amount of time. While this is useful I’m not sure it will help in my situation in that it calls this function for a set time. I am looking to call the function a set number of times. I think I have found the solution it was the placement of the loop. After some playing to make sure I have it right I will post the answer.
Thank you for the tip though.
I apologize. I now see how the timers work and I think it would be helpful in a way but it seems to alter the distance that the object moves each time. I have asked a separate question in regards to this issue.
In case this may help anyone in the future: I came up with the solution of adding a String called WaitingOn. While a piece is in motion WaitingOn is set to ‘blit’ (that’s the name of my game piece). On EventTick, if WaitingOn is equal to ‘blit’ then I check that piece for a boolean that tells whether the piece has stopped or not. If it has, EventTick fires the timeline sequence again. The WaitingOn is also checked for ‘newblit’ to handle looping the creating and dropping pieces process. This does feel like a hack/work around and a very newbish approach so if some one has another way I would accept a something better.