switch music trigger? -1 reply

Please wait...

Omegasigma

Mapper and concept artist

50 XP

16th March 2006

0 Uploads

1,484 Posts

0 Threads

#1 10 years ago

at a certain part in a level i want the music thats playing in a mp3 format loop to stop and a new set of music to start, is this possible? to end current looping music that plays form mp3s intro then the loop section, i want the same idea but for a different song to play in only one area once you get into the said area, and i know i could use speakers but that would mean using waves wouldn;t it? which would loop nicer, but would jack up file size




Omegasigma

Mapper and concept artist

50 XP

16th March 2006

0 Uploads

1,484 Posts

0 Threads

#2 10 years ago

i'll use wave format if i have to, tho i dont have a clue how to make speakers play in sync with each other




NAB622

EAT ME!

50 XP

8th October 2005

0 Uploads

6,921 Posts

0 Threads

#3 10 years ago

target_play_music is your friend. :)




Omegasigma

Mapper and concept artist

50 XP

16th March 2006

0 Uploads

1,484 Posts

0 Threads

#4 10 years ago

does that use a trigger with a target_speaker linked to it? ro does it it jsut change the music thats playing to a new song?




Guest

I didn't make it!

0 XP

 
#5 10 years ago

Well, the concept is debatable whether you can use trigger_multiple linked to play mp3s, but I believe they must not be stereo, and must have some other specific things. If you link a use function to multiple speakers, they will automatically be in sinc. The trigger_music function simply starts a globally playing song, but you can't turn it off, maybe not even change songs.

I don't know if that helps at all, I haven't played with sounds for a while, so I don't remember much.




Omegasigma

Mapper and concept artist

50 XP

16th March 2006

0 Uploads

1,484 Posts

0 Threads

#6 10 years ago

so the only option would be to have have target speakers sync'd i'm trying to have it change for a "boss" fight room so technicly it'd be like encounter in sp i think, i'm still going to play with it and i thought speakers could only use waves i'm not sure with jka




Guest

I didn't make it!

0 XP

 
#7 10 years ago

Yea, I don't know a lot about npc's and scripting, so you will have to experiment or find someone more experienced




Omegasigma

Mapper and concept artist

50 XP

16th March 2006

0 Uploads

1,484 Posts

0 Threads

#8 10 years ago

my other option would be to look at maps with muiltiple music instances




Guest

I didn't make it!

0 XP

 
#9 10 years ago

I taught myself a little scripting; trial and error stuff for a few of my maps. Try this, it may work, if it doesn't the principals are there so you can fiddle around until you get something that works.

1. Download Behaved. 2. Linking a trigger_always to a target_scriptrunner 3. Give the scriptrunner a 'script_targetname' key and value of: 'scriptrunner' 4. Write a script that looks a little like this, and link it to the scriptrunner (key: usescript value: scripts/mymap/music.ibi)

rem ( "Play music continuosly'" );

loop ( -1 ) { sound ( /*@CHANNELS*/ CHAN_AUTO, "music/mymap/music.mp3" ); }

5. Then create a trigger_once and link it to another target_scriptrunner 6. Write a script that looks a little like this, and link it to the new scriptrunner. (key: usescript value: scripts/mymap/newmusic.ibi)

rem ( "If player is in 'area' then play 'newmusic'" );

affect ( "scriptrunner", /*@AFFECT_TYPE*/ FLUSH ) { flush ( ); }

wait ( 100.000 );

loop ( -1 ) { sound ( /*@CHANNELS*/ CHAN_AUTO, "music/mymap/newmusic.mp3" ); }

This (in effect) should wipe the continous music command from the previous scriptrunner entity, stopping the music, and play the 'newmusic' instead. If I remember correctly the sound command (if not linked (affect'ed') to an entity, should play in the whole map at full volume. If you want an area sound, link it to an entity with a script_targetname. The volume can be increased by replicating the command.

By the way, I havn't tested this, so don't give me grief if it doesn't work... It's largely theoretical.

Also, try fiddling round with the if command to do something like what's below... It'd be a lot simpler.

rem ( "If player is in 'area' then play 'newmusic'" );

if ( $get( FLOAT, "SET_LOCATION") = triggerarea$ ) {

loop ( -1 ) { sound ( /*@CHANNELS*/ CHAN_AUTO, "music/mymap/newmusic.mp3" ); }

else ( ) {

loop ( -1 ) { sound ( /*@CHANNELS*/ CHAN_AUTO, "music/mymap/music.mp3" ); }

}

}

Good luck!