Slammin 10 Posted March 31, 2013 Hi, A-SUICIDAL made some great custom music features for Arma 2 (which can be found under the following links.) Loudspeaker Playlist (All Versions) http://forums.bistudio.com/showthread.php?146292-Loudspeaker-Playlist-%28All-Versions%29 Adding a "Song Playlist PA System" Radio to your Base http://forums.bistudio.com/showthread.php?145613-Adding-a-quot-Song-Playlist-PA-System-quot-Radio-to-your-Base I am trying to get this features working in my custom Arma 3 mission. However loudspeakers nor radio are currently available as objects in Arma 3 Alpha. Replacing these by other objects does not result in satisfying results (no music whatsoever.) Has anyone managed to get custom music playing from an object? (3D, as the further away you are from this object, the music volume decreases.) I know how to add custom music as trigger though. Best regards, Slammin Share this post Link to post Share on other sites
froggyluv 2136 Posted March 31, 2013 A banned guy name Maven did some pretty cool stuff on that front for Arma 2 - http://forums.bistudio.com/showthread.php?104514-J-S-R-S-1-5&p=2264598&viewfull=1#post2264598 Share this post Link to post Share on other sites
Slammin 10 Posted April 1, 2013 A banned guy name Maven did some pretty cool stuff on that front for Arma 2 - http://forums.bistudio.com/showthread.php?104514-J-S-R-S-1-5&p=2264598&viewfull=1#post2264598 Thanks for your reply Froggyluv! Unfortunaly Maven's files are removed aswell I notice, so i cannot see the stuff he created. Share this post Link to post Share on other sites
MrSteve 1 Posted April 1, 2013 Hi, I've got say3d working, have you tried that? eg. yourobject say3d "your_sound_file_without_extension"; Steve Share this post Link to post Share on other sites
Freddan962 1 Posted April 1, 2013 Hi, I've got say3d working, have you tried that?eg. yourobject say3d "your_sound_file_without_extension"; Steve Could you give me a example of your script and the description.ext edit? Cheers, Fred! Share this post Link to post Share on other sites
MrSteve 1 Posted April 1, 2013 In description.ext: class CfgSounds { // List of sounds (.ogg files without the .ogg extension) sounds[] = {MILCHAT}; // Definition for each sound class MILCHAT { name = "MILCHAT"; // Name for mission editor sound[] = {\Sounds\MILCHAT.ogg, 0.05, 1.0}; titles[] = {0, ""}; }; }; In script: ncar say3d "MILCHAT"; Share this post Link to post Share on other sites
Slammin 10 Posted April 1, 2013 Hi, I've got say3d working, have you tried that?eg. yourobject say3d "your_sound_file_without_extension"; Thanks Steve! I managed to get custom music playing from any object/vehicle (finally!) by editting the following in it's init : this say3d "track1"; Next thing for me to accomplish is having this function : 1. loop (I am gonna search for this function accordingly.) 2. implement A-Suicidal's script to have the option to turn say3d on or off, or skip to the next custom song for example. I didn't manage to get this working with say3d. ---------- Post added at 13:39 ---------- Previous post was at 13:25 ---------- while {true} do { say3d "track1"; //Replace with the name of your song sleep 169; //Replace with the length of your song in seconds }; So far I got this. But something is fundamentally wrong with this code I mention above. Lookin' further. Share this post Link to post Share on other sites
mindstorm 8 Posted April 1, 2013 You could do this: scipt.sqf track1_playing = true; while {track1_playing} do { say3d "track1"; sleep 169; }; And then change track1_playing to false when you want it to stop looping. Share this post Link to post Share on other sites
Slammin 10 Posted April 1, 2013 You could do this:scipt.sqf track1_playing = true; while {track1_playing} do { say3d "track1"; sleep 169; }; And then change track1_playing to false when you want it to stop looping. Thanks for the input Mindstorm! I made loop.sqf with your code. However I fail miserably in executing this... I have zero understanding of scripting so far, so its all trial and error for me at the moment. nul = [] execVM "loop.sqf" How do I execute the script in the init field of an object or vehicle? Or should I arrange that via a trigger or init.sqs instead of merely an object's init field? Share this post Link to post Share on other sites
johnnyboy 3793 Posted April 1, 2013 Here's a sound loop script I wrote for ARMA awhile back. You pass it the sound file name, the length of the sound segment in seconds, and how long you want it to loop for. It's essentially the same as what Slammin post, but in script form (so you can reuse it for any sound file of any length). Share this post Link to post Share on other sites
Slammin 10 Posted April 3, 2013 Here's a sound loop script I wrote for ARMA awhile back. You pass it the sound file name, the length of the sound segment in seconds, and how long you want it to loop for. It's essentially the same as what Slammin post, but in script form (so you can reuse it for any sound file of any length). Thanks for your sound loop script JohnnyBoy! Next challenge for me is to addaction say3d to a chopper for example. Goal : Player gets the option to play a song as an action on the chopper and flies away with it. By reading up what A-Suicidal implemented in his " Adding a "Song Playlist PA System" Radio to your Base " script http://forums.bistudio.com/showthread.php?145613-Adding-a-quot-Song-Playlist-PA-System-quot-Radio-to-your-Base and examining the addAction-command on BIS Wiki http://community.bistudio.com/wiki/addAction I have experimenting with this (but so far with out success) : vehiclename addAction ["Radio on", say3D"track1"]; vehiclename addAction ["Radio on", "say3D"track1""]; vehiclename addAction ["Radio on", this say3D"track1"]; vehiclename addAction ["Radio on", "say3d.sqs"]; say3d.sqs : this say3D"track1"; It's fair to say that I want too much without proper education (shootin' from the hip with scripts atm), but if someone can give me directions with this it will be much appreciated! Share this post Link to post Share on other sites
Woodpeckersam 18 Posted April 5, 2013 (edited) Where is your radio script located in the mission folder? If it is in the root folder then use vehiclename addAction ["Radio on", "say3d.sqf"]; (It should be sqf right? Unless you made the script in sqs, try to avoid using sqs as much as possible) If it is in it's own folder inside the mission folder then do it like this for example vehiclename addAction ["Radio on", "Scripts\Radio\say3d.sqf"]; Also remember to rename your vehicle. But it makes more sense to put this code inside the vehicles init / initialization field like this: this addAction ["Radio on", "say3d.sqf"]; this = the current vehicle/unit/object that the code is running from. Im not on my PC so I cannot really check my code, but it should work. ---------- Post added at 01:22 ---------- Previous post was at 01:07 ---------- Alternatively try this private ["_vehicle","_onoff"]; _vehicle = _this select 0; //This is the variable that stores the vehicle that has the action Radio On and Off _onoff = _this select 3; //This is the variable that the user sets for Radio On and Off. On the addaction code, there is space after the "Script Name" to set this variable. track_playing = true; //This is a Global Variable. You can set this variable to true or false anywhere while {track_playing} do //While the Global Variable is true then do the following code { if (_onoff == "On") then //If _onoff is equalled to "On" (set in the AddAction "Radio On") then do t { hint "Song started"; //Tells you that the song is player. Can remove if needed _vehicle say3D "track1"; //Players the tracked specified in the description.ext (i think lol) sleep 169; //Sleeps for 169 seconds hint "Song finished"; //Tells you the song is finished sleep 10; //Simulate the loading of another song before the loop starts again }; if (_onoff == "Off") exitWith {hint "radio off"; _vehicle say3D "";}; //Self explanatory }; exit; Copy these 2 into the Vehicle's init field: this addAction ["Radio on", "Scripts\Radio\say3d.sqf",["On"]];this addAction ["Radio off", "Scripts\Radio\say3d.sqf",["Off"]]; See in the code where it says ["On"] and ["Off"] they are associated with _onoff = _this select 3. You can add more strings/numbers/booleans after that if needed. So for example you could have ["On","DebugOn",False,1] "On" would be _this select 3; "DebugOn" would be _this select 4; and so on. Remember to change the path to where the script is. Also use Notepad++ if you are using plain standard word editing program and download the ArmA 3 NotePad++ plugin. Edited April 5, 2013 by ArmASalt3 Share this post Link to post Share on other sites
Slammin 10 Posted April 5, 2013 ArmASalt3! Thank you very much for the comprehensive feedback! The code I used in my say3d.sqf was incorrect (indeed, not say3d.sqs ;).) _this say3d "track1"; in my last script didn't work, your _vehicle = _this select 0; _vehicle say3D "track1"; does the job! To literally turn on the radio I had to change this addAction ["Radio on", "Scripts\Radio\say3d.sqf",[color="#FF0000"][[/color]"On"[color="#FF0000"]][/color]]; this addAction ["Radio off", "Scripts\Radio\say3d.sqf",[color="#FF0000"][[/color]"Off"[color="#FF0000"]][/color]]; into this addAction ["Radio on", "Scripts\Radio\say3d.sqf","On"]; this addAction ["Radio off", "Scripts\Radio\say3d.sqf","Off"]; _vehicle say3D ""; results in a sound unknown message for me at the moment. I look into description.ext to solve this issue. Share this post Link to post Share on other sites
Woodpeckersam 18 Posted April 5, 2013 Any time mate =) How about this, make a 1 second recording of "Silence" into an ogg file and maybe call it Silent.ogg and voila you have your "Radio turn off" I think lol :P I have not really played around with say3d so I am unsure if the sounds would overlap or play individually. Worth a check. Good luck with your mission making =) You seem to be gathering a lot of knowledge at speed. ---------- Post added at 20:07 ---------- Previous post was at 20:04 ---------- Alternatively play around with audacity and create radio static which fades to silent, simulating the radio being turned off. Adds a nice touch lol. Share this post Link to post Share on other sites
paramedic 22 Posted February 10, 2014 I have tihis in my object called "Radio": this addAction ["Radio on", "say3d.sqf",["On"]]; this addAction ["Radio off", "say3d.sqf",["Off"]]; This is in my "description.ext": class CfgSounds{ sounds[] = {letter}; class letter { name = "letter"; sound[] = {"letter.ogg", db+0, 1.0}; titles[] = {0,""}; }; }; This is in my "say3d.sqf" located in the missionfolder: private ["_vehicle","_onoff"];_vehicle = _this select 0; //This is the variable that stores the vehicle that has the action Radio On and Off _onoff = _this select 3; //This is the variable that the user sets for Radio On and Off. On the addaction code, there is space after the "Script Name" to set this variable. track_playing = true; //This is a Global Variable. You can set this variable to true or false anywhere while {track_playing} do //While the Global Variable is true then do the following code { if (_onoff == "On") then //If _onoff is equalled to "On" (set in the AddAction "Radio On") then do t { hint "AIF Mix-Tape started"; //Tells you that the song is player. Can remove if needed _vehicle say3D "letter"; //Players the tracked specified in the description.ext (i think lol) sleep 120; //Sleeps for 120 seconds hint "AIF Mix-Tape stopped"; //Tells you the song is finished sleep 10; //Simulate the loading of another song before the loop starts again }; if (_onoff == "Off") exitWith {hint "radio off"; _vehicle say3D "";}; //Self explanatory }; exit; And my soundfile "letter.ogg" is in the missionfolder and in a "sound" folder. Could someone please help me? Share this post Link to post Share on other sites
paramedic 22 Posted February 10, 2014 Okay...found my problem, should read posts more carefull. But does someone know how to get up the volume on the inside of the vehicle without making it just louder? Share this post Link to post Share on other sites
rtek 10 Posted February 10, 2014 Thanks for the input Mindstorm! I made loop.sqf with your code. However I fail miserably in executing this...I have zero understanding of scripting so far, so its all trial and error for me at the moment. nul = [] execVM "loop.sqf" How do I execute the script in the init field of an object or vehicle? Or should I arrange that via a trigger or init.sqs instead of merely an object's init field? no expert by an stretch, but first put a ; at the end. second try just putting from the exec without what you have before it. just a shot in the dark guess. Share this post Link to post Share on other sites