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"

Any way to dynamically select a behavior subtree?

Hi, here's my problem.

I have a number of different AI, that want to use one general behaviour tree for determining overall state, like detecting an enemy or patrolling, but I want them all to use their own individual attack routines.

Now, I realize I can build the attack routines inside the AI's own BP, but that seems clunky for a number of reasons, including having to clutter their event graph with behaviours, and build call backs to the Behaviour tree to tell it when it's done attacking. Especially since the attack routines themselves should be state machines - like a behaviour tree.

Or I could cut-and-paste my behaviour trees and just modify the attack section of it.

Neither of those seem like great solutions.

There is a 'run behaviour dynamic' task, but it doesn't actually let me pass it a behaviour tree as a parameter from the blackboard - tbh I don't understand what the run behaviour dynamic task is intended to do.

What's the design pattern supposed to be here?

Product Version: UE 4.14
more ▼

asked Jul 03 '17 at 02:18 PM in Blueprint Scripting

avatar image

Paul Boyle
26 1 2 4

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

1 answer: sort voted first

When you add a BTTask_RunBehaviorDynamic to your tree you get to specify a 'tag' that will identify given place in the BT as potential sub-BT injection location. Then at runtime you can use BTComponent->SetDynamicSubtree to inject given BT into that spot. This is done per AI so you can have on big BT that defines overall behavior structure and use dynamic BTs to differentiate between different AI types.



more ▼

answered Jul 03 '17 at 04:48 PM

avatar image

MieszkoZ STAFF
7.3k 225 57 413

avatar image Paul Boyle Jul 04 '17 at 08:52 AM

Ok thank you. And I get the behaviour tree component by casting the 'brain' component on my AI controller after I run my behaviour tree?

Also, the blackboard has to match for the dynamic subtree? There's no such thing as a 'local' blackboard that a particular tree can use?

avatar image ZLogic Sep 07 '18 at 03:38 PM

Thanks, seems to work so far. Although I'm a little disappointed that MieszkoZ's comment here seems to be the only place on the entire internet where these nodes are explained in English.

(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