Search Unity

NodeCanvas - (Behaviour Trees | State Machines | Dialogue Trees)

Discussion in 'Assets and Asset Store' started by nuverian, Feb 8, 2014.

  1. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    I have it working for now so I don't need the fix immediately, but I'm glad there will be support for it in the next version. :) I'll update my workaround then.
     
    nuverian likes this.
  2. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    Hi @nuverian,

    glad you finally came back to us :) We missed you as you can see :)

    Oh yes , this is much easier indeed, thanks!

    Ah, I was wondering what this attribute does as I couldn't find it's meaning in the manual.

    Can I use this way in conjunction with calling a dialogue tree from BT with multiple choices? My plan was (as you said that MC was only DT) to fill the text-part needed in BT and then set the result as global variables and then to call the dialogue tree that would take these global variables. I know, this is not very clean, but unless you would create a MC Node for BT (this would be VERY VERY helpful and would allow me to get moving with my project :)) I would be stuck with this. My app is very dialogue based, mostly completely, and I must use BT for the logic. And I need MC, too ...
    So I would gladly appreciate your help :)
     
  3. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    hay, thanks :)
    no problem. i think if i can solve the part where one player knows what the other is doing i can solve the rest easily.
    the iterate node sounds pretty good. but i am having problems to use it.
    so i have a "Friends" list of gameobjects in my global blackboard which gets filled with a "Find all with Tag" action. works fine. all Players of my team are in this list on startup.
    then i have a bool "chase_target" - a local variable which each player has and get set to true as soon as each player chase the target.

    now i have this iterate node:
    as target list i choose the "Friends" list, but how do i move on now? how do i iterate over each player if the chase_target bool is true? or did i misunderstood something wrong?
     
  4. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    I'm glad too :)
    So, I've quickly created a Multiple Choice node that works within Behaviour Trees and have it attached for you here. It's basically a duplicate of the original with required changes made. It is not battle tested yet. Let me know if that is what you are after.

    BTMultipleChoiceNode.png

    Thanks!
     

    Attached Files:

  5. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,

    Here is how you can iterate the list and display a label "OK" on each "Friend" if the local "chase_target" variable is true:
    ForEach.png
    The decorator used just bellow Iterator, is "Override Agent" decorator. What this do, is that it will set a new agent for the Behaviour Tree, for the nodes bellow. In this case Friend variable. As a result, the Log action will use the "Friend" variable for it's execution, which is practically exactly the same as selecting "Friend" variable in the action for it's override agent instead of "Self":

    Override.png
    If you override the agent locally in the action like in the image above, then you don't really need the Override Agent decorator, but using the Override Agent decorator, do this for you for all tasks bellow it. So it is a matter of choice to use one or the other.

    Let me know if these work for you, or I misunderstood.
    Thanks.
     
  6. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    Damn, something's wrong with the forum pr my browser, I already had this sent yesterday :(

    Wow! This is really a quick working solution. What I am missing (of course ;)) is a way to have the text from the say before visible when the choices are presented. Like in the DT version.

    And a MC with a user-defined say would be ultra-cool, too. I know, in DT there is a simple say checkbox which is missing in the BT version, but if I may ask for an extra wish so soon before x-mas than this would be a cute addon :)

    And I will finally be able to continue, yeah! :)
     
  7. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    hey! so sadly i am still having problems with this. so i will start from scratch cause maybe i did somewhere else something wrong. here is my FSM. is calls a BT based on the stat of a bool. the bool gets set like this:

    Code (CSharp):
    1. void OnTriggerEnter(Collider collision)
    2.     {
    3.         if(collision.gameObject.name == "DribbleCollider")
    4.         {
    5.             ControllingFeet = collision.transform;
    6.             bb = ControllingFeet.parent.GetComponent<Blackboard>();
    7.             bb.SetValue("hasBall", true);
    8.             Debug.Log("Collide");
    9.         }
    and thats working without problems, if the player with this fsm gets the ball, the right BET gets activated
    FSM2.jpg

    the has ball BT looks like this:
    hasball.jpg
    also causing no problems.
    now comes my problem tree:
    noball.jpg

    i think i did everything you said, right? but i get this error:
    "Task Error:</b> Failed to change Agent to requested type 'UnityEngine.Transform', for Task 'Execute Function (mp)' or new Agent is NULL. Does the Agent has the requested Component? (Task Disabled)"

    here is also the blackboard by the way:
    blackboard.jpg
     
    Last edited: May 22, 2016
  8. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    Ohhhh, when is monday again?? ;)
     
    nuverian likes this.
  9. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Mh? Why? Nobody likes mondays :D
     
    nuverian likes this.
  10. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    The even further modified node is attached with the options requested :)


    Hey,
    Thanks for the images.
    That error basically tells us that the task is trying to execute with a null agent. This is probably due to the variable being null in runtime. Can you please confirm that the offended node variable where you have override the agent ("Self") is not null at runtime and when the error hits?

    There is also a new version 2.5.5 by the way which has a fix relevant to prefab instances. Please update to that new version.

    Thanks
     

    Attached Files:

    Last edited: May 23, 2016
  11. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    THAT'S why I like mondays :) Thanks a lot!
     
    nuverian likes this.
  12. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    Checked it, the 'say' option is there, but how can I connect a say command with a multiple choice to have the say displayed at the same time as the choices, just as in the DT MultipleChoice?
     
  13. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    The 'say' option will make the dialogue actor say the final chosen choice. That is how it works in the DT based one too. The previous said statement ony, will be displayed simultaneously with the choices. Can you clarify what you mean please? :)
    Thanks
     
  14. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    hey, thanks!
    so the "Friend" Gameobject which is the variable for the agent was null, yes
    now i placed a friend gameobject in the field so that its not null anymore. but still it doesent work.
    but i thing the problem is that i have no agent component since iam not using navmeshes? is that what the agent needs to be? ora are we talking about a different agent then the navmesh agent?
    the error is:
    Code (CSharp):
    1. <b>(test_FSM(Clone)) 'Execute Function (mp)' Task Error</b>: 'Failed to change Agent to requested type 'UnityEngine.Transform', or new Agent is NULL. Does the Agent has the requested Component?' (Task Disabled)
    2. UnityEngine.Debug:LogError(Object, Object)
    updated to 2.5.5
     
  15. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    No, we are not talking about NavMeshAgent here :), but rather the object used by the task/node, the "Friend" gameobject in this case and the error simply states that it is null when the node executes. Maybe it is because an element in your list "Friends" is null or destroyed in runtime?
     
  16. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    Damnit yes, it works :) I thought I would need the connection like in the DT where I connect the say action with the MC command directly. All is well, thx again and just in case you forgot, adding the globals is 'nice to have', too :)))
     
  17. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    hm. still nope. same error. i tried to drag the same "friend" as the BT is on in the variable and also a friend which is not the BT owner. both didn't work
    also the Friends Global list contain two active Gameobjects
    the BT is on both friend objects
    Max iteration is set to -1
    edit1: oh, wait. i just placed a debug log hello world underneath the Agent node. now it is doing something. have to check it.. be right back

    edit2:
    god damn, iam feeling so stupid. of course the node wont work because:


    the last check bool node is not true (chase target in the variables). i wanted to say set chase target to true, not if chase_target is true
    still weird that i get a "failed to change agent request"
     
    Last edited: May 23, 2016
  18. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    okay, i think iam almost there:
    node_chase.jpg
    but the problem now is, that both agents are still chasing the target
    chase_target.gif

    i think its more a logic error then a bug but could you please help me out:(:)
     
  19. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    I'm not sure exactly what you are after though :). This is a behaviour tree attached on each of the players right? If so, why are you using the iterator node here and not simply move the player (self) towards the "Global/BallTransform" if "Chase_Target" is true? I don't see the reason why itterate each friend to do that, since each friend/player has it's own BT. Maybe I miss something though.

    So. just a simply BT, which tests if self distance to ball is less that 10, moves self to ball, and then build the rest of the logic on top.
     
  20. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    Hi @nuverian, I think there is a bug in the 'say' option. I can set the checkmark for say, but it doesn't say the text like in DT. In DT when I set the checkmark the option is written in the node, like for the seconds. Seconds works in BT-MC.
     
  21. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Sure, I have 5 characters standing in a circle and in the middle is the ball. So all 5 have the same distance.
    All 5 get the call to move to the ball. Everyone has is own BT
    But only 1 guy should perform the action.
    So somehow like you would yell to your team "dont go, i go!". Does this make sense? So like in a real football game. Cause there is it also the case that only one player chase the ball and the others remain in there position.
    But sometimes even a guy who is further away runs to the ball than the nearest player, because... It gives the game some nice Randomness :D
    Currently all players chasing the ball
     
  22. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    Does the GraphOwner has a DialogueActor component? :)

    Hey,

    I see. Well :), all players do chase the ball now because you use the iterator and within each player BT, you iterate each other player to follow the ball. There is no need to iterate all other players since each one has it's own BT as far as I can tell.

    As for checking which player is currently chasing the ball, you can have a global variable like for example "Current" and then do something like this breakdown:
    CheckCurrent.png
    ("$this" is a local blackboard GameObject variable in this example)

    So the "current" variable tells us which player currently chase the ball. If none (null) or this, then ok, chase the ball. If it's not null or this, then the sequencer above will return Failure
     
    username132323232 and Der_Kevin like this.
  23. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Thanks! That sounds like a realy good approach :)
    Do you know how i can become better in finding these solutions? Any books you can reccomend or is it just experience?
     
  24. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    Noooooooooooooo!!! <gasp>
    Any more things I need to know? ;)
     
  25. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    @nuverian : Last time I swapped the BT_MultipleChoice source with the new one I lost the text inside the MC-Node, not the connections. I had deleted the old one and then installed the new one.
    Just for the future, what is the recommended way to update single source adjustments or general updates?
     
  26. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    It's mostly out of experience the more you work with these :) Here are some very nice reads though:
    Behavior trees for AI: How they work.
    Behavior Trees for Next-Gen Game AI.
    Decision Making


    Hey,
    Deleting and re-importing the file(s) should work fine. I will take a look why this BTMultipleChoice specifically does not recovered correctly.
     
    Der_Kevin likes this.
  27. SwiftIllusion

    SwiftIllusion

    Joined:
    Jan 22, 2012
    Posts:
    66
    Hello, I've tried hunting through the documentation and playing with the various decorators/selectors, and I'd greatly appreciate knowing if there's a smooth way to run a subtree once each time it is entered?
    My use case is I'm wanting to play an animation while an input axis is above 0, however when it's above 0 it keeps re-trigerring the play action so it doesn't actually start, and then when the axis is returned to 0 it's on a selector to play the next animation and ends up with the same issue.
    Here's a screenshot of my current setup: https://i.gyazo.com/7e84d790950d6f92a687784fc83749ca.png
     
  28. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,

    The Filter decorator is what can be used to limit the number of times the decorated child will run, but this is not each time it is executed, but rather once every time the behaviour tree restarts. So this probably is not what will help you here.
    The Play Animation action (as well as several others), have an option to "Wait Action Finish". If you check this option on, then the action will return Running and take as long as it requires before returning Success or Failure.
    Please try check "Wait Action Finish" in both your Play Animation actions and let me know if that works for you.

    Thanks.
     
    SwiftIllusion likes this.
  29. SwiftIllusion

    SwiftIllusion

    Joined:
    Jan 22, 2012
    Posts:
    66
    @nuverian Thanks for the response, regrettably that still doesn't get me what I need. The issue it creates is that the selector node ends up sort of on standby with its check until the animation has finished completing. This means that, while it does get the animation playing, it still resends the action to play the animation each time instead of allowing it to loop (as it is set to do in its settings) and it will only recheck if input is above 0 at the end of an idle animation cycle/check if it isn't at the end of a run animation cycle, causing delay between the change based on its position in the animation.
    It might work for other circumstances so I appreciate understanding that setting now but it doesn't work for this.
    -
    Hunting through the example scenes and doing a bunch more testing, I was able to finally find a solution :)!
    Instead of just running the animations as an action, I changed them into an action list and added a 'run forever' action below them, changed the conditional and selector to dynamic (otherwise they wouldn't re-evaluate during play) and now it works flawlessly :D!
    Maybe that could be a potential additional example using the soldier characters? Or at the very least now there's a known solution in-case anyone else needs to know. Thanks again for the response, hopefully the rest goes more smoothly :).
     
    nuverian likes this.
  30. Schazzwozzer

    Schazzwozzer

    Joined:
    Jul 27, 2012
    Posts:
    18
    Hullo. I'm currently deciding between NodeCanvas and Behavior Designer, and I'm leaning towards this one. For now, I'm mostly just interested in getting a good visual editor for AI stuff, so the low price point of NodeCanvas Lite is particularly attractive.

    However, I've noticed that NC Lite is only at version 2.4.2, and hasn't been updated since January. According to the main package's change logs, that suggests it's missing changes such as "Improved deserialization GC/speed by 300%", which sounds pretty important!

    Is NodeCanvas Lite no longer being supported?
     
  31. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,
    Thanks for your interest in NodeCanvas. The Lite version is already pending review which brings it up to latest framework version. The Lite version is still fully supported.
    Cheers!
     
  32. Cdngater

    Cdngater

    Joined:
    May 29, 2014
    Posts:
    65
    Hello,

    Not 100% sure if this is the right forum for this question as its to do with State machines and Flow Scripting.

    I've had NodeCavas and FlowCanvas for a long time, but never really delved into it. So now I am.. :) Loving it so far.

    So, basically here is the situation.

    I have a FSM with a SubFlowScript (SFS). The problem I am having is understanding about returning from the SFS back to the FSM.

    I need the FSM to respond to a success/fail condition from the SFS. In Flowscript there is a Finish Node with a Boolean input value, this completes the SFS and returns back to the FSM. I am not sure how to access that input value in FSM.

    Another other way I thought, was setting up events from the SFS and adding conditions in FSM based on those events. (It works, but feels cumbersome to me)

    Lastly, I guess I could always set a blackboard value from the SFS and ready it in the FSM.

    The questions are:
    1) Can I access the Boolean input value in Finish Node from FSM?
    1.1) If not, what is it used for?

    2) Is there a better way to return a success/fail condition from a SFS to its calling FSM?

    Thanks
     
  33. Schazzwozzer

    Schazzwozzer

    Joined:
    Jul 27, 2012
    Posts:
    18
    Glad to hear it. :cool: I went ahead and made the purchase today.
     
  34. TSabos

    TSabos

    Joined:
    Mar 8, 2015
    Posts:
    94
    Is there any way to assign an ID to a DialogTree node so that it pulls the entire thing from a lookup? We are possibly going to use different languages in our game, so the idea would be that just the ID is populated into the tree of the NPC like Priest_1a, Priest_1b or however we want to ID it but you get the picture. The CSV file (typical setup for supporting langs) is an ID + columns for each translation.

    I know currently there's a way to put things in [] to parse from the blackboard, so it might be possible to populate a blackboard at runtime with all the dialogs. If there are 100 dialog entries for an NPC that might get messy.. but is that possibly the desired method? Dynamic variable creation of the IDs to text basically.
     
  35. SCS_Dani

    SCS_Dani

    Joined:
    May 28, 2012
    Posts:
    55
    Hi!

    First of all, congrats for these plugins, are awesome!

    I've a problem (that seems a bug). I'm using latest version of everything (NodeCanvas 2.5.6), and when I duplicate a "Super Action State" insidea FSM, the cloned one shows "Owner system is null! This should have not ...".

    The original state includes:
    OnEnter actions:
    • TweenScale
    OnUpdate actions:
    • Decompose vector $localScale
    • Set variable <float> $Radius = $localScale.x
    Is this a bug or am I doing something wrong?

    Thanks!
    Best!
     
    Last edited: Jun 9, 2016
  36. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087

    Hey,
    Thanks! I am very glad you like the tools :)
    I've just updated the FSM FlowScript bridge, so that there are now optional Success/Failure events send when the flowscript Finish in success or failure similar to how it currently works for Behaviour Tree FSM states. Please re-download load the package here and let me know if that works for you.

    Thanks for the pointer!


    Thank you! The updated Lite version is now live by the way.

    Hello,
    Using brackets to replace text dynamically from variables even though a nice feature for others things, indeed not very appropriate for localization.

    The best way to go about it in my opinion, would be to use the "metadata" text fields of dialogue nodes for IDs, and then handle the localization in the UI code. You can duplicate the existing DialogueUGUI.cs and modify it to change the display text based on the metadata ID and your lookup.

    If you take a look at the argument of the event send for subtitles as well as multiple choice options, they both contain a "Statement" object. This object contains the text, audio and metadata of the current dialogue statement to be said or displayed.

    Something like this for example, could go under line #90 in DialogueUGUI.cs:
    Code (CSharp):
    1.             var id = info.statement.meta;
    2.             text = Localization.GetLocalized(id);
    You can of course always use the dialogue text field of the nodes itself for IDs instead of using the metadata field.
    Let me know if the above work for you.
    Thanks!

    Hey,
    Thanks a lot! I'm glad you like them! :)
    Indeed this is a bug. I will fix this asap. Meanwhile, please enter/exit playmode to update the duplicate Super Action State correctly. Sorry about this. As soon as I have the fix, I will PM you the code.
    Thanks again!
     
  37. Cdngater

    Cdngater

    Joined:
    May 29, 2014
    Posts:
    65
    That works. So instead of me sending events manually, this change will do it depending on the bool input value of finish. Guess no way of just actually returning the bool as a value instead?
     
  38. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,
    It is possible, but instead I opted to go with success/failure events so that it's consistent to how Sub Behaviour Trees work in FSMs.
    Since the variables are shared between the sub FlowScript and the parent FSM, you could simply set the desired variable just before the Finish flowscript node:
    SetVariableBeforeFinish.png

    Let me know if that works for you.
    Thanks!
     
  39. Cdngater

    Cdngater

    Joined:
    May 29, 2014
    Posts:
    65
    I'm all for consistency, I've not got into sub behaviours yet. I'm ok with the change, it works, thanks for doing that.
     
  40. Ladace

    Ladace

    Joined:
    Dec 7, 2014
    Posts:
    40
    Hi, I'm starting to use the behavior tree of NodeCanvas and it is really great to work with. I just wish there was a way to create blackboard variables assets, so I can tweak my constants and use them easily in the behavior tree.

    Or is there a recommended way already to work with constant files?
     
  41. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    You are very welcome. Glad it works for you.

    Hey,

    With the new version of NodeCanvas 2.5.6 gone live couple of days ago, blackboard variables can now be bound to static properties and fields. So for example you can if you want create a class with static properties or fields and then bind any blackboard variable you want with these properties/fields. (You will of course need to add the class to the Preferred Types Editor list as well). It's a very efficient and easy way of using global data I think.

    Alternatively, you could create a Scene Global Blackboard for what you are after, even though not exactly what you asked for I think.(?)

    Let me know.
    Thanks.
     
  42. Ladace

    Ladace

    Joined:
    Dec 7, 2014
    Posts:
    40
    Hey, thanks for your reply.

    I see. The project is going big and I would put constants in a data file rather than a static class so it won't take time to compile every time I change a value. Scene Global Blackboard might be OK but it's kind of tricky. Just saying.
     
  43. SCS_Dani

    SCS_Dani

    Joined:
    May 28, 2012
    Posts:
    55
    Thanks for your reply!

    I've found another situtation where I'm not sure if it is also a bug. Let me tell you what happens:

    I've created a simple Behaviour (image attached). Inside a script I've the following code (and Damage variable is set to "555"):
    ...
    public int Damage;

    protected void AddBasicVariablesToBlackboard()
    {
    m_Blackboard.AddVariable("Damage", typeof(int));
    m_Blackboard.SetValue("Damage", (int)Damage);
    }

    // Use this for initialization
    protected virtual void Start()
    {
    m_BehaviourOwner = GetComponent<BehaviourTreeOwner>();
    m_Blackboard = GetComponent<Blackboard>();

    AddBasicVariablesToBlackboard();
    }
    ....


    When I run the test, and I press "Comma", unity log returns:

    Hello World
    Var 'Damage' = 555
    Var 'Damage' = 0
    Bye!


    Why does it returns "0" after returning the right value? And why writes twice to the log...

    Thanks and best!

    P.S.: I've also discovered that even if I disable the Behaviour and set On Enable to "Do Nothing", when I press Comma it throws "Hello World" -> "Var 'Damage' = 0" -> "Bye!".
     

    Attached Files:

    Last edited: Jun 14, 2016
  44. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello again and sorry for late reply.
    The ability of having blackboard as assets is already something I am looking towards, but the feature us held back until it becomes totally clear and consistent with the rest of the framework.
    By the way, most people I know using NodeCanvas and in need of global variables across multiple scenes, would use a prefab Scene Global Blackboard which would instantiate in their initialize scene, leaving the Global Blackboard "Don't Destroy On Load" to the default true setting.
    I hope either this, or the ability to bind variables to static properties/fields work for you until the blackboard asset feature is implemented completely.

    Thank you.


    Hey,

    I have just re-created your behaviour tree as the image, but everything is working correctly, meaning that the variable is only logged once; and when the "On Enable" is set to "Do Nothing", nothing does happens. Could it be that you have some other behaviour tree running and maybe responsible for mixing up the logs?

    If not, can you send me a small reproduction project (support@paradoxnotion.com) to check this out since I can't really reproduce it? :-/

    By the way, instead of manually adding and setting the variable on initialization, probably a better (certainly easier) way, would be to simply create a variable named "Damage" bound to the Damage field on your script and then set the Damage on your script inspector to "555" for example. Using a bound variable like this, also means that if at a later time your Damage field value on your script is changed in any way, so will the bound variable update this change.

    Let me know.
    Thanks!
     
  45. SCS_Dani

    SCS_Dani

    Joined:
    May 28, 2012
    Posts:
    55
    Fixed! Was my fault :confused:. I'm instantiating dynamically and due to an error there were two instances. I'm sorry!

    About the Damage, as I initialize everyting dynamically I can't use bound variables, right?

    Thanks and best!
     
  46. cfoster

    cfoster

    Joined:
    Aug 27, 2015
    Posts:
    6
    Hi, I have just purchased NodeCanvas and am in the progress of migrating from RainAI.

    I seem to be doing something wrong in an object's Blackboard (for FSM and BT). I am trying to add a variable that is bound to 'self' -> transform ->position. I do the following:
    • 'Add Variable' or change the binding of a variable, for a Vector3
    • Select Bind (self)
    • It then displays a list but Transform is greyed out.



    (btw: ignore the second 'Test' in the menu as I was debugging and caused that :)

    Any thoughts?

    edit: I traced this through your code and the issue is that position is a property and not a field; whereas your code does a GetFields(). Is there anyway to handle properties?
     
    Last edited: Jun 16, 2016
  47. cfoster

    cfoster

    Joined:
    Aug 27, 2015
    Posts:
    6
    I found the answer on the NodeCanvas forum http://nodecanvas.paradoxnotion.com/forums/topic/problem-with-blackboard-data-binding-in-v2-5-6/

    Seems like it was a bug that affects the Mac only.
     
    nuverian likes this.
  48. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    No worries.
    If you add the variables manually like in your initial post, then you can't use bound variables (at least through the editor), otherwise you can certainly do, as long as the variable exists on the blackboard prior to instantiating the object.

    Cheers!


    Hello,
    Yes, this is indeed a bug in Mac only menus currently. I have already submit a new version to the asset store fixing this.
    The post on the forums is correct, but for your convenience and everyone else having this issue, I have attached the fix as a .unitypackage here.

    Thanks!
     

    Attached Files:

  49. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    heyhey :)
    uhm. i wanted to find the nearest friendly player by using find closest by tag but it always gives me my own player (of course, because iam the closest to myself with that tag :D)
    but how can i prevent this (iam using the FSM part for this)
     
  50. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    @nuverian
    Behaviour trees is new to me, with documentation only many things stay hard to figure what they do.
    Is there some simple games samples video tutorials ?