No announcement yet.

Press Key and Play Sound

  • Filter
  • Time
  • Show
Clear All
new posts

    Press Key and Play Sound

    Hiya everybody!

    So sorry if this is an incredibly novice question, but I am super new at scripting and am trying to figure out the basics.

    I have a cue in my level where the player needs to run up to an object (in this case, I've blocked in a BSP, so no static meshes in this level yet), press the E key, which is what me and my team have decided is the "action" key in our game, and an audio cue is played. I've got the audio cue in the level and I've been trying loads of stuff to get it to work. The one time I got kinda close, the sound was playing at level startup and ANYWHERE on the map that I pressed E the sound cue would play, not just in the trigger box. I'm following this tutorial:

    But instead of needing an animation I replaced the Cast To Matinee to Cast to SoundCue instead and hooked up the sound cue that I've placed in the level into the play node. Any ideas on how to make this work properly?

    If you are going for the simplest method just place a trigger box in your level. Open up the level blueprint and set a boolean when the trigger is overlapped. Use a branch from the E key press and if it's true then play the sound. Make sure to set the boolean to false when you step outside of the trigger.