Jump to content

StreamMusic question


Recommended Posts

Hi guys.

 

I'm trying to make a soundtrack play when enter a certain interior or exterior cell. Just getting the soundtrack to play when I intend to is the hard part. I can set the cell to public or dungeon, put a soundtrack in the public or dungeon folder and it will play on random occasions which isn't what I want because it might not fit well with another cell.

 

I've been doing a bit of searching but there's not any good documentation or articles on this StreamMusic.

As I understand at the moment, a script has to contain: StreamMusic "the location of the soundtrack"

 

OK, so what I've done is in the CS, edit "trigZoneANY01" give it a new ID, create a new form, ok. Open the new one up, where it says script, I selected none then clicked on the grey box next to it. In here I typed:

 

SCN StreamMusicScript

 

begin

 

StreamMusic "Location of the file"

 

end

 

That, didn't work.

 

So what is it I'm doing wrong? Is it the script? The triggerzone? I've tried various locations for the filepath. I'm not using any of the music extender mods or whatever, But I am using OBSE. That shouldn't be the problem right?

 

Cheers in advance.

Edited by KingGsterUK
Link to comment
Share on other sites

When you create a new script, it doesn't automatically attach itself to the object. You have to go through the drop down menu and select it. Also, I'm not sure if you just didn't paste it in or you didn't have it in your script, but your "Begin" is missing a block type. Since this is a trigger zone, you want to use "Begin OnTrigger Player".

 

I've never used the stream music command, so I don't know how it works. Since there aren't any conditions in your script, it will keep running as long as you are in the trigger zone. So I'm not sure if StreamMusic is supposed to be run every frame or not.

Link to comment
Share on other sites

When you create a new script, it doesn't automatically attach itself to the object. You have to go through the drop down menu and select it. Also, I'm not sure if you just didn't paste it in or you didn't have it in your script, but your "Begin" is missing a block type. Since this is a trigger zone, you want to use "Begin OnTrigger Player".

 

I've never used the stream music command, so I don't know how it works. Since there aren't any conditions in your script, it will keep running as long as you are in the trigger zone. So I'm not sure if StreamMusic is supposed to be run every frame or not.

 

I'm with you. I changed it to begin OnTrigger Player, tried it didn't work BUT I went back into it and removed the StreamMusic "filename" and replaced it with a player.placeatme command. When I went into the zone like a thousand dremora spawned and continued to spawn so If thats happening with the StreamMusic it will just keep starting to play it but you won't hear anything because it doesn't get chance to actually play something.

Link to comment
Share on other sites

Then I guess what you need to do is make sure that the StreamMusic command only runs once. So change your script to something like this:

 

scn examplescript

short triggered
short inzone

Begin OnTriggerPlayer

if (triggered == 0)
	set triggered to 1
	StreamMusic "filepath"
endif

set inzone to 1

End

Begin GameMode

if (inzone == 1)
	set inzone to 0
else
	set triggered to 0
endif

End

Link to comment
Share on other sites

Hmmm. I've tried that, it needs a space between ontriggerplayer, it stops the original music and starts it again, or another random one.

 

I've downloaded the plugin for obse EMC (Enhanced Music and Controls) searched for example scripts but I just can't seem to get anything working.

 

What I'm aiming to do in this mod is set an atmosphere by having specific tracks play in 1) certain interior cells and 2) certain exterior cells that I've made/modified. I'm just really struggling to implement this into game by StreamMusic or EMC. I'm pretty sure I need a working script but I'm not sure what to use it with. At the minute I'm trying to use a triggerzone but is that right? What about a door, an item, an NPC, I mean you can put scripts on them can't you. What's the difference?

Link to comment
Share on other sites

It's probably best to use a quest script; it'll run no matter where you are. It can check which cell you're in and then start playing the music.

 

But the problem is that the StreamMusic command isn't working. The script I gave you should run the StreamMusic command once for each time you enter the trigger zone. So since you said it only stops the original music and then start it again, there's a problem here.

 

Since neither this script nor the script you first used worked, the only thing I can think of is that the file path you're using is wrong. From looking at the examples on the CS Wiki:

 

If your file was named "example.mp3" and inside the Oblivion\Data\Music folder, you would use

 

StreamMusic "example.mp3"

 

If your file was named "example.mp3" and inside subfolder "SubFolder" of the Oblivion\Data\Music folder, you would use

 

StreamMusic "SubFolder\example.mp3"

 

Or a way that works no matter which folder it's in (eg C:\WINDOWS\Media\tada.wav)

 

StreamMusic "C:\WINDOWS\Media\tada.wav"

Link to comment
Share on other sites

I can't believe I missed this thread!

 

 

 

Can i add music to room what i created in TES.

 

First put a MP3 into the music folder, and an activator in the cell with a script

 

if you want the song to repeat, use a timer to reset.

begin music_script

float timer
short playonce

if ( playonce == 0 )
 streammusic "your mp3 file.mp3"
 set playonce to 1
endif

if ( playonce == 1 )
 set timer to ( timer + getsecondspassed )
 if ( timer >= 120 ) ; 120 being the length of song in seconds
set playonce to 0
set timer to 0
 endif
endif

end

 

If you use a subfolder in the music folder use

streammusic "subfolder\musicfile.mp3"

 

i think you can also use midi files.

 

there are limitaions though, for one, the music will stream at full volume, and if you start fighting the battle music will override.

 

 

 

Even though this script wont work as it stands, I managed to get it working. So for anyone reading this having trouble getting your OWN music to trigger. This is how it's done! Assuming you dont have a mod like Better Music System because apparantly the StreamMusic command won't work.

 

 

First of all you need a cell. Create one in the CS. Right click on any cell in the cell window then edit. Right click again then new. I made an interior. Note what the music is set to, Default, Dungeon or Public. Choose either Dungeon or Public. Remember which one you chose!

 

Next you need a music file, I'm using an mp3 file (Length: 1:15, Audio: 64 Kbps, 44,100 Hz, 16 Bit, Mono, MP3)

 

Navigate to your \Program Files\Bethesda Softworks\Oblivion\Data\Music folder. Remember which one you chose. I chose Dungeon. So open that folder up. Right click and create a new folder, call it after your mod and put your mp3 in there. This step is paramount!

 

Now you need a trigger. Back in the CS, in the Object Window, locate World Objects and click on Activators. Find "TrigZoneANY01" double click it. Change the Editor ID to something unique with a prefix, Hit OK and create a new form. This will close the window.

 

In the object window search for your unique name and double click it.Where it says script, click on the SQAURE box with the full stops in.

 

Go to file, new and copy/paste this in there:

 

 


SCN ***YourUniqueScriptNameWithoutSpaces***

begin OnTrigger

float timer
short playonce

if ( playonce == 0 )
 streammusic "Data\Music\Dungeon\***YourModsName\FileName.mp3***"
 set playonce to 1
endif

if ( playonce == 1 )
 set timer to ( timer + getsecondspassed )
 if ( timer >= ***75*** )
       set playonce to 0
       set timer to 0
 endif
endif

end

 

 

All you have to do is change the bits inbetween the asterisk's - these ***. Make sure to remove these *** as well. Make sure you don't delete the Data\Music\Dungeon out of your filepath! click on the red arrow in the toolbar to save and confirm, you shouldn't get any errors, hit OK and save your new esp. It works 100% on standard oblivion.

 

Credit to Kevin Woodman.

Link to comment
Share on other sites

  • 1 year later...

I was having the same issue although i've gotten the song to play in the cell following the above script, although whenever I leave the cell the track is still playing. How can I stop the track from playing when I leave the cell? I followed the post above using a trigzone etc, cheers guys

Link to comment
Share on other sites

  • 3 years later...

I know this is old but just wanted to say thanks for this :) Worked like a charm. For the above poster wondering about the track still playing when you exit the cell, for me the track finished it's current timer and then the default music for Oblivion resumed. It was just a few seconds for me so I'm okay with that.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...