Announcement

Collapse
No announcement yet.

Help! How do I set the value of a boolean variable when the player hits a trigger?

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

    #16
    Originally posted by travisc View Post
    Ok, This is how it's like in the lvl blueprint:

    [ATTACH=CONFIG]147760[/ATTACH]

    In the character blueprint, I got an error:
    [ATTACH=CONFIG]147761[/ATTACH]
    You also need to connect the output nodes of the player bp with the launcher var inside your level blueprint. The error above appears because you need to add a get gameinstance function node and plug it into the Object input of your instance node. While at it and to reduce the amount of casts, rightclick the blue output node of the game instance (in your player blueprint), and create a new variable, call it MyGameInstanceRef (for reference). You then can use this new var everywhere in your player blueprint, when calling the gameinstance. Also the Event Tick branch should not point to the game instance.
    [LEGENDS of EPICA]

    Comment


      #17
      Originally posted by unit23 View Post
      You also need to connect the output nodes of the player bp with the launcher var inside your level blueprint. The error above appears because you need to add a get gameinstance function node and plug it into the Object input of your instance node. While at it and to reduce the amount of casts, rightclick the blue output node of the game instance (in your player blueprint), and create a new variable, call it MyGameInstanceRef (for reference). You then can use this new var everywhere in your player blueprint, when calling the gameinstance. Also the Event Tick branch should not point to the game instance.
      Not sure if I understood everything here, but this is what I came up with. What should I do with the "Event Tick"? (This is the character BP) Click image for larger version

Name:	dunno8.PNG
Views:	1
Size:	187.7 KB
ID:	1130794
      Last edited by travisc; 07-08-2017, 07:40 AM.

      Comment


        #18
        Originally posted by travisc View Post
        Not sure if I understood everything here, but this is what I came up with. What should I do with the "Event Tick"? (This is the character BP) [ATTACH=CONFIG]147764[/ATTACH]
        Do not merge Tick and BeginPlay here.

        The set MyGameInstanceRef belongs to the corresponding Cast to MyGameInstance, thus plug both together inside the Event BeginPlay. You can use a variable as many times you want, so no need to move the events so close together, which will become a visual overview issue, as the project grows.

        Event Tick after the branch node, first drag and drop the newly created MyGameInstanceRef to the Event Tick area, then from that variable (right click the output) add a Set GrenaderEnabler (or it appears you renamed it to GrenadeLauncher) via the search popup and check the bool to be true.

        Also for the Event Begin Play, it should look like this
        Click image for larger version

Name:	example.jpg
Views:	1
Size:	36.5 KB
ID:	1130795

        Axe would correspond to your EnableGrenadeLauncher bool
        [LEGENDS of EPICA]

        Comment


          #19
          Also add a do once node after the Event Tick branch, to prevent firing this event branch over and over again.
          [LEGENDS of EPICA]

          Comment


            #20
            alrighty, that makes more sense. Still isn't working though. The player isn't able to use grenades even after hitting to trigger volume. This is how it looks now:

            Click image for larger version

Name:	dunno9.PNG
Views:	1
Size:	235.2 KB
ID:	1130799
            Attached Files
            Last edited by travisc; 07-08-2017, 08:28 AM.

            Comment


              #21
              Originally posted by unit23 View Post
              ...
              ............................ping

              Comment


                #22
                Originally posted by travisc View Post
                alrighty, that makes more sense. Still isn't working though. The player isn't able to use grenades even after hitting to trigger volume. This is how it looks now:

                [ATTACH=CONFIG]147769[/ATTACH]
                You need to place a Get MyGameInstanceRef (just drag the variable into the Event graph and choose Get) to the Event Tick. You want to read that variable value, not set it anew, we already assign this at the Event BeginPlay.
                [LEGENDS of EPICA]

                Comment


                  #23
                  Also it seems you need to set up a counter for the grenades delays.

                  Example for a delay
                  [LEGENDS of EPICA]

                  Comment


                    #24
                    Holy hell it finally works. THANK YOU

                    character blueprint
                    Click image for larger version

Name:	dunno9.PNG
Views:	1
Size:	311.4 KB
ID:	1130809

                    lvl blueprint
                    Click image for larger version

Name:	dunno9_lvl.PNG
Views:	1
Size:	72.7 KB
ID:	1130810
                    Last edited by travisc; 07-08-2017, 12:53 PM.

                    Comment


                      #25
                      Originally posted by travisc View Post
                      Holy hell it finally works. THANK YOU
                      Nice, glad you got it working!
                      [LEGENDS of EPICA]

                      Comment

                      Working...
                      X