Playing montages inside ForEachLoop

I have a sentence which is parsed into an array of words. I want to iterate through this array of words to play an animation montage which is stored and accessed from a data table. The problem is only the first animation plays.

For example, the sentence is: “Run jump walk.” I want to play the animation that corresponds to each word one after the other, but only the animation for “run” word will play(Only the first word regardless of what order the sentence is will have its animation played). Any advice?

I don’t believe any “loop” is compatible with the type of execution you are trying to deliver. As far as I know, the loops do not wait for the completion of the “execution” chain before grabbing the next array element. For this reason “delays” are also incompatible with a loop because it just sends everything through to the delay nearly simultaneously and then everything after the delay is executed on each array element at nearly the same time. So you cannot “delay” the execution of a loop. A montage is going to function similarly to a delay node, while you are “playing” the first montage, the loop is executing the next array element and telling it to “play” also, so I think they are just getting stacked and you only ever see the first one through the execution pipeline. Maybe try using a Custom Event to fire the execution of this script, use a “get” to pull a custom integer variable index from your array, get the data table of that index instead of using a ForEachLoop to drive the script, then “On Notify End” or “On Completed” execution pin from the “Play Montage” hook that up to “Set Custom Integer” node that increments after each montage is played then calls the Custom Event again.

Nebula Games Inc Is Correct.

In this type of case I would just eliminate the for each loop and create a custom function that just gets and executes. After my execute is all complete just call the function again for the next element.

But yes what you have pictured is just going to run the first montage as the for each loop will just keep throwing elements at it which it will ignore because its busy with the first command.

Allot of people have the same issue when they try to put a delay in a ForEach Loop body.

" Ain’t no ForEach loop body got time for that " lol

Would be awesome if it worked like that though.

This worked thanks