Hi,
Looks like you need some kind of a value (can be a bool) which gets set when the player punches the AI.
This bool can be directly linked to some value on the blackboard. Now in the behavior tree check for this value and start attacking the player (if the player is still in range).
Basically the high level steps would be :
- In the AI blueprint check for overlap of the player weapon collider (attached to the hand for punches).
- If an overlap is detected, set a value (maybe bool) in the blackboard of the AI.
- In the behavior tree have a subtree which gets activated if the blackboard value is set.
- The subtree should run the attack task where you can play the AI’s attack animation.
- Also make sure the AI is in range of the player when you run the attack subtree otherwise the AI would just keep punching even when the player is further away.
This is just an overview of how u can probably do it.
regards,