Announcement

Collapse
No announcement yet.

Press T to play sound only when in a Trigger Volume

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

    Press T to play sound only when in a Trigger Volume

    Hi guys,

    I'm looking to have my character talk to another by pressing T and triggering some dialogue.

    Wonder if you guys can help me out with triggering the audio when my character is only in the box volume so T basically does nothing outside of it.

    Thanks

    Gabriel

    #2
    Hey Gabriel,

    you could give the NPC a "Collision Component" with an "OnOverlapBegin" event. So while the player overlaps this Collision , the event is triggered. Check for your desired input key and play the sound.

    Do not use the "Tick Event" for such problems.

    Cheers

    Comment


      #3
      I have a Collision Component surrounding the NPC with a OnOverlapBegin but when I overlap I don't want it to play the sound straight away. I want it to enable the T key so I press it and have my character speak.

      Should I be disabling the T key in everywhere apart from the NPC Collision Component? How would I go about that?

      Thanks again.

      Comment


        #4
        You can handle the T key in the Character or PlayerController.

        When the character enters a volume, enable a bool like VoiceEnabled on the character.

        When the T key is pressed, check the bool. If enabled play audio.....
        https://www.casualdistractiongames.com

        Comment


          #5
          There is "Get Overlapping Actors" node.

          Click image for larger version

Name:	Безымянный.png
Views:	1
Size:	69.7 KB
ID:	1114305

          Comment


            #6
            Awesome Barnacle-Rus! That worked

            Thanks everyone for helping!

            Comment


              #7
              managed to get the same results with the gate node as well.

              Click image for larger version

Name:	blueprintgate.jpg
Views:	1
Size:	112.1 KB
ID:	1114306

              Comment

              Working...
              X