Looping Music of Mournhold

Post » Tue Dec 29, 2009 10:27 am

Hello.
I need some help with a small project of mine. I want to make one song loop the whole time that I'm in Mournhold. No other song should play. The song that I want to loop in Mournhold is my "Data Files\Music\Daggerfall\sunnyday.mp3" song. Does anyone know how I might do this? Thanks.
User avatar
rolanda h
 
Posts: 3314
Joined: Tue Mar 27, 2007 9:09 pm

Post » Tue Dec 29, 2009 6:48 am

While you cannot loop music conventionally, you can play it every time it ends. It cannot be detected from script when a song has ended, so you need to use a timer instead.

Now the timer in Morrowind is not precise enough to be able to predict when exactly X minutes and Y seconds have passed, so you'll need to add a few seconds of silence to the end of your music file. 10 seconds or so should suffice.

Then you'll need to run a global script in Mournhold, something like this:

Begin somescriptfloat timerif ( GetPCCell, "Mournhold" == 0 )	StreamMusic, "Daggerfall\silent.mp3" ;this should point to another mp3 file with just a second of silence to stop the music playing	StopScript, "somescript" ;edit this to script name	Returnendifif ( timer > 0 )	set timer to ( timer - GetSecondsPassed )	ReturnendifStreamMusic, "Daggerfall\sunnyday.mp3"set timer to 200 ;edit number to music file's length in seconds, the silence part excluded (or even better if you calculate half the length of the silence in there)End


Then you'll need another script that runs locally on a hidden object (for example an activator) placed in cells that are entrance areas to Mournhold, e.g. the Plaza BD and the Royal Palace reception area:

Begin someotherscriptif ( ScriptRunning, "somescript" == 0 ) ;edit this to the name of the other script	StartScript, "somescript" ;this tooendifEnd

User avatar
Sami Blackburn
 
Posts: 3306
Joined: Tue Jun 20, 2006 7:56 am

Post » Tue Dec 29, 2009 3:51 pm

Would the first script work? Because Mournhold is made up of 5 interior cells, not just one cell called "Mournhold"
User avatar
MARLON JOHNSON
 
Posts: 3377
Joined: Sun May 20, 2007 7:12 pm

Post » Tue Dec 29, 2009 4:18 pm

Would the first script work? Because Mournhold is made up of 5 interior cells, not just one cell called "Mournhold"


GetPCCell, "Mournhold" will return true for any cell that starts with the word Mournhold. Now I haven't checked this in the editor but if I remember correctly all areas in Mournhold start with Mournhold except maybe for the sewers and old Mournhold ruins, and the dwemer ruins. If you need those included, those will need to be checked for separately.
User avatar
Juanita Hernandez
 
Posts: 3269
Joined: Sat Jan 06, 2007 10:36 am

Post » Tue Dec 29, 2009 11:45 am

I just used those scripts and it all works. :biggrin:
Thanks heaps! Now I might do this with other cities or some special dungeons.
You deserve a big :thumbsup:
User avatar
Brian Newman
 
Posts: 3466
Joined: Tue Oct 16, 2007 3:36 pm

Post » Tue Dec 29, 2009 2:12 pm

No problem, I'm glad it worked. :)

There could be one thing I overlooked. You can travel to Mournhold not only through the entrance areas, but also through Recall and Intervention spells. So it might be a good idea to add one of those hidden activators that start the script up to each of the Mournhold exterior areas, not just Plaza BD and the Royal Palace.
User avatar
Richard
 
Posts: 3371
Joined: Sat Oct 13, 2007 2:50 pm

Post » Tue Dec 29, 2009 10:38 am

No problem, I'm glad it worked. :)

There could be one thing I overlooked. You can travel to Mournhold not only through the entrance areas, but also through Recall and Intervention spells. So it might be a good idea to add one of those hidden activators that start the script up to each of the Mournhold exterior areas, not just Plaza BD and the Royal Palace.

Yeah. I added them to Plaza BD, The Bazaar, Godsreach, Temple Courtyard, and Palace Courtyard. As well as the Palace Reception Area and the Basemants of the Palace and Temple (because they link to the sewers). I also put one in Almalexia's Chapel because you can teleport there after the Tribunal main quest.

Thanks again!
User avatar
roxxii lenaghan
 
Posts: 3388
Joined: Wed Jul 05, 2006 11:53 am


Return to III - Morrowind