Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Play music in zone and fade out when leaving

Author
Message
Scurvy Lobster
18
Years of Service
User Offline
Joined: 3rd Mar 2006
Location: Denmark
Posted: 6th Oct 2009 23:19 Edited at: 6th Oct 2009 23:26
I just wanted to share my music script with fade out. Having spend some time trying to find one I modified some old ones from the forum and a stock FPSC script into the following:



It should be used with a standard Trigger Zone and the music is defined in Sound0 directly in the FPSC editor. It's a nice little script if you have a range of small music samples that you want to trigger at certain points. When the player leaves the Trigger Zone the music fades out over 1.5 seconds (which is easily modified with the timergreater=x value (meassured in milliseconds))

Be sure to make the Trigger Zone larger than just one cell by holding shift down and dragging it larger since the music will fade out as soon as the player leaves the zone.

In this version the script destroys itself at the end. It is optional to send it back to state=0 so that the Trigger Zone is activated every time the player enters.

Hope this is a help for someone

Running my latest game superbly on FPSC and Project Blue Mod.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 7th Oct 2009 00:54



Nice script! Here's my rendition that would work with Project Blue. Figured it might be helpful for you.


The one and only,


Kravenwolf
15
Years of Service
User Offline
Joined: 14th Apr 2009
Location: Silent Hill
Posted: 7th Oct 2009 00:56 Edited at: 7th Oct 2009 01:08
@Scurvy Lobster , just tried it out in Fenix Mod and it works exactly as it should. Very easy to set up, too. I'm already using it in my game. Thanks for this

EDIT: Small bug; it seems to stop my background music from playing throughout the rest of the game when the trigger zone is destroyed.


Kravenwolf

Scurvy Lobster
18
Years of Service
User Offline
Joined: 3rd Mar 2006
Location: Denmark
Posted: 7th Oct 2009 10:56
Plystire: I am already using it with PB so thanks for the script but it's really not needed

Kravenwolf: it's probably the music=0 that kills off the standard background music track. I am not sure how to get around this but if you find a fix I would like to know since I am planning something similar.

Running my latest game superbly on FPSC and Project Blue Mod.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 8th Oct 2009 03:23
Don't worry, I won't feel bad if you don't use it. I just think that the shorter script would also be smoother in the way it fades out (Since it will fade out by 1 volume increment all the way until it is completely mute). It's also easy to change to make it fade out faster or slower by changing how much the script subtracts from the variable.


The one and only,


Scurvy Lobster
18
Years of Service
User Offline
Joined: 3rd Mar 2006
Location: Denmark
Posted: 8th Oct 2009 11:20
Ok, I didn't realise your scripts full potential at first. It does sound quite neat after all

Running my latest game superbly on FPSC and Project Blue Mod.
Gunn3r
18
Years of Service
User Offline
Joined: 12th Jun 2006
Location: Portland, OR
Posted: 20th Oct 2009 22:53
First off, Plystire, thanks for the great script, and Scurvy, thanks for the original script. My question is, is it possible to fade in like you fade out? I've tried editing Ply's script to include an addvar, similar to the subvar that he currently has in, but it doesn't seem to work. Is it because the way that the sound0 works is an automatic play at full volume? If that's the case, is there a way to work around that?

Scurvy Lobster
18
Years of Service
User Offline
Joined: 3rd Mar 2006
Location: Denmark
Posted: 20th Oct 2009 23:00
I don't know about Plys script but for the original script you could do the opposite of the fade. At the moment it lowers volume as the time increases (fade) -> set it to start low instead and bring up the volume as time increases.

It should be possible to do within the same script but I don't know if you prefer Plystires edition of the script.

Gunn3r
18
Years of Service
User Offline
Joined: 12th Jun 2006
Location: Portland, OR
Posted: 20th Oct 2009 23:06 Edited at: 20th Oct 2009 23:27
I just tried Ply's so far. I'll edit yours and see if I can get it working. If I can, I'll post it here.

EDIT: So it fades in fine, now, but it now doesn't fade back out. This is what I've done so far:


Scurvy Lobster
18
Years of Service
User Offline
Joined: 3rd Mar 2006
Location: Denmark
Posted: 20th Oct 2009 23:41 Edited at: 20th Oct 2009 23:42
I think you are missing a state=10 (between state 9 and 11) so the script dies when the player leaves the trigger zone.

I'm also unsure how having two timerstarts affects the script.

Gunn3r
18
Years of Service
User Offline
Joined: 12th Jun 2006
Location: Portland, OR
Posted: 20th Oct 2009 23:50
Fixing state=10 fixed the entire script. It now fades in and out accordingly. Thanks for the help, Scurvy!

BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 21st Oct 2009 02:49
Thank you for the script. We were just going to look into this and here it was posted. It is very appreciated.

Cheers
Gunn3r
18
Years of Service
User Offline
Joined: 12th Jun 2006
Location: Portland, OR
Posted: 21st Oct 2009 03:29 Edited at: 21st Oct 2009 03:30


There is a working fade in/fade out script for music. Thanks for the help, Scurvy.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 21st Oct 2009 04:08



That should fade in and out just fine.


The one and only,


Gunn3r
18
Years of Service
User Offline
Joined: 12th Jun 2006
Location: Portland, OR
Posted: 21st Oct 2009 04:26
Ah. That's what I was missing. I tried making that script, but didn't add in a "varless=musicvol 100". Thanks for posting that up, Ply. I'm getting a little bit better at scripting, I guess.

Scurvy Lobster
18
Years of Service
User Offline
Joined: 3rd Mar 2006
Location: Denmark
Posted: 21st Oct 2009 08:45
Nice set of music scripts we have here now

Login to post a reply

Server time is: 2024-11-25 07:27:58
Your offset time is: 2024-11-25 07:27:58