Scripts / Music Script Problems

Author
Message
Skyye13
User Banned
Posted: 12th Feb 2016 23:08
Hey guys!
I've been working on a new script, based on the script from one of the twitch streaming videos the developers posted, and somehow I broke it XD

What I'm trying to do is have a series of audio zones. they're custom musicplaytrack1-2 scripts, and I'm not sure they're the best for the job.

Basically what I want is to have a couple small sound zones or trigger zones, where there is one track in music.lua which plays as the standard soundtrack piece. When the player enters a sound zone with the script, the music transitions to a different track, and stops playing the original. When the player leaves the sound zone, the track transitions back to the default track, and the second track stops.

I'd like to have a couple of these available, so I can use different music for different parts of the game. The problem is, the script is broken and gives me an error (probably because I meddled with it), and I'm not sure its the right way to go- this game will have multiple levels, each with its own base soundtrack piece and different sets of sound zone tracks. That would make music.lua useless, since the script only allows for a total of 4 music tracks in an entire game, and it doesn't loop them.

What is the best system for the use of a variety of music tracks in different locations and zones of a game? Could you help me come up with a proper script that would solve my problem? Thanks!

Here is the script I set up (and broke):
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 13th Feb 2016 01:37
if i understand correctly i think this is what you want to achieve, set the main track to a sound zone and place it under the start marker
then place the other sound zones around the map and when the player is inside them it will play the new sound but when he leaves the original track will play again

musicplaytrack3custom.lua
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Skyye13
User Banned
Posted: 13th Feb 2016 20:27
Hey thanks for the script!

I tried the script, and unfortunately it doesn't automatically stop the sound when you leave the zone. Could you modify it so it fades out when you leave the zone?

Thanks again!
grinseengel
8
Years of Service
User Offline
Joined: 27th Jul 2015
Location:
Posted: 17th Feb 2016 08:39
Hello smallg ,

many thanks for your script . I have also in my game in use . Now I have a question . I would like to , you want to play the music a little quieter . I tried it with music_set_volume ( current_zone , 20 ) . This does not work . Can you help me?
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th Feb 2016 19:25
@skyye13 try adding a non-static object turned always active = yes with the script applied (dont assign any sound as it will not play from that object but should make sure the script is always checking) as i think it's because your zones are too big and far apart so the script is getting switched off by the engine.
and fading sound is currently too confusing to do i'm afraid as the volume is linked specifically to the last sound played, maybe someone else can have a go at that and keep the switching from multiple zones

@grinseengel
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
grinseengel
8
Years of Service
User Offline
Joined: 27th Jul 2015
Location:
Posted: 18th Feb 2016 08:43
You are the greatest. I thought music_set_vol would right here.

Login to post a reply

Server time is: 2024-05-03 07:42:51
Your offset time is: 2024-05-03 07:42:51