Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started 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?
-
you can have a hashtable filled with audio clips. the key names are strings
-
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?
-
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-
-
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
-
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...
-
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.
-
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...
-
If you are using sounds extensively, i would recommend this asset: https://www.assetstore.unity3d.com/en/#!/content/5607
It's really a saver.
-
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
-
Thats a good idea Heath- I can add that function to the action- will post again when I've updated it-
-
If you store a variable in the "index" the sounds won't ever repeat- the action is attached
-
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
-
This seems to be working perfectly, thank you so much mdot!
-
No prob :) If you have ideas for stuff to add on my other actions just let me know.