Stagger/Stun mechanic implementation options

Hi guys!

First time posting. I couldn’t really find any information that could help me with this.

TLDR at the end.

What are good options for ‘stunning’ an NPC? And by that I mean including movement.

I tried Root Motion animation montage, and it worked great as it locks the character in the animation movement but now I’m at a point where it feels very restrictive in terms of knock back distance (stagger), and duration (animation doesn’t feel right if just played faster).

So I’m trying to move away from root montage animation and now faced with challenges.

I tried “Launch Character” but the AI movement nullifies it. NPC just stops for a split second and resumes walking again. Disabling movement doesn’t help since launch character uses the movement component (or it appears to be so).

*I tried adding a ‘stunned state’ in my AI State Tree but the update is too slow. The state tree is setup to switch to the stunned state with “Send State Event”. It takes about half a second to see the state change. Although this part may be poor implementation on my part as I pass the call from the npc Character BP to the AI Controller BP, and from here executes send state event. I couldn’t get it to work if I called the event change from the character bp.

There doesn’t seem to be away to temporarily disable the AI or movement input. I’m out of ideas at this point. Is a stunned state a viable option if implemented correctly? Or are there other alternatives I could explore? Suggestions?

TLDR:
Root Motion Montage - good because have ‘built-in stun’ but not flexible in duration and knockback distance. Will require more set of animation for different needs.

Launch Character - immediately superseded by AI movement

Launch Character + State (State tree) - state transition too slow, like half a second. might be poor implementation (details in the paragraph above with an *).

Looking for suggestion/ideas how to stun the npc AI and movement.

Thanks in advance!

How do you give the input? Can’t you just… stop giving movement input? :rofl:

If you’re using one of the Move To nodes however, you can use the Stop Movement node.

And to resume the movement, you can simply start triggering the add movement input node (however you do it) maybe by using a gate node for this behavior, or trigger the move to node once again.

Hope this helps! :innocent:

Hi Vis,

Thanks for the reply.

I’m using AI State Tree to drive the movement and I’ve already got quite a few of them. It would be a bit of a pain to add the interruption in each state task blueprint.

But you are right that the solution should be simple and direct. So after going back to the state tree documentation, I completely overlooked the on tick transition trigger. I think this will solve my issue so I can get to a stunned state without my previous delay issue.

I will have to rework a few things and then we’ll find out.

Hey @Woetrei, it’s been a while since we last heard from you! Do you have any updates on the matter? If the issue persists, you can share more context along with the screenshots of your current approach.

Hi! Sorry for the late reply. I was away from the engine during the holidays.

Yes, state tree transition on tick worked for me.

Thanks for checking!

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