How to check if there is a montage playing in a given slot?

Matiati
Fri, 25 Nov 2016 10:25:04 +0000
Character & Animation

I have an effect system implementation for a turn based game.

Basically an effect is anything that can harm, buff or in some way affect a character in any way.

I have written the effect as an actor blueprint and the character classes spawn them once they get affected by some source. The characters then destroy the effect instance once the effect is resolved.

For my character’s animation blueprint asset, I’ve added a montage slot for effects. Basically it blends into the locomotion pose of the character (idle, walking, running and stances (crouch, stand, prone)). Upper body or full body blending is controlled through the animation graph. I would like this slot to be controlled by any kind of effect classes in the game.

I do not want an effect to override an existing montage in this slot which is currently playing. For instance I have multiple damage over time effects and the animations would look bad for this case if all effects restart the slot montage with their own montage replacements.

What I want to do is to replace the montage in the slot only when there is no active montage currently playing in this slot. So that the slot plays only once for the first effect which initiates the animation (the rest of the effects which coincide with the first montage’s play time will simply ignore animation and spawn only sounds and particle system etc.).

There is only one method exposed to the Unreal editor for checking if a slot is playing a montage. This is the “IsPlayingSlotAnimation” method.

My problem is this method requires a montage as a parameter. And checks if this montage is currently playing within the slot.

So how can I check if there is any montage playing in a slot? I am simply asking for a “IsPlayingSlotAnimation” method without a parameter.

5 posts - 5 participants