Announcement

Collapse
No announcement yet.

Help with assigning an Input Action to a variable

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with assigning an Input Action to a variable

    For some reason I can't wrap my brain on how to get switching functionality.

    I have a 'Current Weapon' int variable which switches from one State Machine to another using the Blend Poses node. That works fine. (See screenshot)

    On my 'MyCharacter' Blueprint EvenGraph I have an Input Action called "Holster" with a press and release.

    I can't figure out how to tie that Input Action to modify my int variable called 'Current Weapon'. Any suggestions would greatly be appreciated.
    Attached Files

    #2
    Do you ask how communicated between MyCharacter and the animation blueprint?

    Comment


      #3
      Yes. Im still trying to figure out how to do that...

      Comment


        #4
        Click image for larger version

Name:	get data.JPG
Views:	1
Size:	180.8 KB
ID:	1056948

        you need cast the player variable and get the int in "Holster", to set in 'Current Weapon'.

        Comment


          #5
          Originally posted by erWilly View Post
          [ATTACH=CONFIG]12194[/ATTACH]

          you need cast the player variable and get the int in "Holster", to set in 'Current Weapon'.


          I'm still a bit lost. I've taken a screenshot of what is already setup since I'm using the Starter Animation Pack as my base. I think I need to create another Event Sequence for switching my States like outlined above in my previous screenshot. It seems that you can only have one Event Blueprint Update Animation node. Should I build off of that since that is currently setup with Movement? I tried to make a new EventGraph but apparently you can only use one Update Animation node...
          Attached Files

          Comment


            #6
            any variable that you put in HeroCharacter can be "get" from node "Cast To HeroCharacter", like JumpbuttonDowm and CrouchButtonDowm.

            Comment


              #7
              I'm new to Blueprints so please bear with me. Here is what I have setup so far:
              Attached Files

              Comment


                #8
                So 'Current Weapon' sets the States; 0 for No Weapon and 1 for Rifle. 1 is the default. (Screenshot 1)

                If you click the 'Holster Weapon' input key it sets 'Holster Weapon?' to True, the Branch checks 'Holster Weapon?' and since it's true it sets 'Weapon is Holstered' to true. (Screenshot 2)

                If I understand this correctly; 'Try Get Pawn Owner' and Cast To 'HeroCharacter' checks my character, check the variable 'Weapon is Holstered', and since it's True it sets the 'Current Weapon' to 0 which should play my 'No Weapon' State. It doesnt.

                Thoughts?

                Comment


                  #9
                  If I understand this correctly; 'Try Get Pawn Owner' and Cast To 'HeroCharacter' checks my character, check the variable 'Weapon is Holstered', and since it's True it sets the 'Current Weapon' to 0 which should play my 'No Weapon' State. It doesnt.
                  yes correct that is how work.


                  BTW, the second screenshot is a little overthinking but work.
                  They are a funny node calling Flip Flop that save a lot of spaghetti.

                  Click image for larger version

Name:	flip flop.JPG
Views:	1
Size:	33.7 KB
ID:	1056996
                  Change aim by Weapon is Holstered

                  BTW2 Why dont use a "blend Pose by Bool" ta save the conversion the bool to int in the last part of third screenshot?
                  Last edited by DomusLudus; 09-23-2014, 02:57 PM.

                  Comment


                    #10
                    Thanks for the Flip/Flop tip! Im working through the Blueprint Essentials, so I'm hoping to get a better understanding.

                    Based on what I have shown above, is there something I'm missing? When it click the 'HolsterWeapon' key nothing happens.

                    Comment


                      #11
                      You need "Event Blueprint Update" pin to cast to HeroCharacter. Use the same node that JumpbuttonDowm and CrouchButtonDowm.
                      Last edited by DomusLudus; 09-23-2014, 03:37 PM.

                      Comment


                        #12
                        Originally posted by erWilly View Post
                        You need "Event Blueprint Update" pin to cast to HeroCharacter.
                        Thats the problem. It's already attached to the Movement portion of the graph, and apparently you can't connect the Even Blueprint Update Animation to multiple nodes.

                        Comment


                          #13
                          Click image for larger version

Name:	mennn.JPG
Views:	1
Size:	86.7 KB
ID:	1057009


                          You can use secuence to reuse the same node.

                          Comment


                            #14
                            Originally posted by erWilly View Post
                            [ATTACH=CONFIG]12336[/ATTACH]


                            You can use secuence to reuse the same node.
                            Now I got it to work, thanks for your help!

                            Comment


                              #15
                              you're welcome, I feel like a midwife in this process, It was a beautiful bird.

                              Comment

                              Working...
                              X