BullyBoii 10 Posted April 21, 2013 Hi guys, here is a simple code to create ambient sounds on a loop put this into init line _null = [["an array of radio sounds"], (time interval), (number of tracks), (object/source name)] execVM ".....\fn_ambientRadio.sqf"; Here is the code _radioSound = [color="#0000FF"]_this[/color] [color="#B22222"][color="#B22222"]select[/color][/color] 0; [color="#008000"]//(type array) name of of radio sounds[/color] _interval = [color="#0000FF"]_this[/color] [color="#B22222"]select[/color] 1; [color="#008000"]//(type number) the interval between when sounds are played[/color] _number = [color="#0000FF"]_this[/color] [color="#B22222"]select[/color] 2; [color="#008000"]//(type number) number of tracks used[/color] _sourceunit = [color="#0000FF"]_this[/color] [color="#B22222"]select[/color] 3; [color="#008000"]//(type object) name of the source unit[/color] _replay = [color="#0000FF"]_this[/color] [color="#B22222"]select [/color]4; [color="#008000"]//(type number) number of replays (optional)[/color] [color="#0000FF"]if[/color] (count _this > 1) [color="#0000FF"]then[/color] {_interval = _interval} else {_interval == 20}; [color="#008000"]//default interval is 20 seconds[/color] [color="#0000FF"]if[/color] (count _this > 4) [color="#0000FF"]then[/color] {_replay = _replay} [color="#0000FF"]else[/color] {_replay == -1}; [color="#0000FF"]while[/color] {1>=1} [color="#0000FF"]do[/color] { _i = 0; _replay = _replay; { //plays sound with interval _sourceUnit [color="#B22222"]say3d [/color]_x; [color="#B22222"]sleep[/color] _interval; _i = _i + 1; } [color="#0000FF"]forEach[/color] _radioSound; _replay = _replay - 1; [color="#B22222"]waitUntil [/color]{_i = _i + 1; _i >= _number}; [color="#0000FF"]if [/color](_replay == 0) [color="#B22222"]exitWith [/color]{}; }; DOWNLOAD link: https://www.dropbox.com/s/l7d1cst3fdxn8nw/fn_ambientRadio.sqf hope this is helpful Share this post Link to post Share on other sites
killzone_kid 1329 Posted April 21, 2013 while {1>=1} do... So I guess it won't work is 1<1? Share this post Link to post Share on other sites
BullyBoii 10 Posted April 22, 2013 its just to make sure the loop continues. just standard notation. and i dont think it would seeing as 1 is not greater than 1, it is equal to it therefore >= or <= will give a positive result Share this post Link to post Share on other sites