Learnign the basics

Forums 💬 NodeCanvas 🗨️ General Discussion Learnign the basics

  • This topic has 0 replies, 1 voice, and was last updated 11 years ago by Gavalakis.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #15101
    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.

      #15109
      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

        #15108
        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

          #15107
          Gavalakis
          Keymaster

            Oh 🙂

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

            #15106
            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)

              #15105
              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

                #15104
                Gavalakis
                Keymaster

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

                  #15103
                  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.

                    #15102
                    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.