Brute 11 Posted June 28, 2009 (edited) I am attempting to make a trigger loop music until it reaches another trigger, how would i go about doing this? Or loop the music for a specific amount of time and then fade out? Edited June 28, 2009 by Brute Share this post Link to post Share on other sites
sgt_hawkins 9 Posted July 29, 2009 Id like to know this too can someone help on this? Share this post Link to post Share on other sites
11_harley_11 0 Posted December 24, 2009 Would love to know this as well. Anybody? Share this post Link to post Share on other sites
rübe 127 Posted December 24, 2009 you guys may wanna take a look at my camera- & soundscript demo. It demonstrates how you can mix little loops in - more or less - perfect time. In this demo, the loops are skipped in synchronization to the camera-shots (though I round the shot-times to the musics rhythm), while the script arranges the loops (which all keep one main musical key) into a song, much like a _very_ basic music sequencer. But a single loop and thus a constant loop-time doesn't make things any more difficult, does it? :) In short, this involves (while, sleep, playMusic and fadeMusic): get your loop(s) together time them and put the information together with the sound-reference into an array, or whatever your idea is to organize this (depends propably on desired functionality) finally spawn/execVM a script with a while loop, play and sleep the loop's duration (try slightly less). You may wanna incorporate some mechanic to change loop's etc. This works pretty good - for single and longe loops anyway. Though there might be a more sophisticated way to time the clocks. Share this post Link to post Share on other sites
11_harley_11 0 Posted December 24, 2009 (edited) Thanks Ruebe, will check it out now. I'm very new to mission making so your demo may be way out of my league. But I will try it. What I'm trying to do is have 3 tracks/songs that loop and then occasionally trigger another track which takes their place for its duration and once finished the 3 tracks start looping again..and so on. So far I've got one track looping (not 3) and a triggered track that kicks in but for some reason doesn't play it's full length before the loop tracks kicks in again. Not sure why. Is that possible with your demo? If it is would you mind talking me through it? edit: That's awesome Ruebe. It didn't run too well on my machine lol! but I could see what it was doing. Very cool indeed! Edited December 24, 2009 by 11_HARLEY_11 Share this post Link to post Share on other sites
shuko 59 Posted December 24, 2009 play trigger onact: nul = [] spawn {playwhilethisistrue = true; while {playwhilethisistrue} do {say or playsound command here; sleep the length of the clip;};}; another trigger to stop it onAct: playwhilethisistrue = false Share this post Link to post Share on other sites
11_harley_11 0 Posted December 24, 2009 (edited) play trigger onact:nul = [] spawn {playwhilethisistrue = true; while {playwhilethisistrue} do {say or playsound command here; sleep the length of the clip;};}; another trigger to stop it onAct: playwhilethisistrue = false Thanks for the help shk! But I'm a total noob and I'm not sure what to do with it exactly. What I have currently is a trigger with this in the On Act music = true; nul = [] execVM "music.sqf"; And the music.sqf has this: while {music} do { playmusic "mysong1"; sleep 200; }; And the songs are defined in the description.ext mysong1 mysong2 and so on. I also have another trigger that interrupts the loop with playMusic "song4" in the On Act. How do I incorporate your code into what I have here to loop mysong 1,2 and 3 with a triggered interruption of mysong4 and then return to the loop. Do I still need the music.sqf? Can it be done with just triggers? Sorry to be a pain in the arse, I'll get my head around this stuff eventually. Edited December 24, 2009 by 11_HARLEY_11 Share this post Link to post Share on other sites
shuko 59 Posted December 24, 2009 (edited) nul = [] execVM "music.sqf"; track = 1; music = true; while {music} do { waituntil {track in [1,2,3]}; switch track do { case 1: {track = 2; playmusic "mysong1"; sleep 200}; case 2: {track = 3; playmusic "mysong2"; sleep 200}; case 3: {track = 1; playmusic "mysong3"; sleep 200}; }; }; nul = [] spawn { track = 4; playmusic "mysong4"; sleep 200; track = 1}; I have no idea if it works at all, but hopefully it gives you ideas. Edited December 24, 2009 by Shuko Share this post Link to post Share on other sites
11_harley_11 0 Posted December 24, 2009 (edited) I have no idea if it works at all, but hopefully it gives you ideas. Thanks again, it's fantastic! The three tracks loop perfectly and the fourth interrupts the way it should but the only thing that isn't happening is the loop doesn't return after the interruption. :confused: I guess I would run another trigger to set it in motion again? Edited December 24, 2009 by 11_HARLEY_11 Share this post Link to post Share on other sites
shuko 59 Posted December 24, 2009 Forgot to add the next track after 4th in the last trigger. Edited it above. track = 1, you can use 1, 2 or 3 Share this post Link to post Share on other sites
11_harley_11 0 Posted December 24, 2009 That's it shk, it works perfectly! You, my friend, deserve a seat on Santa's lap. Thank you very much for your help. Share this post Link to post Share on other sites