Enemy AI will approach but refuses to attack. Help?

Title says it all. I followed “GorkaGames” tutorial on building simple enemy AI (and I watched a few others which followed his exact methodology) and set things up 1:1. Everything works EXCEPT the attack animation. The AI will stalk the player character, chase 'em, get within an inch of them… and then refuse to play the “play anime montage” attack.

If it means anything, I’m using the Paragon Aurora (frost empress skin) asset as the enemy, including her animations. I can’t tell if I’m missing some elusive final step. The animation plays in the animation previewer, so I know it works in isolation–I just can’t get it to execute in real-time via the “play anim montage” function after the AI closes the gap with my player character.

Did you use a MONTAGE or ANIMATION node?

Can you share a screenshot of your code, please?

Sure thing:

1 Like

Ah, okay, so it can be one or two things.

In your TARGET, you cannot leave “Self”, you have to place a target there, so drag the MESH reference and hook it up there.

Also, make sure, in the character’s ANIMATION BLUEPRINT it has a DEFAULT SLOT.

Yep, I have a default slot in the animBP! And here’s what I get when I attempted to drag the MESH reference:

In the tutorial I watched, they didn’t have a target/they left it as self and it seemed to work, and I can’t seem to add my mesh as a target. Not sure what’s off. Any further advice would be great!

1 Like

Try using the “PLAY_MONTAGE” node, which is slightly different.

And hook up the MESH into the IN_SKELETAL_COMPONENT.

Also, I can’t recall, but does the Paragon mesh have a MESH and BODY skeletal reference, or just MESH?

(ps: I THINK you need to GET_REFENCE_TO_SELF to use that “Play_Anim_Montage” node, but don’t quote me on that. There’s so much to remember with this program.)

Okay, so, I tried with the play_montage node (hooked mesh to skeletal component) and still no dice. Also tried pairing a ref to self with play_anim_montage, and that didn’t work out either.

Re: Mesh/body, I’m still super green (I think this is my 8th day using UE?), but I only see mesh listed–though I can also access the skeleton. Not sure if “body” is a separate thing I’d find elsewhere.

Also, posting my anime BP just to make sure I didn’t screw anything up there!
image


1 Like

Okay, try this:

Hook up the default mannequin instead, and see what happens. (You won’t be able to use the “Primary_Attack” animation, because it is not compatible with the default mannequin, so use the RUN animation instead.)

(By “hook-up” I mean, copy the code into the BP_ThirdPersonCharacter and see if it works. If it does, that means there’s something in Paragon’s Anim_BP that we’re missing)

Also, the “Primary_Attack” is 100% assigned to the Paragon’s skeleton?

As far as I can tell, yep, primaryattackB is 100% assigned to Aurora’s skeleton (attaching a pic for ref)

Btw, re: copy the code/hook up, do you mean I should make a UE Manny from scratch, give him pawn sensing capabilities and an identical anim BP, then copy-paste over the event graph code and swap out the paragon-specific animation? Or did you mean something simpler?

Or, if you meant add the code to my active player character, it’s also a Paragon asset (Yin). Fwiw, that asset had its own issues I had to work around (one of the optional skins required two material slots but only had one assigned)

Last game (a whole week ago) I had a designated class called BP_ThirdPersonCharacter, but this time I don’t–is that an issue?

You don’t have to copy everything.

Just create a simple follow logic in the BP_ThirdPerson_Character:

For the life of me, I can’t get BP ThirdPerson Character to follow me (Paragon Yin character). Tried following your BP here as close as I could, but they wouldn’t give chase. My BPThirdPersonCharacter is labeled as a character instead of an actor–not sure how to fix that–and didn’t feature a skeletal mesh tab like in your pic–only a mesh tab.

Could it have something to do with the fact I have an AuroraDummy Anim BP (the one I’m using for AI/enemy purposes) separate from the Aurora Anim BP, which remains completely untouched/factory default?

I’ve set my dummy/enemy AI experiment to be linked to the dummy anim BP (aka all the pictures I’ve shared thus far), not Aurora’s base anim BP, so I don’t think that’s the issue–and since they use the same skeleton and model, I wouldn’t imagine there’s any animation restriction either, but maybe there’s an angle I’m missing?

EDIT: I also see that my animgraph doesn’t have state machines (per the pics up above)–is that necessary?

Okay, there’s a lot to unpack.

So, for now, do NOT use the Paragon.

Create a copy of the BP_ThirdPersonCharacter and name it “BP_ThirdPersonCharacter_Agressor” or whatever you’d like.

Apply the DEFAULT AnimBP to BOTH blueprint characters.

Use the simplified code, and input BOTH BP_ThirdPersonCharacter and BP_ThirdPersonCharacter_Agressor into your scene.

I know for a fact that if you input the code correctly it will work with them. The Paragon characters may have background code that is interfering, but I cannot be certain at the moment.

(I wondered if the state machine was necessary, myself… but I’m actually unsure.)

Leomerya! I cracked the case. Or, rather, someone else did: Attack animation not working - Development / Character & Animation - Epic Developer Community Forums (unrealengine.com)

After copious digging I finally found a thread with a solution that worked. The solution was: Ignore the Aurora animation montages and… remake the Aurora animation montages from scratch using the Aurora animation instances. I can’t make sense of it. But it worked…

Now I have the problem of the AI spamming attacks despite my delay nodes. But that is a FAR more common issue than the weird, Paragon-centric stuff

Thanks again for sticking with me on this bizarre journey

1 Like

Fantastic, yes, I had a feeling something was off with her, which is why I suggested using the default mannequins.

Good luck!

1 Like

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