bvrettski 10 Posted January 8, 2016 I've been tinkering with the A3Wasteland drug runners side mission. (and yes I'm just a trial and error hack when it come to coding). I'm working with the following section of code and would like to customize it a bit. So far my experiments have been fruitless so I could use some help if anyone is so inclined: { // Mission completed _drugpilerandomizer = [4,8,12]; _drugpile = _drugpilerandomizer call BIS_fnc_SelectRandom; for "_i" from 1 to _drugpile do { private["_item"]; _item = [ ["lsd", "Land_WaterPurificationTablets_F"], ["marijuana", "Land_VitaminBottle_F"], ["cocaine","Land_PowderedMilk_F"], ["heroin", "Land_PainKillers_F"] ] call BIS_fnc_selectRandom; [_item, _lastPos] call _drop_item; }; _explosivePos = getPosATL (_vehicles select 0); _explosive = createMine ["SatchelCharge_F", _explosivePos, [], 0]; _explosive setDamage 1; _successHintMessage = "You have stopped the drugs runners but they blew up their car! The drugs are yours to take!"; }; At the end of the drop drugs section I would like to make the mission pause for a period of time (2 seconds), then play a sound file, pause again (1 second) and then have the explosion take place. I tried inserting the following: //Experimental language - Boom Pause _waitUntil {sleep 2}; _playSound3D [call currMissionDir + "client\sounds\drugrunners.wss"]; _waitUntil {sleep 1}; //Experimental language - End To be clear the sequence I am looking for is: 1. Drop the drugs 2 Wait 2 seconds 3. play sound file 4. Pause 1 second 5. Set off explosion The drop drugs and set off explosion sections are working fine. Needless to say it my weak attempt at coding didnt work. Any help or pointers to proper coding in this regard would be much appreciated. Share this post Link to post Share on other sites
jshock 512 Posted January 8, 2016 When wanting to suspend for a time, just use the sleep command by itself, you don't need a waitUntil around it. 1 Share this post Link to post Share on other sites
bvrettski 10 Posted January 8, 2016 Thanks for getting back to me... So just: _sleep 2; _playSound3D ["client\sounds\drugrunners.wss"]; _sleep 1; ?? Share this post Link to post Share on other sites
cosmic10r 2326 Posted January 8, 2016 From what i read playsound3d has an issue with reading from a mission file... it doesn't know to start at mission\client\sounds, so it may not work, not sure if that is still the case but it came up in the search. Hopefully it was fixed you may want to try say3D its going to look more like sleep 2; playSound3D ["client\sounds\drugrunners.wss", player]; sleep 1; Share this post Link to post Share on other sites
bvrettski 10 Posted January 8, 2016 you may want to try say3D I think you're correct. playSound3D does not seem to work or I'm not scripting it properly. Will try say3D Share this post Link to post Share on other sites
davidoss 550 Posted January 8, 2016 playSound3D ["A3\Sounds_F\ambient\battlefield\battlefield_jet1.wss", _spawner, false, getPosASL _spawner, 8, 1, 0]; playSound3D ["A3\Sounds_F\arsenal\weapons\Pistols\4-Five\4-Five_01.wss", player, false, position player, 8, 1, 0]; playsound3d works don't panic Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted January 8, 2016 Sure it works, needs a bit of a workaround for custom sounds. You need to redirect to the root mission folder for the playSound3D command to work when using custom sounds, having a file named "test.ogg" inside a "\sounds" folder within mission root would look like this: _missionRoot = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _sound = _missionRoot + "sounds\test.ogg"; playSound3d [_sound, player]; Cheers Share this post Link to post Share on other sites
bvrettski 10 Posted January 8, 2016 I see what ya did there. :) I'll give it a go. Thanks Share this post Link to post Share on other sites
bvrettski 10 Posted January 8, 2016 Sure it works, needs a bit of a workaround for custom sounds. You need to redirect to the root mission folder for the playSound3D command to work when using custom sounds, having a file named "test.ogg" inside a "\sounds" folder within mission root would look like this: _missionRoot = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _sound = _missionRoot + "sounds\test.ogg"; playSound3d [_sound, player]; Cheers Tried it multiple times to make sure I was covering my bases but could not get it to work. Here is the entire segment of the code: _successExec = { // Mission completed sleep 3; _explosivePos = getPosATL (_vehicles select 0); _explosive = createMine ["SatchelCharge_F", _explosivePos, [], 0]; _explosive setDamage 1; sleep 1; _box1 = createVehicle ["Box_East_WpsSpecial_F", _lastPos, [], 2, "None"]; _box1 setDir random 360; [_box1, "mission_Explosives"] call fn_refillbox; { _x setVariable ["R3F_LOG_disabled", false, true] } forEach [_box1]; _missionRoot = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _sound = _missionRoot + "sounds\testsound.ogg"; playSound3d [_sound, player]; sleep 5; _explosivePos = getPosATL (_vehicles select 0); _explosive = createMine ["IEDUrbanBig_F", _explosivePos, [], 0]; _explosive setDamage 1; _successHintMessage = "Congrats! The suicide bombers are dead and the explosives are yours...if you survived."; }; I also found similar code to yours in another Wasteland addon and tried it with no success (Although it does work properly in the addon): _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _soundToPlay = _soundPath + "addons\breakLock\sounds\carhorn.ogg"; playSound3D [_soundToPlay, _vehicle, false, getPosASL _vehicle, 1, 1, 0]; Share this post Link to post Share on other sites
MKD3 27 Posted January 9, 2016 Someone should probably explain the very basics of SQF. Anything with "_" before it becomes a private variable. So _Noob is a variable, and if used with a command "Say3d" it means a variable is defined, and nothing will actually happen. Youve fixed this but its best its explained._say3d is a private variable << Does nothing for you in this case, say3d is a command, and plays sound if used correctly.Also if you havent placed a sound file anywhere and correctly defined it youre not gonna get anywhere.If in a mission file add this to description.ext, create a "sound" folder, and put your sound in OGG format into the sound folder,and name it "yoursound.ogg". class CfgSounds { sounds[] = {}; class yoursound { name = "yoursound"; //This shows the game where your sound file is and its volume sound[] = {"\sound\yoursound.ogg", 0.8, 1}; titles[] = {0,""}; }; }; Then execute for clients: player say3D "yoursound"; Try to just get that to work, its a different way to do it but its a good way to learn. And Check this, https://community.bistudio.com/wiki/Description.ext Share this post Link to post Share on other sites
bvrettski 10 Posted January 10, 2016 Thanks for everyone's help. After a little additional experimentation, I was able to get this to work perfectly. :) _successExec = { // Mission completed sleep 3; _explosivePos = getPosATL (_vehicles select 0); _explosive = createMine ["SLAMDirectionalMine_Wire_Mag", _explosivePos, [], 0]; _explosive setDamage 1; _box1 = createVehicle ["Box_East_WpsSpecial_F", _lastPos, [], 2, "None"]; _box1 setDir random 360; [_box1, "mission_Explosives"] call fn_refillbox; { _x setVariable ["R3F_LOG_disabled", false, true] } forEach [_box1]; sleep 3; _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _soundToPlay = _soundPath + "addons\breakLock\sounds\carhorn.ogg"; playSound3D [_soundToPlay, _box1]; sleep 2; _explosivePos = getPosATL (_vehicles select 0); _explosive = createMine ["IEDUrbanBig_F", _explosivePos, [], 0]; _explosive setDamage 1; sleep 5; _successHintMessage = "Area clear!! The suicide bombers are dead and the explosives are yours...if you survived."; }; On a followup question isn't there a library of built in sounds in the game? I can't find a listing of them online. Share this post Link to post Share on other sites
MKD3 27 Posted January 12, 2016 Yup, you can find it a couple of ways.Either in game by opening the config viewer and checking out cfgsounds.to do this, open up debug, and enter this: [] call BIS_fnc_configviewer and search for cfgsounds in there. or by debinarising the base game data files and searching for the sounds in the A3 files. Share this post Link to post Share on other sites