Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I tell when an AI has reached it's destination in blueprints?

I'm using a 'move to location' node, but is there an elegant way to query if the agent has reached it's destination? Without calculating the path to the destination again or working out a simple distance.

Product Version: Not Selected
more ▼

asked Dec 18 '14 at 11:57 AM in Blueprint Scripting

avatar image

Asher S Einhorn
637 91 79 179

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Whats Up SirYakalot,(Awesome name)

I'm Peter L. Newton, and the most elegant way I've found to do this is by using an Event. Now you set it up how you like but this is how I would go about it.

Setup the composite in your branch or sub-tree of this task to be a Sequence node. This way the branch waits for each node to execute successfully. Next within the task node which will execute the Move To Location, setup everything accordingly but do not link anything to the Finish Execute node. Next, pull from your AIController within the task, and assign the event Move Completed.

Now with your newly created Move Completed event, you can do one of 2 things. You can check the results of the move or just finish the execution. I suggest the former, but the latter works just as well for now. So for now just pull from the execution node of the Move Completed event, and link this to your Finish Execute and setting Success to true .

This will now prevent the bot from doing any other actions within the tree until they've completed the move, successfully or not. Of course I suggest using the results of the move as information to either retry the move or the appropriate action for your game.

One thing I should note that by using the Sequence composite, each node within the branch needs to have the Finish Execute set Success to true. This way the nodes in the branch execute in order, returning false would return resetting the tree.

I can show you a simple setup of this if need be! Good luck!

more ▼

answered Dec 19 '14 at 01:36 AM

avatar image

2k 73 31 107

avatar image Asher S Einhorn Dec 20 '14 at 04:45 PM

haha, thanks! my dad used to call me it when I was a kid because I used to talk a lot - 'yak' meaning talk.

Ah that's a really neat solution, thanks! I didn't realize they had all these in-built events. really useful. is there a good way of getting a complete list?

BTW I watched your youtube tutorials to get me going with this stuff, so thanks a lot for those too!

avatar image PeterLNewton Dec 20 '14 at 08:32 PM

You can turn Context Sensitive off when searching for events.

You can also create Event Dispatchers on one blueprint and Assign them to other blueprints allowing for what is termed in programming as a Callback . This is the what we've done here, and it's efficient when the executing task requires waiting for another task to return a payload. Though we don't have to explicitly state when that is.

Haha glad you found those, more coming today!

avatar image Asher S Einhorn Jan 13 '15 at 06:06 PM

Hi there SilentX, I've actually implemented what you suggested and the event doesn't fire. Do you know why this would be? they move to the correct location and stop but the event bound to move completed never fires. It fires if put inside the AIController with a reference to self. alt text

capture.png (52.9 kB)
avatar image Asher S Einhorn Jan 13 '15 at 06:13 PM

assigning the event later seemed to fix it. odd though.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question