SamGv 10 Posted August 20, 2009 I've searched the forums and can't seem to find what I need. I find plenty of scripts but not anything helpful. I am using custom music so in the ON ACT in a trigger I type "playsound "SONG1" and it works perfectly. Now how do I get it to loop, I need baby steps. I can get some of the really complex coding usually easily but easier ones like this always take me so long to figure out. Example: I found this in the search forums... </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #wakawaka //play music ~length of music goto "wakawaka" exit <span id='postcolor'> I have no idea where to start. My song name is SONG1 it's 1 minute 57 seconds long. Thanks in advance! Share this post Link to post Share on other sites
IndeedPete 1038 Posted August 20, 2009 Hm, i would make a small script with this in it: while {true} do { playsound "SONG1"; sleep 117; }; BTW isn't that annoying to hear the same song again and again through the whole mission? Share this post Link to post Share on other sites
SamGv 10 Posted August 20, 2009 (edited) Depends on the song. But I just need it to loop for about 3-4 minutes and it's a great song so I want to hear it till I get to another waypoint. Then I will make a silence waypoint... if that will work, I'll try your script! ***EDIT*** Alright I put your script in the ACT in the trigger but it crashes my game, it literally plays the same tune like 50 times at the same time and crashes ARMA 2. Basically what I need is someone to give/show me how to insert the correct code for a music loop. Though I am using this particular sound as music it's still in the sound folder. I love ARMA 2 and am completely hooked, I just want to learn how to do this. Edited August 20, 2009 by SamGv Share this post Link to post Share on other sites
IndeedPete 1038 Posted August 20, 2009 (edited) Uh, ok. You have to create a script file. Go to your mission folder in \My Documents\ArmA 2 Other Profiles\YourNick\missions\YourMission and create a text file there. Put the script i gave you in the text document and rename it to "music.sqf". And i would change the script if you want to hear the music only 3-4 minutes: while {music} do { playsound "SONG1"; sleep 117; }; Then place a trigger or write it in the waypoint: music = true; nul = [] execVM "music.sqf"; And then place in the waypoint where you want the music to stop: music = false Edit: "if (true) exitWith{};" removed. Edited August 20, 2009 by IndeedPete Share this post Link to post Share on other sites
Big Dawg KS 6 Posted August 20, 2009 while {music} do { playsound "SONG1"; sleep 117; }; if (true) exitWith{}; Get rid of this, it's unneeded and wrong anyway (exitWith should never be used to exit a script). Share this post Link to post Share on other sites
SamGv 10 Posted August 20, 2009 Works great, thanks a lot! Share this post Link to post Share on other sites
johnnyboy 3797 Posted August 21, 2009 This is a common need, so I created a function for this a while back. You can find it here: http://www.ofpec.com/ed_depot/index.php?action=details&id=592&game=ArmA Here's the description of it: JBOY_soundLoop is a simple function that will have an object say a sound repeatedly. This is useful for any object that you want to play a sound continously (say a radio playing a song loop, or a generator playing a generator noise, of flys buzzing around an outhouse, etc.).Here's a sample call: dmy=[toilet, "fxFlies4secs", 3.95 , 10000] execvm "JBOY_soundLoop.sqf"; The parameters passed in are: 1. Object that will say the sound. 2. Name of sound file. 3. Seconds to wait in loop (i.e. length of sound clip). 4. Number of times to iterate the loop. Share this post Link to post Share on other sites
pj[cz] 2 Posted August 21, 2009 Also its generally better to define your music as cfgMusic not cfgSound in description ext. As playing music is independent on other sounds and you can have persons talking during music which i think wouldnt work the way with cfgSound. This was a case in ofp/arma. If it is not the case in armaII im prepaired to stand corrected Share this post Link to post Share on other sites
fhreed 10 Posted September 4, 2009 Heya guyes, im trying to get a custom music file to play in the background, whatever i do it does not seem to find the file, i converted it to .ogg and placed it in the mission folder, i dont know what i shall do to make it work, any help wound be appriciated. Share this post Link to post Share on other sites
IndeedPete 1038 Posted September 4, 2009 You have to define the music in your description.ext first: class CfgMusic { tracks[]= {Track}; class Track { name = "Track"; sound[] = {\music\track.ogg, db+10, 1.0}; }; }; Now simply play the song with: playMusic "Track"; Share this post Link to post Share on other sites
psoutrage 0 Posted October 22, 2009 need some help ive tried everything here for arma 2 to get music or sound to work in my mission I defined it in the description.ext and in the init I put playsound "Sound" and everytime it saids file not found I have it in the mission\sound\ folder. Ive researched this problem over and over and i cant get it to work at all Share this post Link to post Share on other sites
Pappy60 10 Posted October 22, 2009 need some help ive tried everything here for arma 2 to get music or sound to work in my mission I defined it in the description.ext and in the init I put playsound "Sound" and everytime it saids file not found I have it in the mission\sound\ folder. Ive researched this problem over and over and i cant get it to work at all Well that should be easy enough, Arma2 is telling you it cannot find the file at the location you specified, recheck your file paths, you have a bad file path for the sound file. Share this post Link to post Share on other sites