Making a toggleable radio

I am currently polishing off my Final Major Project for college and i have a radio in my scene that i modelled. I want to make it so that when you walk up to the radio and there will be a line of text saying you can press “F” and it will start playing a .wav file. Once the radio is on the text will change to Press “F” to turn off radio. Im not that experienced with unreal so any help would be appreciated

Hi,

You most likely want to setup a trigger volume and place your radio in it. In the OnStartOverlapping Event, (which fires when something overlaps your trigger volume), cast to your player to make sure it was him who overlapped the volume, not something else. If it was the player, you can add/enable a Text Render component (you can either place the text in the actual 3D scene, or you can create a widget and show it there) and set a boolean to true (something like ‘CanActivateRadio’).

In your player controller (or wherever you handle input) make an ‘F Pressed’ event, but only execute it if the ‘CanActivateRadio’ boolean is true. You can then use the PlaySound2D or something similar (you can even play the sound at a location, so it fades away as you get further away).

Also, do not forget to set your ‘CanActivateRadio’ bool back to false when the player is no longer overlapping the volume.

Keep in mind that this is not the best solution to this porblem, but the easiest one I can think of.

I know the steps are a bit broad, but I just wanted to get you started, so please feel free to ask for more help if you struggle.

Hey.

I wanted to explain, how to do it, but instead of writing a book about it (or plastering the unreal engine forums with a lot of images), I made a blueprint for you, which is highly customizable. You can find the blueprint in the attachment.

Just go into your project folder and put the “Radio_BP.uasset” from the zip into your project folder’s “Content” folder.

I made a lot of tooltips and commented stuff. When you place the blueprint in your level, you will see in the details panel a lot of options to customize. You can even select the wav, which sould be played and you can specify, what model you want to use.
The window looks like this:

Good luck with your major project!

PS: It seems you are everywhere, Kontur :D. Glad to see helpful people roaming around.

Haha, yes, I love to help people when I have the time, and I also browse the forum quite a lot to keep an eye on any useful info/tips, and I just can’t move on when I see someone with a problem that I might be able to help with :slight_smile:

Hey thanks for the reply but i can’t seem to import the uasset file into unreal. I’ve tried manually dragging the uasset file into my content folder too, any ideas why its doing this?

Oh wait i think i have just realised what is happening here. I don’t think we have the same version of Unreal i am currently running 4.10.2

Got it working, just updated to 4.11 and its working great thank you!! <3

Oh wait small problem :frowning:
This map is using externally referenced packages which won’t be found when in a game and all references will be broken. Perform a map check for more details.
Would you like to continue?

When i want to “save all” so i can package the game it comes up with this message. And once the game is packages the blueprint that you made for me doesnt exist anymore :frowning:

Good that it works. I am annoyed that Unreal doesn’t have any way to directly export blueprints. If blueprints are dependent on outside functionality or newer nodes then it should be the **** problem of the user. Well…

I updated the blueprint and put it in the content folder like last time. I hope this works :).

EDIT: If you still have the same problem after this, make a backup of your “Saved” folder in your project folder and then delete your “Saved” folder afterwards. This should clean up all previous config files, which may cause this problem.

Its okay managed to fix it im pretty sure, just had to rename a folder and it seems to save now. Its just packaging so ill post again if its successful :d

It worked! Thank you so much!

Glad it worked :).