Scripts / Looping Random Music

Author
Message
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 20th Nov 2018 19:55
HI all.
I've been trying to get this to work and finding it nothing like as easy as it should be.

This works but also plays all of them overlaid at once
Trying to add conditions to this to get it to just play one at a time is proving an issue. Mainly because there does not seem to get a command to find if music is playing or not. The best I can get is a random track that plays endlessly, rather than randomly change each time the sound ends

If we could get a "GetSoundPlaying(e) command it would make this a doddle. I could probably get this working with global sound effects possibly, but it would be useful to be able to detect sound effects placed in the editor
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
smallg
Community Leader
18
Years of Service
Recently Online
Joined: 8th Dec 2005
Location:
Posted: 21st Nov 2018 09:22
Use the global sounds, they have access to if they're playing or not.
But yes that command only checks if the sound being called is not playing, not any others.

You might be able to do some trickery with playing silent duplicate sounds and variables if you really want to stay away from the global sounds.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 22nd Nov 2018 05:32
Yeah, seems like that is the way to go. In the end I might just have different music in different areas It's odd you can check loaded sounds, but can't check editor placed ones. Just thinking it might be a relevant new command to make the editor more relevant for sound related stuff.
I was considering just finding the length of each tune and using a timer but unless I go that route, not gonna bother for now.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.

Login to post a reply

Server time is: 2024-04-18 14:07:26
Your offset time is: 2024-04-18 14:07:26