Communication via Blackboard or Events

NodeCanvas Forums General Discussion Communication via Blackboard or Events

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9205
    bbdata
    Participant

    Hei,

    I’m nearly going crazy trying to communicate between my hunting DroneObject driven by Nodecanvas and a TargetObject controlled by a DamageHandler from UFPS.
    Last I used a Blackboard way, but:
    I found that example for SetDataValue in another topic (http://forum.unity3d.com/threads/nodecanvas-behaviour-trees-dialogue-trees-state-machines.227190/), but using this I get a bunch of errors (see Img). Is this due to using the code snippet inside my OnMessage.Action?

    And why I need get AND set, when I only want to set a Blackboard variable? I’m a bit overwhelmed by the various traps at the moment. It took me one day to got this Eventhandler from UFPS working in my own script and now I’m not able to bring the easy GotKilled-Message in any form in NodeCanvas. First I simply tried to use a condition in nodeCanvas to check if my targetObject is destroyed (=inactive), but didn’t find an appropriate action and failed to implement a functioning new one..

    Any advice for a preferably simple solution is very welcome.

    Example:

    My Code:

    #9211
    Gavalakis
    Keymaster

    Hey,

    That get/set code is a property and you are trying to declare it in a method :). You can simply omit the property and do this, directly calling SetDataValue on the blackboard:

    Furthermore, you can check if a game object is active with the ‘CheckProperty’ Condition, through which you can check any property on any component on any game object (image attached) 🙂

    If you wanted to check if a blackboard gameobject variable is null instead, you can do so with the ‘Check GameObject’ condition. Simply check ValueA against a null ValueB in that condition.

    There are more ways to communicate between objects but I don’t want to confuse you right now.
    Let me know if you have any questions and the above suffice 🙂

    Cheers

    Join us on Discord: https://discord.gg/97q2Rjh

    #9210
    bbdata
    Participant

    Hey Gavalakis,
    thanks for your explanations! I got a bit clearer now, but there are still some obstacles.
    The Code for SetDataValue is really nice and simple, but using exactly this I got an:

    Assets/02-Scripts/DroneCtrl.cs(34,33): error CS1525: Unexpected symbol `<internal>’

    I don’t know what this error means, there is no <internal>, googling CS1525 brought hints for weird Symbols……
    aaaah ok! Retyping the whole line, and the error vanished 🙂 first success!
    -> Blackboard SetDataValue seems to work finally.

    I’ve also tested the other ways with checkProperty/checkGameObject, since they would be the easiest solution without the need of events.
    1. CheckProperty – can’t use this like in your example, the targetObject is dynamically saved in Blackboard ‘nearestTarget’, so I get ‘this Condition needs the Agent to be known…’, see screenshot.

    2. Blackboard Check GameObject doesn’t do the job, because my Blackboard variable ‘nearestTarget’ does not reflect, if the referenced target gameObject is set active or not, and active/inactive seems to be the only status I get back from my target with DamageHandler-Script without using extra events.

    So I’m a few steps nearer but not done now.

    #9209
    Gavalakis
    Keymaster

    Hey,

    Indeed the Script Control tasks do not work with variable objects that are set at runtime due to not knowing what components will actualy be on that gameobject. I am looking at ways to improve that though.

    You can use the following simple Condition Task to check if a game object is active or not:

    As in every task, if you want to check the condition for a blackboard variable, override the agent and select your variable from the dropdown.

    Cheers!

    Join us on Discord: https://discord.gg/97q2Rjh

    #9208
    bbdata
    Participant

    Hey,
    that action works perfect, thanks!
    🙂

    I installed the nodeCanvas Update this afternoon and got some strange behaviors now – it seems that all NC-Action stops at my subtree and doesn’t return to the main tree afterwards. Is this a possible change after update or must the reason be located somewhere else?

    #9207
    bbdata
    Participant

    PS: Investigated further, BehaviourTree is executed as usual, Subtree also, then at end of Subtree NC seems stopped – PlayButton shows initial state, NC-Editorwindow shows no activity. If I push the StepButton, NC returns to Maintree and performs first action, as expected.

    …sometimes nodeCanvas stops just somewhere in Maintree, no Message is displayed, no reason apparent.
    hmm, what can I do??

    #9206
    Gavalakis
    Keymaster

    Can you please send me a project that this happens at info_at_nodecanvas.com ?
    I can’t reproduce this strange behaviour no matter what.

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.