I am trying to make my AI in Lyra attack with melee weapons. I have a behavior tree made with a move to service and a melee attack service, however, I am not sure how to finish the code for the melee attack service. I have attached my current code for the attack service for reference. Any assistance is appreciated.
(-) Create a melee gameplay ability
(-) Give that ability to the ability system component of your AI (in lyra the weapons you equip have an array of abilities to grant, so you could set it there)
Then you need a way to trigger your gameplay ability. One way you could do that, is by a gameplay event. For that you need to:
(-) Create a gameplay tag (call it e.g. InputTag.Weapon.Melee)
(-) In your ability under Triggers add one there. Set the Trigger Tag to your gameplay tag (so to InputTag.Weapon.Melee) and the Trigger Source to Gameplay Event.
(-) Now to trigger the ability, in your service above in the SendGameplayEventToActor set the Event Tag to your gameplay tag (to InputTag.Weapon.Melee) and the Actor should be the Controlled Pawn (since you want your AI to execute the melee ability), not the target enemy.
You could also have a look at the service BTS_Shoot, which is the service the AI is using for shooting.
Thank you! I just had to make sure the gameplay tag and the trigger tags matched. The issue was that I did not have a trigger tag set. My AI can now attack. Thanks again!