Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: swc220 on August 19, 2014, 12:54:43 PM

Title: Machine gun sounds when firing.
Post by: swc220 on August 19, 2014, 12:54:43 PM
I have a character with an automatic rifle and wanted to enable some audio while he is shooting his gun. How could I enable the audio only when he is firing?
Title: Re: Machine gun sounds when firing.
Post by: Lane on August 19, 2014, 04:00:48 PM
In the same state you're creating the projectile tell it to create the sound.
Title: Re: Machine gun sounds when firing.
Post by: swc220 on August 19, 2014, 05:08:09 PM
Right, but when I do that it plays the entire audio clip. Don't I need to set it up in some way so that the audio is disabled when the gun isn't firing. For example, for the muzzle flash, it is in two states. One is in the NotShooting state (in a Set Property) and has enable emission as the property but the check box is unchecked. In the shooting state the check box is checked so that it only goes off while the gun is firing. I want to do something similiar with the sound.
Title: Re: Machine gun sounds when firing.
Post by: Sly on August 19, 2014, 05:11:02 PM
It could be easier to have a single shot sound played every time a bullet is shoot, no?
Title: Re: Machine gun sounds when firing.
Post by: swc220 on August 19, 2014, 05:11:43 PM
That's a good point...
Title: Re: Machine gun sounds when firing.
Post by: swc220 on August 19, 2014, 05:24:05 PM
I'm actually getting this weird sound now like the audio clip is playing way too fast...
Is there something I could use to tell the audio to wait .1 seconds until it's allowed to play again?
Title: Re: Machine gun sounds when firing.
Post by: Gav (HeyBud) on August 19, 2014, 05:38:15 PM
Try using the Wait action at the end of the state before you loop back to play again. set it to .1

Edit: Maybe another option would be to set your machine gun audio clip in the inspector and use (get button down, or whatever you're doing to trigger it) Audio Play. Then (get button up) use the action Audio Stop.
Title: Re: Machine gun sounds when firing.
Post by: swc220 on August 19, 2014, 05:54:38 PM
The wait action did it! thank you!