Help with ambient sound on activator

Post » Tue Jan 01, 2013 4:41 am

Hello

Basically I have a new textured version of the vanilla hawk model that flys around and lands on the nest. Its a raven and I have made a couple sound (.wavs) to go along with it.
If I set the audio to loop in the 'sound desciptor' the sound in game is way to repetative. If not on loop, the sound will play once when I enter the cell.

Is there any way to make my object just play the sound randomly?

Thank you
User avatar
Dragonz Dancer
 
Posts: 3441
Joined: Sat Jun 24, 2006 11:01 am

Post » Tue Jan 01, 2013 4:36 am

Yes, but it will require the use of a script.

Scriptname RavenRandomSound Extends ObjectReferenceImport UtilitySound Property RavenCaw AutoFloat Property fWaitMin = 7.0 AutoFloat Property fWaitMax = 18.0 AutoInt SoundInstanceEvent OnLoad()  Self.RegisterForSingleUpdate(RandomFloat(fWaitMin,fWaitMax))EndEventEvent OnUpdate()  If Self.Is3DLoaded() ; Prevent errors in the logfile	SoundInstance = RavenCaw.Play(Self)  EndIf  Self.RegisterForSingleUpdate(RandomFloat(fWaitMin,fWaitMax))EndEventEvent OnUnload()  Self.UnRegisterForUpdate()EndEvent

Create a new script attached to your activator called RavenRandomSound. Open it up, paste in the code above. Save it, which will also compile it, then close it. Now right-click the script and hit properties. For the RavenCaw sound, pick your desired sound effect. It will need to be a http://www.creationkit.com/Sound_Marker, not a http://www.creationkit.com/Sound_Descriptor. Change the fWaitMin and fWaitMax values to something else if my defaults don't suit you. Now save your mod and test it out!

Edit: Just noticed you said you had more than one sound to play. Modifying this script to play one of several different sounds at random should be a pretty good starter project for you!
User avatar
Queen
 
Posts: 3480
Joined: Fri Dec 29, 2006 1:00 pm


Return to V - Skyrim