How do I counter attacks from my AI?

So I am working on a melee system for a project, I am fairly new to the engine. I cannot figure out how to counter an incoming attack from the enemy. Like a parry system in God Of War games. I know it has something to do with collision boxes, but I just dont know where to start as I don’t have any idea how collision boxes work. I know how trigger box works though. I would really appreciate any help.

Hi there,

A collision box works quite exactly the same way like trigger boxes I believe. However for your melee system you probably will have to learn a bit more if you don’t know how to do it (would have to look into it myself as well)…

First you need to learn a lot more about blueprint scripting because that’s what you need to do, you need to write a script that knows what attacks are being projected towards your player, then you need to make a system that while the enemy attacks there’s a time frame within which you can press a key in order to parry the attack. For all of this you need to know how you can get information back and forth between your animation blueprint (where the animation logic for your attacks and such is stored) into your melee system blueprint where you create all the logic of the actual combat… that’s at least how I would go about it.

What you want to do is not simple, usually there are big teams creating these thing but if you are patient and persistent you can succeed as well, here are some links that give you an introduction to the things you need to know:

Hope this helps and good luck,
Gull Jemon Studios

Great thanks for the help. Yeah, you are right actually. To pull this off I’ll need to communicate with different blueprints. The links you mentioned are really helpful, I’ll start studying.

I’m glad I could help. If you need any more help just ask.

How can I get information from my anim blueprint?
Is it the same as as anim notifies?

Hi there. I’m not sure because I’ve haven’t gone into animation blueprint as of now. But I suppose it should work similar to the usual way:

You have to use a “GetAllActorsOfClass”-Node and choose your animation blueprint in the small drop down menu of this node. This will output an array of actors/bluepringts. Use a “Get”-Node and get the 0th element of that array. From this you can now create a reference of your blueprint by promoting the output of the “Get”-Node to a new variable.

Now you have created and filled an actor reference of your animation blueprint and you should be able to access (get and set) all data contained in this script.

Here’s some more information:
https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/FindingActors/Blueprints/

Hope this helps!

Thats very helpful. Thank you so much

Cool, just make sure you mark my answer as accepted, I would thank you very much for that as well :wink:

Do you have any idea on how I can make my Ai evade and block my attacks?

Here is the link to my question. It’ll be great if you could take a look at it too. Thanks