Looping Music?

Post » Tue Jan 12, 2010 7:59 am

I am using this script:

Begin samplescriptif ( OnActivate == 1 )StreamMusic "folder/song.mp3"ActivateendifEnd 


to play a song when getting inside of a building. I have another script to play an explore when leaving the place. But is there any way to loop the song, when the area has been entered, until the building has been left? Thanks!
User avatar
naana
 
Posts: 3362
Joined: Fri Dec 08, 2006 2:00 pm

Post » Tue Jan 12, 2010 4:24 am

Hmm... Perhaps you could set the script so that it sets a global short to 0 before starting the music.
After the music starts it waits X number of seconds equal to the length of the song.
After that, it sets the global to 1.

Then if the global is set to 1, it sets the global back to 0.
Otherwise, if the global is set to 0, it plays the music, and starts the timer again.
Then set the exit door script to set the global to 1, then play the explore track, then end the music script.

This way the music script will start when you enter the door to the cell, then set it's global, reset itself after it plays, and then stop when you leave.
It will start again if you activate the door into the cell again.

In theory, this should work nicely. I certainly hope so, at least. ;)
User avatar
carly mcdonough
 
Posts: 3402
Joined: Fri Jul 28, 2006 3:23 am

Post » Tue Jan 12, 2010 7:40 am

search up the "better music system", see how its author replaced the normal soundtrack.
User avatar
Milad Hajipour
 
Posts: 3482
Joined: Tue May 29, 2007 3:01 am

Post » Tue Jan 12, 2010 2:43 am

Ok, Thank you! I will look into both. :)
User avatar
Doniesha World
 
Posts: 3437
Joined: Sun Jan 07, 2007 5:12 pm


Return to III - Morrowind