x

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"

Random Task in AI

Hi all, I want the behavior tree to randomly do one of the tasks below a selector. Don't care which task. My current solution is to randomly Finish Execute with a fail so it goes to the next one. It works but it doesn't feel clean.

Is there a cleaner solution?

alt text

Product Version: UE 4.15
Tags:
aitree.png (62.3 kB)
more ▼

asked Jun 15 '17 at 11:47 AM in Blueprint Scripting

avatar image

Jiyko
34 5 8 9

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

1 answer: sort voted first

Hi,

You can create a 'Service' and assign a random integer to a blackboard value and then on each task, use 'blackboard condition' decorator to check that integer value. Here, take a look at this very simple setup for a better understanding;

Blackboard alt text

Behavior Tree alt text

Service alt text

Assign the service value to blackboard value.

alt text

First Task alt text

Note that in this approach, the selector only picks one random task to execute. Hope it help.

Regards,

bb.png (37.7 kB)
bt.png (143.8 kB)
service.png (147.1 kB)
firsttask.png (141.1 kB)
more ▼

answered Jun 15 '17 at 01:04 PM

avatar image

navid100
1k 29 14 46

avatar image Jiyko Jun 15 '17 at 03:25 PM

This works! Cheers.

(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