I am having trouble getting the probability selector composite to function as I would expect.
I have an agent will randomly select actions, the weight of each is a dynamic variable. The issue is that as soon as an action is initiated, the weight of that action immediately becomes 0. This causes the probability selector to return failure and interrupt the action that in progress.
Attached is section of my behaviour tree.
I have looked at the code, for ProbabilitySelector.cs, and it looks like the issue is that if the total weight changes such that the existing currentProbability variable is higher than the total, then the default fallback behavior is to return failure. This seems like something that could happen at any point if the weights change.
Hmm. Do you mean that the weight of the branch becomes 0 on its own (like a bug), or that you set the weight of that branch to 0 manually (while the branch is running)?
Since you are using Dynamic Variables, are those Dynamic Variables set before the Probability Selector executes?
With that said, I’ve just realized a bug in ProbabilitySelector and have redesigned the node. I am attaching the modified node for you here which I believe will also resolve the error you are encountering since now, the weight of the children are only evaluated when the ProbabilitySelector is initially executed (not while it is Running).
Please let me know if the attached modified version of the Probability Selector node works correctly for you.
Thank you!