Learnign the basics

NodeCanvas Forums General Discussion Learnign the basics

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #9384
    Anonymous

    Hello,

    I bought this a month or two ago and have played around as well as looked over the documentation. There are two items I am currently stuck on that maybe I just didn’t see in the documentation.

    First I create a string on the blackboard. This is initialized to “Idle” with the intention of calling an action to play the Idle animation. So simply how to I compare the content of the string to see if it is “Idle” or any other state the object may be in.

    Second When this happens I want to first check to see if the Idle animation is currently playing. If it is not then I would play the animation. This would be useful if the NPC was searching and I did not want to restart the searching animation constantly.

    #9392
    Gavalakis
    Keymaster

    Hello,

    There is an action included to play an animation. This action plays an animation by providing the AnimationClip to be used directly instead of it’s string name. This Action also checks if the last animation played was the same and if it was it doesn’t plays the animation again. Have you tried that action?

    If you want an action to play animation by string name I could provide one

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

    #9391
    Anonymous

    Actually I am needing to check a string in general. Such that if the string for myState is a certain string then do the logic.

    Selector:
    Condition:
    If (myState == “Idle”)
    Condition:
    if Idle animation is not playing
    Action:
    Play “Idle” animation clip

    Selector:
    Condition:
    If (myState == “Shopping”)
    Condition:
    If (my position != my waypoint position)
    and so on

    #9390
    Gavalakis
    Keymaster

    Oh 🙂

    There is a CheckString condition which does just that.
    Does it work for you?

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

    #9389
    Anonymous

    Where is it located? I have looked under actions and conditons but am not seeing anything for checking a string but every other type is there (Boolean,float ec)

    #9388
    Anonymous

    Sorry I was wrong. I do have check string listed under conditions. However if I set check string and set string A to the blackboard variable of myState (which is set to Idle) and then string B to Idle it returns a false.

    Name Value
    myState Idle

    Condition
    If ‘$myState’ == ‘Idle’

    Result is false

    #9387
    Gavalakis
    Keymaster

    Please make sure you have updated to the latest version 1.4.6 🙂 Check/Set String is there

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

    #9386
    Gavalakis
    Keymaster

    Oh damn. You are completely right. There is a bug 🙂

    Please replace line 17 of CheckString.cs with:
    return stringA.value == stringB.value;

    Thanks and sorry for it.

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

    #9385
    Anonymous

    Works great. Thank you very much.

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