Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Behavior Designer - Behavior Trees for Everyone

Discussion in 'Assets and Asset Store' started by opsive, Feb 10, 2014.

  1. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Ok the targetGroup list approach sounds best. Since in this multiplayergame new players are coming and going I made this separate gameobject with a script that keeps track of all the players in the game:
    Code (csharp):
    1. public List<GameObject> allGamePlayers;
    2.  
    3. public void AddNewPlayer(GameObject NewPlayer)
    4. {
    5.      allGamePlayers.Add(NewPlayer);
    6. }
    7.  
    8. void Update ()
    9. {
    10.      foreach (GameObject playerInGame in allGamePlayers)
    11.      {  
    12.          if (playerInGame == null)
    13.          {
    14.             allGamePlayers.Remove(playerInGame);
    15.             break;        
    16.          }  
    17.      }
    18. }
    When new player is instantiated it has this on the Start() function and it will be added to the list above.
    Code (csharp):
    1. void Start ()
    2. {
    3.     GameObject.Find("PhotonOS").GetComponent<PLAYERS>().AddNewPlayer(this.gameObject);
    4. }
    And if player leaves and becomes null it will be removed from this list.

    This is working. But now I should pass this list to every EnemyAI behavior tree Can See Object task in the game.

    The Can See Object task only has Target Object and there is no Target Group. So I can't pass this list directly to it? How could I move forward from here?
     
  2. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    My mistake - yesterday I was thinking of the Attack task rather then the Can See Object task for the targetGroup variable. Right now Can See Object can use a single GameObject, layer mask, or tag, but having a targetGroup option makes sense. Send me a PM with your Behavior Designer/Movement Pack invoice number and I'll send you a version which has this variable.
     
    Nadan likes this.
  3. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    118
    Hello,
    I'm slowly getting used to behavior designer, it's a really nice plugin!

    I got recently the movement pack, but I'm not sure how to manage root motion with the movement pack and unity navmesh?

    I don't see a anything in the doc, Is there a tutorial for it?
    Thanks.
     
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Glad you're enjoying Behavior Designer! The best way to handle root motion is to add it within your character controller, take a look at this page for some more details:

    http://opsive.com/assets/BehaviorDesigner/documentation.php?id=135

    The cached MecWarriors article also explains how to use root motion within your controller.
     
  5. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    118
    Wow that a fast answer :)

    Thanks, I'll try that one and keep you updated about it!
    root motion and navmesh is such a pain to handle ...
     
  6. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Hi,

    I made a new task to each EnemyAI in my game to collect the latest list (with the script I mentioned before) of all the players in the game. This list goes to the new Can See Object task Target Objects.

    Like this:

    Code (csharp):
    1. public SharedGameObjectList sharedGameObjectList;
    2. public override TaskStatus OnUpdate()
    3. {
    4.  
    5. foreach (GameObject playerInGame in GameObject.Find("PhotonOS").GetComponent<PHOTON>().allGamePlayers)
    6. {
    7.     sharedGameObjectList.Value.Add(playerInGame);
    8. }
    9. return TaskStatus.Success;
    10.  
    11. }
    Now my problem is that I don't know how to clear the sharedGameObjectList. This way it just keeps adding the same players to the list. So I would need something like this:
    Code (csharp):
    1. CLEAR sharedGameObjectList
    2. foreach (GameObject playerInGame in GameObject.Find("PhotonOS").GetComponent<PHOTON>().allGamePlayers)
    3. {
    4.     sharedGameObjectList.Value.Add(playerInGame);
    5. }
    I tried to check "Reset Values On Restart" too but that didn't help.

    How can I clear the sharedGameObjectList before I collect the latest players in the game?
     
  7. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    SharedGameObjectList is a List<GameObject> structure so you can clear the list with the Clear method:

    Code (csharp):
    1.  
    2. sharedGameObjectList.Value.Clear();
    3.  
    The Value property on all SharedVariables point to the underlying variable type, in this case it is the List<GameObject>
     
    Nadan likes this.
  8. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Hi,

    Could you also add the targetGroup option to Can Hear Object?

    Right now players can shoot the EnemyAI to the back and because the EnemyAI don't see the player in front of it it won't do anything. I think that Can Hear Object would work if any of the players happens to shoot near it would attack in that case too.
     
  9. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Sure, I'll send you a PM after I have added it.
     
    Nadan likes this.
  10. bourriquet

    bourriquet

    Joined:
    Jul 17, 2012
    Posts:
    181
    Hi,
    I bought this plugin recently and am loving it so far.
    One weird thing I noticed is that I can't use abstract types for variables in my custom Tasks.
    I have a Weapon type that is abstract (and inherits MonoBehaviour), and when I added a variable of this type, here's what it showed (with the real Weapon type and then a SharedWeapon type derived from SharedVariable <Weapon>):


    So I had to make my Weapon class non-abstract (and make the abstract methods virtual, with default behaviors, which is not good design), and then it showed up okay:

    Is there a specific reason that I don't understand? Or is it just a limitation of the plugin?

    Thanks for your time.
     
  11. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Glad you're enjoying Behavior Designer!

    This is similar to MonoBehaviour and the Unity inspector, but abstract types cannot be assigned in the inspector because a definitive type cannot be created. You can assign them at runtime though and that part works as you'd expect.
     
  12. bourriquet

    bourriquet

    Joined:
    Jul 17, 2012
    Posts:
    181
    Unity inspector allows you to declare variables with abstract types, and assign non-abstract derived-type objects to the field.
    So I am wondering if there is a particular reason why it can't be done here?

    Good to know I can assign them at runtime. That won't work for this particular problem but could be useful later.
     
  13. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Whoa, that's new - I just tried it and you're right! I'll add the compatibility to the next Behavior Designer version :)
     
  14. bourriquet

    bourriquet

    Joined:
    Jul 17, 2012
    Posts:
    181
    Cool! Happy to help. :)
     
  15. Urishizu

    Urishizu

    Joined:
    Sep 24, 2016
    Posts:
    158
    I'm really confused.

    I'm using Third Person Controller and I have a basic AI set up with it. I'm trying to make a behavior just to start off for the monster to chase my character when it sees me. But I'm fairly certain it's not repeating the search for seeing my player object.

    upload_2017-4-8_20-32-13.png

    upload_2017-4-8_20-32-25.png

    upload_2017-4-8_20-32-36.png

    I'm really confused why it won't follow me. I forced it once with a repeater and finally got it to register that it saw me, but the seek didn't cause the monster to come after me. Even stranger, with this tree on it, it starts to fall through the ground. I've generated the navmesh but I'm a total newbie to this so I'm confused.

    Sorry for these basic questions.
     
  16. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    @Urishizu -

    To get started, have you tried the Third Person Controller integration tree just to get the hang of it? That guide should help a lot in explaining why I organized the tree the way that I did.

    Looking at your tree, instead of the Wait task on the right you should have an Idle task so the tree doesn't end. When the tree ends the conditional abort will no longer reevaluate. In addition, what is the goal of the Play task? With the Third Person Controller if you want to play a basic animation you should use the Start Ability task and start the Generic Ability.

    In terms of why the monsters are not coming after you, did you attach the NavMeshAgentBridge component?
     
  17. Urishizu

    Urishizu

    Joined:
    Sep 24, 2016
    Posts:
    158
    I think the idle task was what I'm missing, including that bridge component. I'll give it another try.

    I was using the play job to play a certain animation to see what happens, but I'll give the abilities a try. I still need to figure out how to add in the zombie animations I bought as well, but one step at a time. :)
     
  18. Urishizu

    Urishizu

    Joined:
    Sep 24, 2016
    Posts:
    158
    These were my issues. The enemy now follows me for the most part. The remaining issues I'm having are definitely on my side. Thank you so much for a wonderful and genuinely useful asset. This thing is great! :)
     
    opsive likes this.
  19. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    opsive,

    I have a question about using Variable Mappings mapped to properties in my C# classes and strange quirks associated with copying Behavior Trees. I use Variable Mappings a lot in my very large enemy trees. In most cases I am using C# Events to communicate between enemies, my player and my pet characters within my c# classes. Then I use variable mapped properties to communicate the state of the events to the behavior trees. I found this to be a more efficient way to have characters communicating with each other as opposed to having Has Received Event and Send Event tasks scattered throughout my trees.

    Regarding enemies, since there are many of them, I need to be able to copy the tree to other enemies. I've discovered that when I make a copy of a behavior tree I'm seeing inconsistent results depending on the method of copying.

    Copy method 1. If I highlight all tasks in a tree and use Ctrl C, Ctrl V to copy the entire tree to another enemy character's Behavior Tree, the variables end up out of order. They reorder themselves randomly. (this is a bummer because I have a lot of variables and the order keeps things organized)
    Copy method 2. If I use the Copy Component option in the Inspector in the Behavior Tree Component and then Paste Component Values in the new Enemy gameobject Behavior Tree Component, the variables are all in the correct order as in the original. (So it looks like Copy Component, Paste Component Values is the best method for copying Trees between different gameobjects.)

    Regardless of the method of copying, the Variable Mappings are not remapped to the new gameobject. Instead they maintain their original mapping to the original gameobject. I'm not sure if this is a bug or just a limitation of how Variable Mappings work. It's certainly possible to remap every single Variable Mapping but it sure would be nice if those things mapped correctly to the existing gameobject they have been copied to.

    Thanks for any feedback.
    Allan
     
  20. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    @chaneya,

    The Variable Mapping stores a reference to the mapped component so when you do a copy it is going to keep the original reference. I can take a look at what it would take to update those references as well - I'll see if it's something that is relatively quick to do for the next release, otherwise it'll be in the next feature release.
     
  21. Urishizu

    Urishizu

    Joined:
    Sep 24, 2016
    Posts:
    158
    Hi,

    I have both Third Party Controller and Behavior Designer in my project. What is the best way to call an action from TPC like having an AI player swing their equipped weapon? I didn't see anything specific to TPC actions within the GUI. Is the best way to just write a custom task for it (and if so, is there any good examples out there for basic combat like melee swing)?

    Really enjoying these assets so far by the way. They've really accelerated progress on my game! :)

    Thanks!
     
  22. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    In the case of swinging a weapon you'll want to use the Use task from the Third Person Controller integration (available from the samples page). This will use whatever item the character currently has, whether that is a melee or shootable weapon.

    If you want to start an ability you can use the Start Ability task. You could then pair it with the Generic Ability and play any custom animation without having to script a new ability.

    On the Behavior Designer samples page there is also a pretty complete behavior tree that you can use as a reference. This page explains how that behavior tree works: http://opsive.com/assets/BehaviorDesigner/documentation.php?id=119

    That's awesome - I'm really happy to hear that!
     
  23. Urishizu

    Urishizu

    Joined:
    Sep 24, 2016
    Posts:
    158
    Awesome man, thanks so much for the integration link. I have a hunch this is exactly what I needed.

    Top notch support. You're the best!
     
    opsive likes this.
  24. Deleted User

    Deleted User

    Guest

    Hi,

    Thanks for your great job, BD really increases our productivity.
    I found a bug and can I report it here?

    When using "Behavior Tree Reference" task with overriding variables, overriding does not work and this warning message is shown: "Warning: Named variable on reference task XXX (id yyy) is null".

    This happens because the BehaviorManager uses the name of the SharedVariable of the NamedVariable as an overriding key. It should be the name of the NamedVariable. When overriding variables in inspector, we assign variable name of the NamedVariable and expect it overrides variable with that name.

    Main Behavior
    main tree.png

    Sub Behavior (saved as Logger.asset)
    sub tree.png

    If my use case is not correct, I wonder if you tell me the right way:)
     
  25. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    I wasn't able to reproduce it in my dev branch but this sounded familiar and sure enough when I try the Asset Store version I get the same results as you. Send me a PM with your invoice number and I'll send you the latest version :)
     
  26. Deleted User

    Deleted User

    Guest

    Thanks for the quick reply! I've send you a message with invoice number.
     
  27. lujf1978

    lujf1978

    Joined:
    Apr 20, 2017
    Posts:
    1
    Hi,
    I try to porting a project to hololens that using behavior designer 1.5.7 .
    The project work correctly on the window platform.
    But when i porting to hololens, throw a compile error like below

    1> Copying unprocessed assemblies...
    1> Running AssemblyConverter...
    1> Failed to fix references for method System.Type BehaviorDesigner.Runtime.TaskUtility::GetTypeWithinAssembly(System.String)
    1> Failed to fix references for type BehaviorDesigner.Runtime.TaskUtility
    1> System.Exception: Failed to resolve System.AppDomain
    1> at Unity.ModuleContext.Retarget(TypeReference type, GenericContext context)
    1> at Unity.ModuleContext.Retarget(MethodReference method, GenericContext context)
    1> at Unity.FixReferencesStep.Visit(MethodDefinition method, GenericContext context)
    1> at Unity.FixReferencesStep.Visit(TypeDefinition type)
    1> at Unity.TypeDefinitionDispatcher.DispatchType(TypeDefinition type)
    1> at Unity.TypeDefinitionDispatcher..ctor(ModuleDefinition module, ITypeDefinitionVisitor visitor)
    1> at Unity.FixReferencesStep.ProcessModule()
    1> at Unity.ModuleStep.Execute()
    1> at Unity.FixReferencesStep.Execute()
    1> at Unity.Step.Execute(OperationContext operationContext, IStepContext previousStepContext)
    1> at Unity.Operation.Execute()
    1> at Unity.Program.Main(String[] args)
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    It looks like the HoloLens uses NETFX_CORE so you'll need to import the runtime source.This will import the latest version of Behavior Designer though but you'll be able to seamlessly update to 1.5.9 from 1.5.7.
     
  29. Deleted User

    Deleted User

    Guest

    Hi,
    Do you distribute Editor source code of Behavior Designer?

    I am testing our game with beta version of Unity(2017.1.0b1), and the UnityEngine.Texture2D.LoadImage() method is missing in that version. The reason is not known.

    https://forum.unity3d.com/threads/unityengine-texture2d-loadimage-is-missing.467202/

    Because BehaviorDesigner.Editor.BehaviorDesignerUtility.InitHistoryBackwardTexture() haveTexture2D.LoadImage(), an exception is thrown and the BD Window is filled with red out.

    So I am wondering if I had Editor source code, I could replace Texture2D.LoadImage() with UnityWebRequest.GetTexture()..
     

    Attached Files:

  30. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    We currently do not have a license for the editor source code. I have been working with the Unity developers on making sure the new scripting runtime works with Behavior Designer. They are still working on some of the fixes but Behavior Designer will definitely support Unity 2017.1 when it is released (and probably well before the official release).
     
  31. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    Hello, I'm starting to build some non-trivial trees. Is there a way to not expand externally referenced trees into the parent tree? The layouts just clobber each other making it a useless way to look at them. I would prefer that externally referenced trees must be clicked into. At runtime, if execution is inside the referenced tree, the reference node is just green and I can click into it, to see what's going on in there.
     
  32. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Yes - if you click on the '-' symbol on the Behavior Tree Reference task this will collapse the tasks at runtime:

    expand.png
     
  33. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    This doesn't really help since you have to go in an reposition them all to get them to expand. Is there really no plan to separate out the display of referenced behavior trees? Is it a limitation due to expanding out all the tasks of the referenced trees into the parent tree in the data?

    Is a better approach to use multiple trees on the GameObject and stop and start the secondary trees? Dunno that seems like more work.
     
  34. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    I don't think that I am completely following. If you collapse the Behavior Tree Reference task then the tasks from the external tree will not be expanded onto the main tree when it loads. With this you only need to collapse the reference task - all of the child tasks will then be collapsed as well and you won't need reposition the task.

    If you're talking about expanding out a collapsed reference task and having the tasks overlap I do know what you're referring to. This proper way to address this would be to have an auto organize feature within the editor but I unfortunately haven't had the chance to add this yet.
     
  35. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    I don't know what's confusing. During Edit-time, the BTReference tasks are self-contained. You need to double click to go "into" the external BT.

    During runtime, this changes, and the BTReference tasks are replaced with the whole sub tree. Yes, you can collapse the top node of the now included sub-tree, but if the subtrees are large enough they overlap when expanded. Capture.PNG

    Why not make runtime the same as edittime, and keep the BTReference tasks. So that you have to click into the BTReference to see the subtree rather than rendering all the external trees directly in the parent tree.
     
  36. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    The problem with having it behave the same at design time is that when you double click on the reference task it goes to the external tree asset file. This asset file isn't doing the execution so you wouldn't get the runtime debugging and it wouldn't be that useful.

    We actually used to have a preference that allowed you to keep the reference task visible but this added extra runtime overhead and when we asked everybody if they used this feature nobody said that they did. Because of that we removed this feature figuring that it would be better to squeeze out every bit of performance rather then include an feature that nobody said they were using.

    You can get extremely similar results to the old feature by collapsing the reference task though:

    ammoref.png

    Turns into:

    ammo.PNG
     
  37. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    Lol, collapsing the nodes so you can't see them is not the problem. Its once you want to actually view their contents that graph organization and overlap becomes ridiculous. If you have a BTR in the middle of your graph, you can't just expand it, it overlaps everything. So then you're constantly dragging around things to be able to actually see.

    I'm honestly bewildered that this problem isn't excruciatingly obvious given that topology hiding is an essential feature of graphical programming systems. You say "We can't do it that way because clicking the node takes you to the asset file and that isn't running the behavior tree." How about changing this functionality so clicking into a reference node during runtime doesn't take you to the asset, but a graph showing you the live sub-tree...?

    Sorry if I'm a little flustered it seems like you're trying to avoid looking directly at the problem I'm trying to raise.
     
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Ah, sorry it took me a bit. You're right - currently there is no way to view the external tree tasks without overlapping unless you manually move the reference tasks. I have plans to add an auto-layout feature which would solve this but it's not in the current version.
     
  39. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    I really think auto-layout is the wrong approach since I may (read: without doubt) want to organize my graph in the way that makes the most sense for a given graph. Seriously the best approach is to provide sub-graphs. You already have the infrastructure.
     
  40. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    That's a good point. It's not as easy as what is done at design time because the external tree asset file isn't being executed so if I were to do the same thing then it would just switch to a non-executing branch. This solution does sound easier to implement then an auto-layout system though so I'll try to get it in one of the next feature releases.
     
  41. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    I've built a Decorator called Conditional Interrupt that acts like a combination between a Repeat that loops forever and a Perform Interrupt that sends the interrupt when its decorated child succeeds. I'm using this task as a sibling to an Interrupt parent task underneath a Parallel task. The idea is that as soon as the child of my Conditional Interrupt succeeds, it will perform all of the interrupts shortcircuiting the sibling Interrupt and causing the parent Parallel to fail. However, unlike Perform Interrupt which is an Action, Conditional Interrupt as a Decorator doesn't seem to get OnUpdate called in the same manner. I've tried to put the code path that performs the interrupts in OnChildExecuted and other places, but it seems that they are all called "too late". That is, the sibling Interrupt (and its children) are run on the same tick. This forces me to add an additional conditional duplicating that logic on the Interrupt tree. When using a normal Perform Interrupt setup with a Repeat->Sequence->[<Conditional>, Perform Interrupt] construction the interrupts effectively prevent the sibling Interrupt from ever running.

    How can I solve this?
     
  42. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    While I am still interested to the answer to my question above, I have just discovered Conditional Aborts and boy are they useful.
     
  43. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    OnUpdate doesn't run for ParentTasks, instead CanExecute and OnChildExecuted are the two main callbacks which are used. If it still doesn't work after using CanExecute if you can post your logic for the task I should be able to offer a suggestion.

    They are extremely useful and because of them you pretty much never need to use the interrupt set of tasks again.
     
  44. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    One thing I wouldn't mind seeing is how to compose new tasks in C# that draw in other tasks and manually manage their execution. I've thought it would be useful to capture some regularly used patterns of 2 - 3 nodes into a single new task without reimplementing the logic of the constitutent nodes themselves. One idea I had was a Parallel that decorates all of its children with a Repeat with forever automatically. How could I do this without reimplementing Parallel and Repeat in a new task but using those tasks compositionally.
     
  45. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Within the task you can reference other tasks by declaring the variable and then selecting the task within the Behavior Designer editor. From there you could manually call the CanExecute, OnChildExecuted, etc methods on that referenced task. This could have unintended consequences though since Behavior Designer will still run it's normal flow and still call the corresponding task's methods.
     
  46. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    I guess I was more thinking that the new task being implemented would actually construct the internal task tree it depended on via construction and then manage that internal tree manually. That way it's just a light composite task that constructs some arbitrary abstraction.

    Anyway I have an additional question about conditional aborts. The following tree is supposed to shortcircuit anytime the external event is received and force the agent to wait a period of time before resuming normal operations. However, when the event is received, the aborts do not do anything and the behavior tree remains executing one of the three referenced trees. Is this just not how they work? Does the child sequence not count as a "conditional" node that gets re-evaluated? Is this a case where you just need to build out the proper interrupt configuration?

    GastariasScreenshot.png

    Edit:
    I just tried the following graph and... how does a Wait task fail?!

    Capture.PNG

    Edit 2:
    Ah it was the conditional abort.
     

    Attached Files:

    Last edited: May 6, 2017
  47. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    Okay I think this is actually a good challenge;

    Lets say you have a referenced behavior tree that just runs all the time, like under a Repeat set to forever. How can we stage the parent tree so that an event is able to interrupt that referenced tree and play something like a damaged animation, with particle effects, with a wait so that the event can even interrupt the handling of a previous event.

    That is to say, when the event comes in, it starts an animation, a particle effect and a wait - but if the event were to come in during say the wait, it would immediately interrupt and start a new animation, particle effect and wait - all the while blocking the main referenced behavior tree.

    I would really appreciate help pulling that off.
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    You are using a self conditional abort which will only abort when it is inside the branch, in your example that is the Log or Wait task. If you switch to a Lower Priority conditional abort then it'll abort when one of the three external branches are running. You can tell if the task is being reevaluated by the execution status having a repeater icon around the X or check:

    http://opsive.com/assets/BehaviorDesigner/documentation.php?id=89 (second to the last image)

    I think a Lower Priority conditional abort will do that. Take a look at this page where I created a pretty complex behavior tree and explained task by task exactly what it is doing:

    http://opsive.com/assets/BehaviorDesigner/documentation.php?id=119
     
  49. Eriks-indesign

    Eriks-indesign

    Joined:
    Aug 15, 2012
    Posts:
    50
    Is it possible to switch back a forth between two actions at random times? I tried that random selector, but it gets stuck on the wander action like it never finishes :/
     
  50. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    If you don't want to create a custom composite task the easiest way would be to use the Both conditional abort type with the Random Probability conditional task:

    BehaviorScreenshot.png