How do I detect the player clicking again and cancel an AI task?
What I am trying to do is to have the player character walk to wherever the mouse is clicked. I can move the player to the click location using a behaviour tree. The only problem is that if I click again the character will keep moving towards the last target.
How do I make the character change path? I have tried setting up some way for the game to change the condition that makes the character move so it will reset the tree and make them move towards the new location but I'm not getting anywhere.
Are there any good tutorials for this?
asked Jan 04 '17 at 03:37 AM in Blueprint Scripting
If you are controlling the movement manually (clicking specific target points) without any other 'behavior' involved, you don't need the behavior setup to handle it.
You can just use a single cast to the AI character with the target. Something as simple as...
Calling it will interrupt and replace any existing pathing.
The Mod Range is lets you pick a random point within that distance of the actual target to try to move to. It helps prevent swarm-jamming and keeps things a but more 'natural' by adding a minor "random" element.
answered Jan 04 '17 at 04:19 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here