Download

How to make an ai react to different attacks

I’ve followed a tutorial on how to setup an anim montage for punching and that’s working well, however I want to do the same for kicking as well using a different button (X to punch, B to kick) the animations work fine for the kicking but the AI isn’t recognising that it’s being kicked. Below is what I have for being punched however I’m unsure how to incorporate kicking as I can only set one condition, apologies if it’s a silly question, just trying to learn

hi @TheMightySloth
In your blueprint you have the If-node that check if the 3°personcharacter is punching,
you can use the “false” output to add another if that check if another variable that you have to create is Kicking.

For more complex and advanced behaviour you may want to build a simple enumerator
with all your attack listed, like quick-punch , heavy-punch , quick-kick , strong-kick…
so you can use a node called Switch-on-enum to make appropriate behaviour for every attack.
instead of making multiple separate booleans

Also the begin overlap can be tricky , since some attacks can have different ranges
if you have just one opponent you can just call an event on him to say that
“is starting an attack” - "of type C " - make some check for the distances and know if you have to dodge , or if he is too far and you can attack …
otherwise the A.I will not be able to know that you are chargning an attack if is out of the collision