...Get audio to fire off once and not continuously

Get help using Construct 2

Post » Sat Feb 01, 2014 8:43 pm

Hi there,

I've seen this happen too often.. I have an audio sound I want to fire off when a condition is met, but instead of it just playing once.. it fires it off over and over and over again creating a reverberation effect.

I've hacked around this in the past when I had maybe 1 sound to fire of at any given time, but now i'm dealing with a project that has a number of audio clips so I just thought I'd check with the community.

Do i have to set up some kind of global variable that i have to keep flipping to fool the play into playing only one time or is there some trick to how i use "play" to just allow it to fire off once without having to surround it with other logic?

Thanks!
Caleb
B
59
S
9
G
1
Posts: 942
Reputation: 6,553

Post » Sat Feb 01, 2014 8:50 pm

system trigger once while true?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Feb 01, 2014 9:05 pm

well i have to arrange things kinda weird sometimes to get it to work right..    sometimes i have to actually put the change condition back to false before it gets to the trigger audio.. sometimes that still doesn't seem to work..

How ever as I test more right now, it might be that i'm using parallels currently to run C2 which is usually fine.. maybe some lag and using windows xp.. sometimes things don't fire off tight when testing other events too so it could be that. part12studios2014-02-01 21:06:01
B
59
S
9
G
1
Posts: 942
Reputation: 6,553

Post » Sat Feb 01, 2014 10:36 pm

I've also found the audio playback inconsistent. Occasionally a trigger, which arguably should only fire once (like a collision) would fire a couple of times and cause me much frustration.

I've had best success using sub-event 'Trigger Once While True' as @LittleStain suggests, even though the parent event is a trigger and my understanding is that this should not be needed. That has seemed to work consistently well for me. I've also tried Audo Tag "whatever" NOT playing - however, because option 1 using trigger once seemed the best for me I have little experience with option 2...
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,228
Reputation: 44,888

Post » Sat Feb 01, 2014 10:48 pm

Trigger once while true should do the trick. If it doesn't then add a the condition If Sound isn't playing - play sound.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Mon Feb 03, 2014 12:15 pm

I just ran into this. I had sounds set to play at a certain frame of an animated sprite (using a variable). I was getting a reverb effect which was the sound playing twice in rapid succession.

The System - `trigger once while true` works perfectly. Thanks for sharing.
DaveSqueakydave2014-02-03 12:18:28
B
9
S
3
G
1
Posts: 23
Reputation: 828

Post » Tue Feb 04, 2014 2:10 pm

ah ok cool i see that system event, very cool. I managed to get it to work though without using this but next time I'll have to be sure to call on it. At this point I'm not sure what I did to get it right, just shuffled things around till it worked.. heh
B
59
S
9
G
1
Posts: 942
Reputation: 6,553


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, ignaciosimo, nickar and 44 guests