Is there a way of activating the object which is in proximity to the player ?

I need to come up with a BP that makes it so that when the player can press E to activate and deactivate individual objects which have separate sounds.

Example : Triangle shape plays fire sound when E key is pressed in proximity, when E key is pressed again it stops …playing.
Circle shape plays water sound when E is pressed in proximity , it also stops when E is pressed again.
Circle and triangle can also both be pressed in successive order when in proximity and will each …individually play their sounds, they can also both be stopped whenever they are clicked on again.

Optional: I need to know how to make Objects/Shapes change colour on key press.

Thanks.

Make the Audio you want to play as an Audio Component in the BP. Put a Sphere component on the Blueprint and set it to the radius you want the object to be interactive at. Add events for the sphere component: OnComponentOverlapBegin and OnComponentOverlapEnd. Plug these into a Gate Node. Begin into Open and End into Close. Take the “other actor” option from the overlap nodes, click and drag them out and Cast to [yourCharacterBpNameHere]. This makes it so that when the player overlaps the sphere component, something can happen.

Next, you make a Blueprint Interface Node and plug up both the Character and ShapeBP together. There are many tutorials for this with video instructions for passing messages from one BP to another. You will take the event and plug it into the Gate Node, then into a branch with a “is Playing” bool attached to keep track if the audio component is playing or not. Reference the Audio Component and make a Play and Stop node from it. Plug the Play node to the False section of the Branch (and add a Set “isPlaying” to True Node); Next add the Stop node to the True section of the branch(and add a Set “isPlaying” to False Node).

Now when the event from the player comes in while he is overlapping the sphere component and the bool ‘IsPlaying’ is False, it will Play the audio and set isPlaying to true, and vice versa.

Tried to follow you indications but as I’m fairly new to the engine it failed. Here is a screenshot of what i attempted to do.
Maybe you can explain to me why it doesn’t seem to be working.

I can hear the sound but cant interact with the object. No idea where i’m going wrong. :confused:

Take the execute line from OnComponentBeginOverlap and plug it through ‘Cast to My character’ before putting it into the Gate.

Do the same thing for OnComponentEndOverlap through its ‘cast to mycharacter’ and into Close.

I didn’t know there was an IsPlaying node. Since it returns if the sound is playing, that looks like you wont have to make another bool variable! Plug that into the Branch.

If you are hearing the sound, then that means the sound must be on auto activate. Take that off and now that you can interact with it, you should be able to turn it on and off. Sorry for the late response!

Can i get an update as to if this helped ya?

Yes it did, i did not end up implementing it in my game in the end though.
Thanks for your help, I appreciate it.