Midnighters 152 Posted April 27, 2017 7 minutes ago, Grumpy Old Man said: What distortion? How exactly would you use attachTo together with playSound3D? Never experienced any zipping around together with playSound3D, since the sound source from playSound3d will always have a static position. Cheers That's the whole point, as soon as you change the position -> sound distortion. attachTo would work together with playSound3D is you assigned the sound to a certain memory point or point I suppose. I've experienced sound distortion if it is moved at all at point in time. This may not be the case, I've always used attachTo for moving objects. Share this post Link to post Share on other sites
pliskin124 4 Posted April 27, 2017 Fight. Fight. Fight. Share this post Link to post Share on other sites
Midnighters 152 Posted April 27, 2017 2 minutes ago, pliskin124 said: Fight. Fight. Fight. No please no :( Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted April 27, 2017 5 minutes ago, Midnighters said: That's the whole point, as soon as you change the position -> sound distortion. attachTo would work together with playSound3D is you assigned the sound to a certain memory point or point I suppose. I've experienced sound distortion if it is moved at all at point in time. This may not be the case, I've always used attachTo for moving objects. playSound3d does not work like that. You can't attach it to anything, it only takes an objects position or a position and plays the sound there. Move the vehicle away, the sound will still play at that position. It also does not return anything. Read the wiki. 1 minute ago, Midnighters said: No please no :( Too late. Cheers Share this post Link to post Share on other sites
Midnighters 152 Posted April 27, 2017 2 minutes ago, Grumpy Old Man said: playSound3d does not work like that. You can't attach it to anything, it only takes an objects position or a position and plays the sound there. Move the vehicle away, the sound will still play at that position. It also does not return anything. Read the wiki. Too late. Cheers Ah what the fuck? I swear some sound command returned something. Too late? Game on? :| Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted April 27, 2017 Just now, Midnighters said: Ah what the fuck? I swear some sound command returned something. Too late? Game on? :| Lost in the first round, heh. I'd personally use say3d instead. You have to set up the sounds in description.ext but works a treat, is positional and you get the authentic doppler effect with it. Also makes the sound stop playing when the vehicle gets destroyed, which could be a problem using playSound3d. Cheers Share this post Link to post Share on other sites
Midnighters 152 Posted April 27, 2017 5 minutes ago, Grumpy Old Man said: Lost in the first round, heh. I'd personally use say3d instead. You have to set up the sounds in description.ext but works a treat, is positional and you get the authentic doppler effect with it. Also makes the sound stop playing when the vehicle gets destroyed, which could be a problem using playSound3d. Cheers When's round 2? I've got muscles on muscles, I ate nails for breakfast. I like say3D too. But eh, ROUND 2? Share this post Link to post Share on other sites
pliskin124 4 Posted April 27, 2017 Okay... This is what I ended up using. It's a bit of a work around, and it requires me to place the addaction on each vehicle via zeus as they're inherently spawned in after mission start, but it works for now. Since we're on the topic of say3d, I was wondering if using the if (!isServer) exitWith {}; is what makes it so the Say3d plays globally instead of just for one player? Also, is there anything I can do to this script to make it so songs play concurrently... i.e., if they start on song 1, it will play from song 1 to song 8 and then stop? The say3D distance also appears to be very long (almost 300 meters) is there a way to scale that down? Vehicle Init PlaySongs = this addaction ["Start music player","musicplayer.sqf",true,1,false,true,"","player in _target"]; Musicplayer.sqf //Musicplayer.sqf _vehicle = _this select 0; hintSilent "Music player switched on!"; sleep 2; hintsilent ""; sleep 2; playtrack1 = _vehicle addaction ["Track 1","music.sqf",1]; playtrack2 = _vehicle addaction ["Track 2","music.sqf",2]; playtrack3 = _vehicle addaction ["Track 3","music.sqf",3]; playtrack4 = _vehicle addaction ["Track 4","music.sqf",4]; playtrack5 = _vehicle addaction ["Track 5","music.sqf",5]; playtrack6 = _vehicle addaction ["Track 6","music.sqf",6]; playtrack7 = _vehicle addaction ["Track 7","music.sqf",7]; playtrack8 = _vehicle addaction ["Track 8","music.sqf",8]; playrandomsong = _vehicle addaction ["Play Random song","music.sqf",9]; closePlayer = _vehicle addaction ["Close Music player","music.sqf",10]; sleep 0.1; _vehicle removeaction PlaySongs; exit; Music.sqf //Music.sqf if (!isServer) exitWith {}; _vehicle = _this select 0; _playtracks = _this select 3; sleep 2; switch (_playtracks) do { case 1: //playing song 1 { soundsource1 = "Land_FMradio_F" createVehicle [0,0,0]; hideObject soundsource1; sleep 1; soundsource1 attachTo [_vehicle,[0,0,0]]; sleep 1; hint "playing song!....."; sleep 3; soundsource1 say3d "song1"; closesong1 = _vehicle addaction ["stop song 1","stopsong.sqf",1]; }; case 2: //playing song 2 { soundsource2 = "Land_FMradio_F" createVehicle [0,0,0]; hideObject soundsource2; sleep 1; soundsource2 attachTo [_vehicle,[0,0,0]]; sleep 1; hint "playing song!....."; sleep 3; soundsource2 say3d "song2"; closesong2 = _vehicle addaction ["stop song 2","stopsong.sqf",2]; }; case 3: //playing song 3 { soundsource3 = "Land_FMradio_F" createVehicle [0,0,0]; hideObject soundsource3; sleep 1; soundsource3 attachTo [_vehicle,[0,0,0]]; sleep 1; hint "playing song!....."; sleep 3; soundsource3 say3d "song3"; closesong3 = _vehicle addaction ["stop song 3","stopsong.sqf",3]; }; case 4: //playing song 4 { soundsource4 = "Land_FMradio_F" createVehicle [0,0,0]; hideObject soundsource4; sleep 1; soundsource4 attachTo [_vehicle,[0,0,0]]; sleep 1; hint "playing song!....."; sleep 3; soundsource4 say3d "song4"; closesong4 = _vehicle addaction ["stop song 4","stopsong.sqf",4]; }; case 5: //playing song 5 { soundsource5 = "Land_FMradio_F" createVehicle [0,0,0]; hideObject soundsource5; sleep 1; soundsource5 attachTo [_vehicle,[0,0,0]]; sleep 1; hint "playing song!....."; sleep 3; soundsource5 say3d "song5"; closesong5 = _vehicle addaction ["stop song 5","stopsong.sqf",5]; }; case 6: //playing song 6 { soundsource6 = "Land_FMradio_F" createVehicle [0,0,0]; hideObject soundsource6; sleep 1; soundsource6 attachTo [_vehicle,[0,0,0]]; sleep 1; hint "playing song!....."; sleep 3; soundsource6 say3d "song6"; closesong6 = _vehicle addaction ["stop song 6","stopsong.sqf",6]; }; case 7: //playing song 7 { soundsource7 = "Land_FMradio_F" createVehicle [0,0,0]; hideObject soundsource7; sleep 1; soundsource7 attachTo [_vehicle,[0,0,0]]; sleep 1; hint "playing song!....."; sleep 3; soundsource7 say3d "song7"; closesong7 = _vehicle addaction ["stop song 7","stopsong.sqf",7]; }; case 8: //playing song 8 { soundsource8 = "Land_FMradio_F" createVehicle [0,0,0]; hideObject soundsource7; sleep 1; soundsource8 attachTo [_vehicle,[0,0,0]]; sleep 1; hint "playing song!....."; sleep 3; soundsource8 say3d "song8"; closesong8 = _vehicle addaction ["stop song 8","stopsong.sqf",8]; }; case 9://playing random song. { soundsource9 = "Land_FMradio_F" createVehicle [0,0,0]; hideObject soundsource9; sleep 1; soundsource9 attachTo [_vehicle,[0,0,0]]; sleep 1; hint "playing any song!....."; sleep 3; _songs = ["song1","song2","song3","song4","song5","song6","song7","song8"]; soundsource9 say3d (_songs select floor(random(count _songs))); closerandomsong = _vehicle addaction ["stop random song","stopsong.sqf",9]; }; case 10: //closing music player { _vehicle removeaction playtrack1; _vehicle removeaction playtrack2; _vehicle removeaction playtrack3; _vehicle removeaction playtrack4; _vehicle removeaction playtrack5; _vehicle removeaction playtrack6; _vehicle removeaction playtrack7; _vehicle removeaction playtrack8; _vehicle removeaction playrandomsong; _vehicle removeaction closeplayer;hint "Music player switched off!"; PlaySongs = _vehicle addaction ["Start music player","musicplayer.sqf",true,1,false,true,"","player in _target"]; }; }; Stopsong.sqf //Stopsong.sqf _vehicle = _this select 0; _stopsongs = _this select 3; sleep 2; switch (_stopsongs) do { case 1: //stopping song 1. { hint "select other song!"; deletevehicle soundsource1; sleep 0.1; _vehicle removeaction closesong1; }; case 2://stopping song 2. { hint "select other song!"; deletevehicle soundsource2; sleep 0.1; _vehicle removeaction closesong2; }; case 3: //stopping song 3. { hint "select other song!"; deletevehicle soundsource3; sleep 0.1; _vehicle removeaction closesong3; }; case 4: //stopping song 4. { hint "select other song!"; deletevehicle soundsource4; sleep 0.1; _vehicle removeaction closesong4; }; case 5: //stopping song 5. { hint "select other song!"; deletevehicle soundsource5; sleep 0.1; _vehicle removeaction closesong5; }; case 6: //stopping song 6. { hint "select other song!"; deletevehicle soundsource6; sleep 0.1; _vehicle removeaction closesong6; }; case 7: //stopping song 7. { hint "select other song!"; deletevehicle soundsource7; sleep 0.1; _vehicle removeaction closesong7; }; case 8: //stopping song 8. { hint "select other song!"; deletevehicle soundsource8; sleep 0.1; _vehicle removeaction closesong8; }; case 9://closing random song. { hint "Random song stopped!...."; deletevehicle soundsource9; sleep 0.1; _vehicle removeaction closerandomsong; }; }; and of course defining the songs in the description.ext. Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted April 27, 2017 Try this, simplified your stuff a bit. Put into init.sqf: TAG_fnc_playMusic = { if (!isServer) exitWith {}; params ["_vehicle","","","_song"]; deleteVehicle (_vehicle getVariable ["MySoundSource",objnull]); _soundsource = "Land_FMradio_F" createVehicle [0,0,0]; _soundsource attachTo [_vehicle,[0,0,0]]; _soundsource hideObjectGlobal true; _vehicle setVariable ["MySoundSource",_soundsource]; _vehicle setVariable ["TAG_fnc_playing",true]; [_soundsource,_song] remoteExec ["say3D",0]; }; TAG_fnc_stopMusic = { params ["_vehicle"]; deleteVehicle (_vehicle getVariable ["MySoundSource",objnull]); _vehicle setVariable ["TAG_fnc_playing",false]; }; Then into vehicle init field: _vehicle = this; _songs = ["song1","song2","song3"]; { _vehicle addAction [format ["Play %1",_x], {_play = _this spawn TAG_fnc_playMusic}, _x, 0, true, true, "", "!(_target getvariable ['TAG_fnc_playing',false]) AND _this in crew _target"]; } forEach _songs; _vehicle addAction ["Stop Music", {_stop = _this call TAG_fnc_stopMusic}, nil, 0, true, true, "", "(_target getvariable ['TAG_fnc_playing',false]) AND _this in crew _target"]; Define your songs as sounds in description.ext Cheers Share this post Link to post Share on other sites
pliskin124 4 Posted April 27, 2017 1 minute ago, Grumpy Old Man said: Try this, simplified your stuff a bit. Should work fine: TAG_fnc_playMusic = { if (!isServer) exitWith {}; params ["_vehicle","_song"]; deleteVehicle (_vehicle getVariable ["MySoundSource",objnull]); _soundsource = "Land_FMradio_F" createVehicle [0,0,0]; _soundsource attachTo [_vehicle,[0,0,0]]; _soundsource hideObjectGlobal true; _vehicle setVariable ["MySoundSource",_soundsource]; _vehicle setVariable ["TAG_fnc_playing",true]; [_soundsource,_song] remoteExec ["say3D",0]; }; TAG_fnc_stopMusic = { params ["_vehicle"]; deleteVehicle (_vehicle getVariable ["MySoundSource",objnull]); _vehicle setVariable ["TAG_fnc_playing",false]; }; _vehicle = car1; _vehicle addAction ["Play Song 1", {_play = [(_this select 0),"Radio002"] spawn TAG_fnc_playMusic}, nil, 0, true, true, "", "!(_target getvariable ['TAG_fnc_playing',false]) AND _this in crew _target"]; _vehicle addAction ["Stop Music", {_stop = [(_this select 0)] call TAG_fnc_stopMusic}, nil, 0, true, true, "", "(_target getvariable ['TAG_fnc_playing',false]) AND _this in crew _target"]; Cheers Thanks. I'll test this out, couple of questions though, _vehicle = car1; doesn't that require me naming a vehicle car1? I can't do that once the mission is started which was the problem in the first place. I also have this working on all vehicles, helicopters, etc. I assume this is the rewritten Musicplayer.sqf script, or is this just one standalone .sqf that I can run from the add action? Wouldn't using the playMusic command also require me to redefine them as music in the description.ext instead of sounds? Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted April 27, 2017 Edited my post to be a bit more clear. Cheers Share this post Link to post Share on other sites
pliskin124 4 Posted April 27, 2017 1 minute ago, Grumpy Old Man said: Edited my post to be a bit more clear. Cheers Got it, but the problem is the vehicles aren't on the map so I don't have access to their init fields. They're spawned in via scripts, the only thing I have access to on them in game is through zeus which is the execution field. Is there a way to define ALL vehicles on the map? Because I would be perfectly fine with having a radio action on EVERY single vehicle on the map, rather than only a select few. Share this post Link to post Share on other sites
pierremgi 4862 Posted April 27, 2017 Moving the source will not move the sound. See last remark here. Not tested in best conditions, but it seems you can attach directly a sound if defined as an object with "#soundonvehicle": _sound = ASLToAGL [0,0,0] nearestObject "#soundonvehicle"; but I'm not sure it works. On the other hand, the alternate syntax of say3D (much more simple in MP due to relative path for sound file): [from, to] say3D [sound, maxDistance, pitch] seems to cope with a source movement. I didn't test it on moving source, but perhaps someone has a feedback on that. Share this post Link to post Share on other sites
pliskin124 4 Posted April 27, 2017 3 minutes ago, pierremgi said: Not tested in best conditions, but it seems you can attach a sound if defined as an object with "#soundonvehicle": _sound = ASLToAGL [0,0,0] nearestObject "#soundonvehicle"; but I'm not sure it works. On the other hand, the alternate syntax of say3D (much more simple in MP due to relative path for sound file): [from, to] say3D [sound, maxDistance, pitch] seems to cope with a source movement. I didn't test it but perhaps someone has a feedback on that. So what I'm looking for would be something like... soundsource1 say3D [song1, 200, 0] 200 being meters, 0 being no change to pitch? and Song1 identifying the song? Share this post Link to post Share on other sites
pierremgi 4862 Posted April 27, 2017 1 minute ago, pliskin124 said: So what I'm looking for would be something like... soundsource1 say3D [song1, 200, 0] 200 being meters, 0 being no change to pitch? and Song1 identifying the song? Test it. I can't do that for you. Share this post Link to post Share on other sites
pliskin124 4 Posted April 27, 2017 5 minutes ago, pierremgi said: Test it. I can't do that for you. Tested - soundsource1 say3D ["song1", 25, 0]; Didn't seem to make any difference setting it from 25 to 100. Also nothing more horrifying than Johnny Cash with a higher pitch. Share this post Link to post Share on other sites
pierremgi 4862 Posted April 27, 2017 5 minutes ago, pliskin124 said: Tested - soundsource1 say3D ["song1", 25, 0]; Didn't seem to make any difference setting it from 25 to 100. Also nothing more horrifying than Johnny Cash with a higher pitch. You need to param that in cfgSounds : https://feedback.bistudio.com/T83026 Share this post Link to post Share on other sites
pliskin124 4 Posted April 27, 2017 1 minute ago, pierremgi said: You need to param that in cfgSounds : https://feedback.bistudio.com/T83026 " For me the command works correctly, you just need to specify max audible distance in config, otherwise default distance is too big. sound[] = {"voice.ogg", 1, 1, 100}; The last param is max distance which is 100m and it does fade correctly with this added. " Would this be configured in the description .ext? class CfgSounds { // List of sounds (.ogg files without the .ogg extension) sounds[] = {AirHorn}; // Definition for each sound class AirHorn { // Name for mission editor name = "AirHorn"; //Path of the .ogg file. since it's in the same folder just use the filename sound[] = {AirHorn.ogg, 1, 1.0}; titles[] = {}; }; class TickTock { // Name for mission editor name = "TickTock"; //Path of the .ogg file. since it's in the same folder just use the filename sound[] = {TickTock.ogg, db+20, 1.0}; titles[] = {}; }; class song1 { // Name for mission editor name = "song1"; //Path of the .ogg file. since it's in the same folder just use the filename sound[] = {music\song1.ogg, db+3, 1.0}; titles[] = {}; }; class song2 { // Name for mission editor name = "song2"; //Path of the .ogg file. since it's in the same folder just use the filename sound[] = {music\song2.ogg, db+3, 1.0}; titles[] = {}; }; class song3 { // Name for mission editor name = "song3"; //Path of the .ogg file. since it's in the same folder just use the filename sound[] = {music\song3.ogg, db+3, 1.0}; titles[] = {}; }; class song4 { // Name for mission editor name = "song4"; //Path of the .ogg file. since it's in the same folder just use the filename sound[] = {music\song4.ogg, db+3, 1.0}; titles[] = {}; }; class song5 { // Name for mission editor name = "song5"; //Path of the .ogg file. since it's in the same folder just use the filename sound[] = {music\song5.ogg, db+3, 1.0}; titles[] = {}; }; class song6 { // Name for mission editor name = "song6"; //Path of the .ogg file. since it's in the same folder just use the filename sound[] = {music\song6.ogg, db+3, 1.0}; titles[] = {}; }; class song7 { // Name for mission editor name = "song7"; //Path of the .ogg file. since it's in the same folder just use the filename sound[] = {music\song7.ogg, db+3, 1.0}; titles[] = {}; }; class song8 { // Name for mission editor name = "song8"; //Path of the .ogg file. since it's in the same folder just use the filename sound[] = {music\song8.ogg, db+3, 1.0}; titles[] = {}; sounds[] = {AirHorn}; = Here? or sound[] = {AirHorn.ogg, 1, 1.0}; Here? I assume it would be something like this sound[] = {AirHorn.ogg, 1, 1.0, 100}; to set it to 100 meters, correct? Share this post Link to post Share on other sites
pierremgi 4862 Posted April 27, 2017 Correct. Not in sounds[], just where you define dB and pitch in sound[] = {...} as 4th param. Share this post Link to post Share on other sites
pliskin124 4 Posted April 27, 2017 7 minutes ago, pierremgi said: Correct. Not in sounds[], just where you define dB and pitch in sound[] = {...} as 4th param. Works great, thanks a lot. I found the ideal settings at around 40 meters... just in case any future person seeing this is curious. Share this post Link to post Share on other sites
pliskin124 4 Posted April 27, 2017 Quick question, will my script work for playing the say3D globally? or is the music local only? Share this post Link to post Share on other sites
pierremgi 4862 Posted April 27, 2017 As you can see on BIKI page, effect is local. You need to broadcast it on each concerned PC. Share this post Link to post Share on other sites
pliskin124 4 Posted April 27, 2017 3 hours ago, pierremgi said: As you can see on BIKI page, effect is local. You need to broadcast it on each concerned PC. But if the script is set for Player, only the initiating player receives the broadcast, so how would I broadcast it on everyones at the same time? Share this post Link to post Share on other sites
pliskin124 4 Posted April 28, 2017 Having an issue with my script... when I run it in the editor it works great, when I try it on the dedicated server it doesn't work. Thoughts? Share this post Link to post Share on other sites