Music changes when entering sectors back and forth...

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Music changes when entering sectors back and forth...

Postby Hidden Hands » Mon Jun 07, 2021 7:10 pm

I'm having trouble getting this to work.

I need the music to change after you enter a certain area in my map. But I need it to change back when returning to the previous area.

Can someone help me with this please? How do I use an ACS script to pull this off well? I tried a long time ago but failed after placing the little megaphones around the map.

Please help! Thanks in advance!
User avatar
Hidden Hands
Cherub
 
Joined: 20 Sep 2016
Location: London, England
Discord: VGCtm
Operating System: Windows Vista/7/2008 32-bit

Re: Music changes when entering sectors back and forth...

Postby Jarewill » Tue Jun 08, 2021 12:02 am

You can use SetMusic in ACS to change it:
Code: Select allExpand view
Script 1 (void)
{
    SetMusic("MUSIC"); //Replace with the music's file name.

Then you can call this script from your line.
You could probably make all music changing lines use 1 script like this:
Spoiler:
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Music changes when entering sectors back and forth...

Postby Kappes Buur » Tue Jun 08, 2021 2:18 am

SetMusic as Jarewill mentioned.
To activate the music, you could use either directly Actor enters sector (9998) or through a script Lineside.
User avatar
Kappes Buur
 
 
 
Joined: 17 Jul 2003
Location: British Columbia, Canada

Re: Music changes when entering sectors back and forth...

Postby Gez » Tue Jun 08, 2021 2:56 am

You can also use MUSINFO and music changers. The main advantage is that they have a built-in timer so if you move back and forth at boundary line, you don't get the music resetting constantly -- the change only happens once you've stayed in the "new music area" for a few seconds.
Gez
 
 
 
Joined: 06 Jul 2007

Re: Music changes when entering sectors back and forth...

Postby Hidden Hands » Tue Jun 08, 2021 6:33 am

Great thanks! I didnt know there were so many ways. Is there a preferred way or a way to make the music "fade" in and out rather than just straight up stop and start?
User avatar
Hidden Hands
Cherub
 
Joined: 20 Sep 2016
Location: London, England
Discord: VGCtm
Operating System: Windows Vista/7/2008 32-bit


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests