Hello. Last week at school we started a new 4 week period of learning new things. This time it’s about AI.
I’ve followed a terrific tutorial that’s helped me understand some parts. I’ve come to a point where he makes an AI shoot at you, while I’d like the AI to melee attack, thus ‘when in range - attack player’.
I’ve tried some approaches, but I admit it’s over my head.
How do I tell the behaviour tree that the AI is in range to perform a melee attack?!
Do you know how to set a reference of the player to the blackboard as an object. From that point it is easy.
The Move to task has a value you can tweak of how close the controlled AI must be in order to have completed the move to task in CM.
You can attack at that point. You can play the animations right from the behaviour tree it is easy, but I did not have good blending and control with that approach.
For my last project, I move him to about 150 CM away.
And then I have the Behaviour Tree execute a custom BTTask which just sets the value a BOOL ‘isAttacking’ to true in the AI’s main blueprint.
This is picked up by the anim blueprint where you can blend and control the attack in much better.
I’m strictly new and a student. We’ve barely had anything about AI yet, so the video I found was on my own initiative, but I can’t say I understand it all…
hello OlaHaldor, may i ask how you created the kill player when in range BTT? could you show me how you did it? i followed the same tutorial as you did,and i’m facing the same problem.