Announcement

Collapse
No announcement yet.

Play sound once

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Play sound once

    Ive got a system set up where when the enemy becomes hostile he makes a sound, the thing is it doesnt just play once, it keeps playing over and over, since the sound is about 2-3 seconds long they overlap and start before the one before it has finished, how can i make it so the sound only plays once or one at a time. heres what i have.

    Click image for larger version

Name:	sound.jpg
Views:	1
Size:	161.2 KB
ID:	1227081

    Thanks

    #2
    Originally posted by Grot13
    There is a "Do once" node you can put just before.
    then you can reset it as you want, with a custom event for example
    Thanks for the response Grot, i appreciate it, i added a do once node before the sound and it still just keeps playing lots of instances of the same sound instead of just one. Ive added a screenshot maybe you can see what ive done wrong?

    Click image for larger version

Name:	doonce.jpg
Views:	1
Size:	249.2 KB
ID:	1132729

    Comment


      #3
      I'm gonna assume this is the sound your enemy NPC makes when it is aggroed. I'm guessing that you have a bunch of them getting aggroed at the same time? There a couple things you can do. first is, under attenuation settings, choose a setting, preferably an attrnuation that you custom tailored yourself. this makes the sound louder when the npc is close and soft when it is far, when customized properly. Secondly, you might want to add a random delay (plug in a random float in range into the delay pin) before the npc is aggroed, so that the sound doesn't all come at the same time. you'll probably add that before your show state hostile function. you might also want to put in another random float in range into the Pitch pin of the play sound node, for variation(i usually have it between .9-1.2).

      if you only want 1 npc to make a sound, you can probably slip in a custom event somewhere that tells all the other npcs to shut up.

      also, you might want to show the rest of your blueprint because what you showed us is just a function. there's probably something in the event graph that is causing it to loop.
      Last edited by travisc; 08-21-2017, 08:19 PM.

      Comment


        #4
        If any of the previous suggestions don't work, the reason for this might be that the sound file is set to looping.

        Open up the sound file and in the details panel there will be a looping option.

        Comment

        Working...
        X