Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: HeathClose on January 23, 2017, 01:24:16 PM

Title: Play Sound Workaround Questions...[SOLVED]
Post by: HeathClose on January 23, 2017, 01:24:16 PM
Play Sound action is broken and the research throughout the site confirms that is has been for a while... sounds play at a very low volume... the threads that pose a workaround say to use an audio source and to set the clip and enable it... this works... however..

I need to be able to play a random sound...

I was using set clip on an audio source component and then during a win scenario, enable the component and it would fire off the sound at an acceptable volume... but there is no way to set an audio clip from a string... I have the array set up with the names of all the clips I want to randomize and then realized audio clip variables can't be set from a string variable...

is there a way to achieve this?

If not, can someone cook this up for me?
Title: Re: Play Sound Workaround Questions...
Post by: terri on January 23, 2017, 02:02:49 PM
you can have a hashtable filled with audio clips. the key names are strings
Title: Re: Play Sound Workaround Questions...
Post by: HeathClose on January 23, 2017, 02:53:29 PM
you can have a hashtable filled with audio clips. the key names are strings

aahhhhhh.... thank you.... so I've been playing with it... I can pull from a list of audio clips... or I can pull from a list of strings... but I can't seem to set a variable in set audio clip that uses either... how could I go from a hash table of audio clips or a hash table of strings and stick it in an audio source?  Or is there a better way?
Title: Re: Play Sound Workaround Questions...
Post by: mdotstrange on January 23, 2017, 09:55:24 PM
I attached two actions that I made that might be useful- one plays a random sound from an array and also randomizes the pitch- and another that randomizes the pitch on a single sound-
Title: Re: Play Sound Workaround Questions...
Post by: terri on January 24, 2017, 04:50:06 AM
mdotstrange's actions will be easier now, but you can have an object variable that fits anything, in this case set it to audio clip
Title: Re: Play Sound Workaround Questions...
Post by: HeathClose on January 24, 2017, 10:19:19 AM
mdotstrange's actions will be easier now, but you can have an object variable that fits anything, in this case set it to audio clip

Thank you for your help!

I attached two actions that I made that might be useful- one plays a random sound from an array and also randomizes the pitch- and another that randomizes the pitch on a single sound-

Mdot!!  Thank you man... that is EXACTLY what I needed... looks like you've been diving into coding?  Thanks again...
Title: Re: Play Sound Workaround Questions...
Post by: mdotstrange on January 24, 2017, 11:31:51 AM
No problem Heath  :)

I've really come to love coding even though I'm just a beginner- I've made a ton of Playmaker actions recently- I'll put them online/organize/share them soon as I'm sure some of them would be useful to others.

Title: Re: Play Sound Workaround Questions...
Post by: HeathClose on February 11, 2017, 10:02:21 PM
No problem Heath  :)

I've really come to love coding even though I'm just a beginner- I've made a ton of Playmaker actions recently- I'll put them online/organize/share them soon as I'm sure some of them would be useful to others.
so I've been using the hell out of this... and just came up to a situation where I wish I could store the last audio clip it pulled from the array, so that there was a compare that could happen and choose a different one if it was about to repeat the last one..

for instance... i have a little guy who says things from about 6 audio clips.. and sometimes out sheer randomness he might repeat one of them like 3 times in a row...
Title: Re: Play Sound Workaround Questions...
Post by: Fat Pug Studio on February 12, 2017, 07:13:12 AM
If you are using sounds extensively, i would recommend this asset: https://www.assetstore.unity3d.com/en/#!/content/5607

It's really a saver.
Title: Re: Play Sound Workaround Questions...
Post by: terri on February 12, 2017, 08:05:05 AM
If you are using sounds extensively, i would recommend this asset: https://www.assetstore.unity3d.com/en/#!/content/5607

It's really a saver.

agreed
Title: Re: Play Sound Workaround Questions...
Post by: mdotstrange on February 12, 2017, 09:19:06 AM
Thats a good idea Heath- I can add that function to the action- will post again when I've updated it-
Title: Re: Play Sound Workaround Questions...
Post by: mdotstrange on February 12, 2017, 06:40:14 PM
If you store a variable in the "index" the sounds won't ever repeat- the action is attached
Title: Re: Play Sound Workaround Questions...
Post by: HeathClose on February 12, 2017, 07:41:21 PM
If you store a variable in the "index" the sounds won't ever repeat- the action is attached

this is fantastic, thank you so much, I'll give it a go
Title: Re: Play Sound Workaround Questions...
Post by: HeathClose on February 12, 2017, 08:09:17 PM
This seems to be working perfectly, thank you so much mdot!
Title: Re: Play Sound Workaround Questions...
Post by: mdotstrange on February 12, 2017, 08:29:53 PM
No prob  :) If you have ideas for stuff to add on my other actions just let me know.