Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.


Product Version: Not Selected
more ▼

asked Nov 04 '14 at 12:27 AM in Blueprint Scripting

avatar image

13 1 3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

more ▼

answered Nov 04 '14 at 06:14 AM

avatar image

108 7 10 11

avatar image cubicparanoia Nov 04 '14 at 07:43 PM

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.

alt text

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

avatar image ItzFriday Nov 04 '14 at 10:41 PM


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!

avatar image ItzFriday Feb 01 '15 at 08:03 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

more ▼

answered Feb 01 '15 at 10:35 AM

avatar image

13 1 3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question