Page 1 of 1

Music Scripting in a Certain Cell...

PostPosted: Mon Aug 18, 2008 3:52 pm
by Westly
Okie-dokie, here's the skinny:

I have this interior cell and I only want the ambient sound activator that I have placed in the cell to play (not the explore/base music).  I have comsidered using the StreamMusic function, but I am not sure that I understand it as well as it seems buggy to be used (raising music volume or what not).   I have a blank.wav/mp3 that I considered streaming, but what would the script look like?   Where would I place the blank .wav/mp3 for streaming?  I considered making the music to be played only when an activator is used (and I have a script for that somewhere in my Alpha version of Leaves of Lorien, so I gotta dig that one out of the mire if I use it).

To paint a better picture of the cell, it is the interior of a Genie's lamp.  Inside the lamp the atmosphere is plush and colourful, with low warm lights for a sultry ambient feel.  Inside there are tow NPC's, Alkazar (a male Genie) and his wife Jazhara (who dances about the room).  The idea for the music is so that she has something to dance to other than the base Morrowind music, but rather, music that is fitting with the atmosphere of the interior and ethnic feel of the Genie's lamp.

Any ideas as to the best way to achieve this end  :unsure:  ?

Re: Music Scripting in a Certain Cell...

PostPosted: Mon Aug 18, 2008 4:03 pm
by Fliggerty
You are going to have to use StreamMusic despite the volume bug.  There's no other way to play it.

Use an mp3, and just put it in the music folder.  Then use a script like this:

Code: Select all
begin hc_music_script

float timer
short doonce

if ( doonce == 0 )
       StreamMusic, "devils dance floor.mp3"
       set doonce to 1
       set timer to 0
else
       set timer to ( timer + GetSecondsPassed )
       if ( timer >= 239 )
               set doonce to 0
       endif
endif

end


The song I am playing there is 239 seconds long, so it will restart every 239 seconds.  This is easily adaptable if you want to add other songs, or even make a random playlist.

Re: Music Scripting in a Certain Cell...

PostPosted: Mon Aug 18, 2008 4:21 pm
by Westly
Thanks, Fligg  :dancing-banana: !

Just to be clear, I can attach this to an activator in the cell and it will stream only in that cell?

Re: Music Scripting in a Certain Cell...

PostPosted: Mon Aug 18, 2008 5:03 pm
by Fliggerty
Well, it will keep streaming until the song is over.  If you want to make it stop, I would do it by starting a global script when the music is started.  This script will monitor for CellChanged (or a more reliable method might be to use GetPCCell to make sure it isn't the cell it should play in) and start one of the normal music tracks.

Re: Music Scripting in a Certain Cell...

PostPosted: Mon Aug 18, 2008 5:26 pm
by Westly
I will just be sure to mention in the README that the song will spill over into a new cell once started, but will stop at the end and not repeat unless one remains in the lamp cell :D.  Thank you so much for helping me once again, as visuals are nice, but additional ambience makes it even better ;).

Here are some screens of the cell in progress (though I still have a great deal of cluttering and the adding in display cases left to do):

Image
Image
Image


Again, thank you for your help (the ELSEWORLDS! Armoury is one step closer to completion now  :D )!

Re: Music Scripting in a Certain Cell...

PostPosted: Tue Aug 19, 2008 5:43 am
by Gnomey
It's Fliggerty! :lol: You did an excellent job on making that place look luxurious; you outdid my Khajiiti skooma den. :wink:

Re: Music Scripting in a Certain Cell...

PostPosted: Wed Aug 20, 2008 11:29 pm
by Skeli
Wow, quite impressive  :twothumbs:

Re: Music Scripting in a Certain Cell...

PostPosted: Thu Aug 21, 2008 2:11 am
by Dragon_Lance
Very nice

Re: Music Scripting in a Certain Cell...

PostPosted: Thu Aug 21, 2008 8:48 am
by Davada Jones
Fliggerty wrote:You are going to have to use StreamMusic despite the volume bug.  There's no other way to play it.

What about PlaySound? Sure, he'd have to convert the music file to WAV format and play a silent MP3 in the background (to stop two songs from playing at once), but couldn't he have the music attached to an activator, so that the player won't hear it when they're a certain distance past it? My Morrowind scripting's very rusty, but the Horror Mod has a silent mp3 script I'm sure Westly could "borrow".

Or better yet, does MWSE have a volume adjustment command? If it did, you could reduce the music volume down to nothing, and play the wav file without the need of looping a silent mp3 file.

Re: Music Scripting in a Certain Cell...

PostPosted: Thu Aug 21, 2008 9:16 am
by Fliggerty
I suppose that would work.  It's not something I've ever thought of.

I've been told that the next version of MWSE might have such a function.

Re: Music Scripting in a Certain Cell...

PostPosted: Thu Aug 21, 2008 9:18 am
by Davada Jones
I would so totally make a patch for Pegas Horse Ranch and all of MadMax's other mods! Totally!

Re: Music Scripting in a Certain Cell...

PostPosted: Thu Aug 21, 2008 9:21 am
by Davada Jones
Just thinking about that function makes me excited!

You could store the current volume value in a variable and play a song at the volume YOU want, and then put it back to what it was after the song's done playing!


I hope they make it! I really do!

Re: Music Scripting in a Certain Cell...

PostPosted: Thu Aug 21, 2008 9:35 am
by Fliggerty
I'll harass TP21 a bit once he gets to the function adding part. :D