Sound in sync with animation

I’m trying to figure out how to get a sound to only play once per animation cycle. Did that make sense? Okay, if I press space 3 times, very quickly, the sound plays three times, but the animation only has time to play once.

Is the only solution to make the sound as long as the animation?

Use for “Action actuator”
:

cont = GameLogic.getCurrentController()
own=cont.getOwner()
run = cont.getActuator(“act”) # this action actuator
run.getFrame()
##for make :
#print run.getFrame()
#own.Frame = str(run.getFrame())
#if own.Frame == 3:

GameLogic.addActiveActuator(cont.getActuator(“act1”),1) # this sound actuator

Could you make a demo Pacman?

Yeah, I’m still a bit confused… how do I get my sound into that script?
Sorry for being a bit slow, but I’m hopeless at anything that involves Python. I really should try to learn some basic Python so I’m not completely lost.

GameLogic.addActiveActuator(cont.getActuator("act1 "),1)

Your sound actuator is activated by the script. The actuator is where you deal with the sound.

Oh yeah… right… sorry.

I’m not sure this is the most straight forward simplest way of fixing your problem.
However, if you don’t know python you get what you can.

I don’t have time right now, but if someone else doesn’t help you first I’ll give you my solution.

Here is an easy way to do this without python. It’s a little more expensive resource wise, but since you don’t know python it should be easier to understand and control.

http://www.sharebigfile.com/file/81544/sound-control1-blend.html

Hey, thanks. That’s better now - I just need to get the timing right. :rolleyes:
There’s on thing I don’t understand (still) though, the ‘min’ and ‘max’ values. Sorry for my lack of understanding, but I’m used to simple renders - not many technical things to play around with for that.

EDIT: Yes! It’s peeerfect now. Thanks for that noob-friendly solution!

The min value is all that is important. Basically what I did is set a property value and told the computer that if the value of of that property isn’t more then a set number then don’t trigger the action. I set the property by default to be high enough to trigger the first time. After that every time that the action is triggered is sets the property back below the necessary level. The max value has to be set so I set it to be a high enough number that hopefully it won’t be exceeded. You could set it to 1,000,000 if you want to be even safer, because if the max number is ever reached your sound won’t trigger from then on.

Anyways, I’m glad to be of help.
Have fun!