How to add new melee attacks to the AI in Lyra?


I am trying to add new melee attacks to my AI in the lyra project. I currently have one attack working but I cannot seem to add a second attack. Here is my current Behavior tree for reference. I was thinking that for the second attack I need to add a new service for it, but the issue is that the AI is not sure what to execute first so therefore it just runs the first behavior that doesn’t fail and ignores the second behavior. I need it to randomly switch between the two attacks so that it does both a light and heavy attack.

Here are my two services as well:

That one is for the first attack that works

That one is for the second attack which does not work

I realize they are the same. I tried giving the second attack different tags and no luck.

It is possible that I need to give the second attack different tags and change how it is set up in the behavior tree.

Any help is appreciated.

Maybe when one blocks the other, why don’t you put the two attacks in the same service and make a random each time it is activated?

1 Like

That’s a great idea! I discovered that the issue was that my animation montage wasn’t set up correctly. I am using AGR for the line trace and I needed to put a notify state in the animation timeline so that would trigger and also I needed to ensure the animation was only using the upper body of the mannequin and I needed to ensure the tags in the service matched the trigger tags in the gameplay ability. Then I ensured the skeleton was targeted correctly. Once all of the pieces were in place I was good to go. Now both the player and the AI can use a light and a heavy attack and the AI randomly switches between the two.

1 Like