Download

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 :slight_smile:

Gabriel

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

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.

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…

There is “Get Overlapping Actors” node.

Awesome Barnacle-Rus! That worked :slight_smile:

Thanks everyone for helping!

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