Maybe I missed some info from the official document, I am thinking if there is a way to get an event triggered by node running result.
for example, there is a sequencer node as my behaviour tree start node which should be a “primeNode” , I can get sub node count by using outinConnections.count , in my case ,there are 3 sub action node under this root node ,they are actionA,B,C run one by one, so how can I get an event from the root sequence node when these 3 action nodes switching one by one?
I know I can add a custom action as a sub end action inside A/B/C action container, then send out a customized event to show which sub-branch node starts running or just finished ,but I think if there is a generic official API to get the connected node running state, especially the switching running event .
Hmm. I am not sure I completely understand the use case, but you can get the current status of a node by it’s “status” property.
Based on your example:
1
2
3
4
5
6
for(vari=0;i<outConnections.Count;i++){
varnode=outConnections[i].targetNode;
varstatus=node.status;
}
There is no event raised when a node changes status, since considering that nodes change status very frequently, that would possibly have a performance impact, especially considering the fact that I haven’t yet found a practical reason for such an event.
I think you have a very special case here 🙂 Would you mind sharing what you want to achieve? Maybe there is another solution to that.
hi, thanks for the reply.
ok, if change my question as a game example, an NPC has 3 action nodes: stand, walk, run when the NPC starts to run, there is some effect or animation coming out. I wish NodeCanvas has a system to notify me which node is running now and when it starts/ends, then I can connect this event to my code {some events manager }to trigger something as a generic way, rather than I write many different events in each action like running/walking …
if don’t have too many classes to subscribe it, then it shouldn’t have the performance issue. rather than checking the node status in update function running per frame.
Thanks for the follow up. I think such an event can be added easily if you find it useful.
If you want, please drop me an email to “support_AT_paradoxnotion.com” and will send you a source code modification that adds the requested event when a node status is changed. If that ends up working nice for you, I will then implement the change into the next version.