Complex music changing

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
The NUtcracker
Posts: 843
Joined: Sun Jan 14, 2007 9:12 pm
Location: South Dakota
Contact:

Complex music changing

Post by The NUtcracker »

Just want to know: Is it possible to check what current song is playing in doom, then switch back to that song? The reason is in the wad, one of several songs could be playing when the player encounters a boss, then I want it to switch back to whatever song was playing when the boss battle ends.
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

Just have a variable in the script set to the name or assigned number of the song right before you change the song, then look at that variable when you change it back.
User avatar
The NUtcracker
Posts: 843
Joined: Sun Jan 14, 2007 9:12 pm
Location: South Dakota
Contact:

Post by The NUtcracker »

Agent ME wrote:Just have a variable in the script set to the name or assigned number of the song right before you change the song, then look at that variable when you change it back.
Thanks, but I'm also planning on using the script in a monster mod (boss monster seeing player changes music) and when it changes back, I want it to have the same effect. Is that possible?
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

Yeah - just call the script from the monster - you should also make the music changer part of a library.
User avatar
The NUtcracker
Posts: 843
Joined: Sun Jan 14, 2007 9:12 pm
Location: South Dakota
Contact:

Post by The NUtcracker »

Thanks for your advise.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Agent ME wrote:Yeah - just call the script from the monster - you should also make the music changer part of a library.
That works to change the music, but doesn't help the problem that you won't know what music to change it back to when it's done playing.

I have a similar problem with CTC. I want a certain effect to change the music that's playing for the duration of the effect, then restore the old music. However, as CTC is designed to be played on any map, I can't simply keep track of the music via ACS. There's currently no way to pause music either, so the only option is to control all the music from the script, overriding whatever the map would normally play. Obviously this is not an optimal solution.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Hm, sounds like adding an option to play a level's default music might be useful after all...


With the next version you will be able to restart a level's default music with 'changemusic("*", 0)'.
jobro
Posts: 206
Joined: Sat Dec 30, 2006 1:56 pm

Post by jobro »

I concour. But it isn't very hard to do the workaround. Here is a script by me that lets you play a randomly selected piece of music:
Spoiler:
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

And how does that help?
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Post by Nash »

Graf, that's a good idea you have there! Also, I'm just wondering, why isn't it possible to add any functions that play around with a music's position and volume? Is it difficult to do? I imagine FMOD allows all of this easily...
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Post by Zippy »

And while we're dreaming about music features, the ability to fade in and out would be very nice.

But... yeah, I'll take the default music thing. There's a spot or two I could use it.
jobro
Posts: 206
Joined: Sat Dec 30, 2006 1:56 pm

Post by jobro »

Graf Zahl wrote:And how does that help?
It lets you specify the song like

Code: Select all

setmusic(mus[1]);
instead of having to know each name of the music you want to change it to.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

jobro wrote:
Graf Zahl wrote:And how does that help?
It lets you specify the song like

Code: Select all

setmusic(mus[1]);
instead of having to know each name of the music you want to change it to.
The point is, it doesn't let you retreive the music of the map you're currently playing. And before you start talking about how you can just check what map number it is and play the appropriate music, start thinking along the lines of pwads with custom music. How in the world are you going to store the music lump in an array when the lump hasn't been created yet?
Graf Zahl wrote:With the next version you will be able to restart a level's default music with 'changemusic("*", 0)'.
Thank you! (I assume you meant [wiki]SetMusic[/wiki]. :))
User avatar
Apothem
Posts: 2070
Joined: Sat Nov 29, 2003 7:13 pm
Location: Performing open heart surgery on an ACS compiler.

Post by Apothem »

I'd like to see a function that would allow you to pause one song and play another, and when the other song is done, resume where the last song left off. Along side that, a fade in/out function would also be nice. ;)
User avatar
GeeDougg
Posts: 3651
Joined: Fri Jul 16, 2004 2:39 pm
Location: VanCity, British Colonies, Isolated Republic Of Canuckistan
Contact:

Post by GeeDougg »

I don't know if the Pause will ever be implemented (sounds like too much of a luxury feature as opposed to the necessities) but the fade-in/fade-out would be pretty useful. It could actually be used (along with some very hefty scripting probably) for mood-dependent ambient music a la No One Lives Forever 1 & 2. Should make some mods more fun, and it would also make for some interesting added replay value if it were made available optionally for Vanilla DooM and DooM 2....
Locked

Return to “Editing (Archive)”