# Play Anim Montage causes infinite loop

**URL:** <https://forums.unrealengine.com/t/play-anim-montage-causes-infinite-loop/2237354>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [December 22, 2024, 6:32pm UTC](https://forums.unrealengine.com/t/play-anim-montage-causes-infinite-loop/2237354 "2024-12-22T18:32:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaxwellFilms](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MaxwellFilms](https://forums.unrealengine.com/u/MaxwellFilms)\
**Post date:** [December 22, 2024, 6:32pm UTC](https://forums.unrealengine.com/t/play-anim-montage-causes-infinite-loop/2237354/1 "2024-12-22T18:32:43Z")

</div>

I have an Play Anim Montage node set up to play in the event that the boss’s health bar reaches zero. When I try to play the game, however, it refuses to launch, citing an “infinite loop” with the play anim montage node. As shown in the included video, the anim montage does not actually lead to a loop, as nothing branches off from it to repeat.

While I was in the process of writing this question, I deleted the anim montage and tried to play it again. This caused another error message, citing an infinite loop with the do once standard macro, which I have not edited at all. I hope this is able to be fixed. If it’s any help, I have two other characters that work flawlessly with the same bit of code that seems to be bugging out on this one character. I can provide more images if needed.

---

<div class="post-metadata">

**Author:** ![lordlolek](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lordlolek/32/906205_2.png) [@lordlolek](https://forums.unrealengine.com/u/lordlolek)\
**Post date:** [December 22, 2024, 11:11pm UTC](https://forums.unrealengine.com/t/play-anim-montage-causes-infinite-loop/2237354/2 "2024-12-22T23:11:32Z")

</div>

You didn’t provide any clips or images, so it’s hard to help.

---

<div class="post-metadata">

**Author:** ![MaxwellFilms](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MaxwellFilms](https://forums.unrealengine.com/u/MaxwellFilms)\
**Post date:** [December 23, 2024, 2:58am UTC](https://forums.unrealengine.com/t/play-anim-montage-causes-infinite-loop/2237354/3 "2024-12-23T02:58:17Z")

</div>

Thanks for pointing that out, I must have forgotten. Here’s the video I referenced in the question.

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [December 23, 2024, 4:18am UTC](https://forums.unrealengine.com/t/play-anim-montage-causes-infinite-loop/2237354/4 "2024-12-23T04:18:40Z")

</div>

it likely isnt the Montage especially since you deleted it and still had errors, whats calling that code initially?

---

<div class="post-metadata">

**Author:** ![MaxwellFilms](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MaxwellFilms](https://forums.unrealengine.com/u/MaxwellFilms)\
**Post date:** [December 23, 2024, 3:09pm UTC](https://forums.unrealengine.com/t/play-anim-montage-causes-infinite-loop/2237354/5 "2024-12-23T15:09:13Z")

</div>

It’s initially called by an “event receive damage” node. The compiling issues now seem to be just with the macro for “do once.” Every time I try to play it, it shows an error for either the input or the output of the macro.

---

<div class="post-metadata">

**Author:** ![lordlolek](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lordlolek/32/906205_2.png) [@lordlolek](https://forums.unrealengine.com/u/lordlolek)\
**Post date:** [December 23, 2024, 11:04pm UTC](https://forums.unrealengine.com/t/play-anim-montage-causes-infinite-loop/2237354/6 "2024-12-23T23:04:08Z")

</div>

Can you post an image of the blueprint?  
In general, if you have the exact reproduction for infinite loop, it can be straight forward to spot a problem (if your project is not too big).  
Start with adding breakpoints along the Death execution path (white line), and observe where it starts to loop around.

---

<div class="post-metadata">

**Author:** ![usa423](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/usa423/32/918773_2.png) [@usa423](https://forums.unrealengine.com/u/usa423)\
**Post date:** [December 23, 2024, 11:12pm UTC](https://forums.unrealengine.com/t/play-anim-montage-causes-infinite-loop/2237354/7 "2024-12-23T23:12:01Z")

</div>

Try this, when the montage plays, set a boolean true named after the montage, set it to false when the animation ends. Before the montage put a branch with a get of that boolean and only play the montage if it is false.

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [December 24, 2024, 4:22am UTC](https://forums.unrealengine.com/t/play-anim-montage-causes-infinite-loop/2237354/8 "2024-12-24T04:22:07Z")

</div>

i mean initially, as in whats calling the Damage Event, so for instance if your DamageEvent calls itself somehow there is your infinite loop.

---

<div class="post-metadata">

**Author:** ![MaxwellFilms](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MaxwellFilms](https://forums.unrealengine.com/u/MaxwellFilms)\
**Post date:** [December 24, 2024, 7:09pm UTC](https://forums.unrealengine.com/t/play-anim-montage-causes-infinite-loop/2237354/9 "2024-12-24T19:09:41Z")

</div>

Okay, so I went through, and while I still don’t know why it was telling me why the errors were in these unrelated nodes, the issue ended up being in a different function that called itself without a delay. Thanks for all your help!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [January 23, 2025, 7:09pm UTC](https://forums.unrealengine.com/t/play-anim-montage-causes-infinite-loop/2237354/10 "2025-01-23T19:09:55Z")

</div>

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