How can I have the order of 3 tracks be random every time throughout changing scenes?

jckmcgrawjckmcgraw Member Posts: 647
Hello,

I have 3 music tracks that I want to play throughout the course of somebody playing my game. There are many levels, which means many scene changes. The tracks are relatively long (1-5 minutes), which is why I want them in a random order every time. Is there a way I can do this?

Additionally, if I have a track looped, and I play a different track, will it stop the previous looping? Or is there a way I can stop it looping?

Thanks,
Jack McGraw

Best Answers

  • SAZ_1SAZ_1 Posts: 397
    Accepted Answer
    if its looping it will keep looping... basically make a integer rule (call it track or whatever) and then when a scene change is triggered tell do change attribute to (track+1)%3 (%3 will let it only select 3 numbers in this case either 0,1 or 2) .. at that point make 3 rules if track =1 play track1, if track=2 play track 2 .. so on.. now if you want it to change every time a scene change occurs to make things easier have these rules in one actor and place the actor in every scene that needs the music.... that should work fine i think. hope it helps!
  • BSideGamesBSideGames Posts: 392
    Accepted Answer
    very tricky... you would need to have a set of rules that know which track is playing and how many seconds long that track is then after that x amount of seconds it would need pick from the random track attribute again. If you wanted to not repeat a track the rules would need to be a bit more complex but still doable.

    I hope that helps

Answers

  • jckmcgrawjckmcgraw Member Posts: 647
    @saz_1 That isn't quite what I was going for... The tracks are pretty long, so if I was changing them randomly every scene, you would never here the full thing. I was thinking changing it randomly after it finishes a track regardless of what scene. This may be an impossible task, but it's worth a try. Thanks so much for the quick response!

    Jack McGraw
  • SAZ_1SAZ_1 Member Posts: 397
    oh cool... nah its not impossible basically in that same actor you need an additional rules to check the tracks are playing and not start until that loop is finished.. its a bit long to explain but its definately do-able
  • jckmcgrawjckmcgraw Member Posts: 647
    edited April 2012
    @bsidegames @saz_1 Ok. I'll just skip this idea. My game is already fairly loaded (not lagging but close).
Sign In or Register to comment.