Jump to content

[RELEASE] Random Ambient Sounds 0.2


Sp4rkY

Recommended Posts

Hey there!

 

In wishes of some people here i thought, i create a simple script which allows you to use custom background music for a nicer ambience like in Arma 2 DayZ Epoch.

Sure the code can get even better but for now, these few lines do their job :)

 

Instructions can be found in the readme.md at this link:

 

https://github.com/SPKcoding/SPK_RAS

 

 

Please post some feedback, if errors or not :)

Have fun!

Cheers!

Link to comment
Share on other sites

If i understand your question correctly, you asked if the arma 2 sounds/music is implemented in this script ?

No, its just a way to put your own music in the game. You can decide which sound you want to get played and you can insert as many sounds you want.

 

Hope i could clear it up for you :)

cheers

Link to comment
Share on other sites

  • 1 month later...

i tried to get this to work, and have not been able to.

 

here is the part in my description.ext

//if _rasStyle = false
class CfgSounds
{	tracks[]={};
	class Bam
	{
		// how the sound is referred to in the editor (e.g. trigger effects)
		name = "gunshot";
		// filename, volume, pitch
		sound[] = {"sounds\gunshot.ogg", 1, 1};
		titles[] = {};
	};
	
	class ns_fx_misc4
	{
		name = "Misc_strange_wind";
		sound[] = {"sounds\fx_misc4.ogg",1.0,1.0};
		titles[] = {};
	};
	
	class deathvoice
	{
		name = "deathvoice";
		sound[] = {"sounds\deathvoice.ogg",1.0,1.0};
		titles[] = {};
	};
	class ns_fx_drone1
	{
		name = "Drone_1";
		sound[] = {"sounds\fx_drone1.ogg",1.0,1.0};
		titles[] = {};
	};
	class ns_fx_drone2
	{
		name = "Drone_2";
		sound[] = {"sounds\fx_drone2.ogg",1.0,1.0};
		titles[] = {};
	};
	
	class stinger_0
	{
		name = "stinger_0";
		sound[] = {"sounds\stinger_0.ogg",1.0,1.0};
		titles[] = {};
	};
	
	class stinger_1
	{
		name = "stinger_1";
		sound[] = {"sounds\stinger_1.ogg",1.0,1.0};
		titles[] = {};
	};
		class suspense_0
	{
		name = "suspense_0";
		sound[] = {"sounds\suspense_0.ogg",1.0,1.0};
		titles[] = {};
	};
		class suspense_1
	{
		name = "suspense_1";
		sound[] = {"sounds\suspense_1.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_2
	{
		name = "suspense_2";
		sound[] = {"sounds\suspense_2.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_3
	{
		name = "suspense_3";
		sound[] = {"sounds\suspense_3.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_4
	{
		name = "suspense_4";
		sound[] = {"sounds\suspense_4.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_5
	{
		name = "suspense_5";
		sound[] = {"sounds\suspense_5.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_6
	{
		name = "suspense_6";
		sound[] = {"sounds\suspense_6.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_7
	{
		name = "suspense_7";
		sound[] = {"sounds\suspense_7.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_8
	{
		name = "suspense_8";
		sound[] = {"sounds\suspense_8.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_9
	{
		name = "suspense_9";
		sound[] = {"sounds\suspense_9.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_10
	{
		name = "suspense_10";
		sound[] = {"sounds\suspense_10.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_11
	{
		name = "suspense_11";
		sound[] = {"sounds\suspense_11.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_12
	{
		name = "suspense_12";
		sound[] = {"sounds\suspense_12.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_13
	{
		name = "suspense_13";
		sound[] = {"sounds\suspense_13.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_14
	{
		name = "suspense_14";
		sound[] = {"sounds\suspense_14.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_15
	{
		name = "suspense_15";
		sound[] = {"sounds\suspense_15.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_16
	{
		name = "suspense_16";
		sound[] = {"sounds\suspense_16.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_17
	{
		name = "suspense_17";
		sound[] = {"sounds\suspense_17.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_18
	{
		name = "suspense_18";
		sound[] = {"sounds\suspense_18.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_19
	{
		name = "suspense_19";
		sound[] = {"sounds\suspense_19.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_20
	{
		name = "suspense_20";
		sound[] = {"sounds\suspense_20.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_21
	{
		name = "suspense_21";
		sound[] = {"sounds\suspense_21.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_22
	{
		name = "suspense_22";
		sound[] = {"sounds\suspense_22.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_23
	{
		name = "suspense_23";
		sound[] = {"sounds\suspense_23.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_24
	{
		name = "suspense_24";
		sound[] = {"sounds\suspense_24.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_25
	{
		name = "suspense_25";
		sound[] = {"sounds\suspense_25.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_26
	{
		name = "suspense_26";
		sound[] = {"sounds\suspense_26.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_27
	{
		name = "suspense_27";
		sound[] = {"sounds\suspense_27.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_28
	{
		name = "suspense_28";
		sound[] = {"sounds\suspense_28.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_29
	{
		name = "suspense_29";
		sound[] = {"sounds\suspense_29.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_30
	{
		name = "suspense_30";
		sound[] = {"sounds\suspense_30.ogg",1.0,1.0};
		titles[] = {};
	};
	
				class suspense_31
	{
		name = "suspense_31";
		sound[] = {"sounds\suspense_31.ogg",1.0,1.0};
		titles[] = {};
	};
	
				class suspense_32
	{
		name = "suspense_32";
		sound[] = {"sounds\suspense_32.ogg",1.0,1.0};
		titles[] = {};
	};
	
				class suspense_33
	{
		name = "suspense_33";
		sound[] = {"sounds\suspense_33.ogg",1.0,1.0};
		titles[] = {};
	};
	
				class suspense_34
	{
		name = "suspense_34";
		sound[] = {"sounds\suspense_34.ogg",1.0,1.0};
		titles[] = {};
	};
	
				class suspense_35
	{
		name = "suspense_35";
		sound[] = {"sounds\suspense_35.ogg",1.0,1.0};
		titles[] = {};
	};
	
};

//if _rasStyle = true
class cfgMusic{ 
	tracks[]={};
	class intro 
	{  
		name = "intro";
		sound[] = {"music\IntroSong.ogg",1.0,1.0}; 
  };
  
  	class ns_fx_misc4
	{
		name = "Misc_strange_wind";
		sound[] = {"sounds\fx_misc4.ogg",1.0,1.0};
		titles[] = {};
	};
	class ns_fx_drone1
	{
		name = "Drone_1";
		sound[] = {"sounds\fx_drone1.ogg",1.0,1.0};
		titles[] = {};
	};
	class ns_fx_drone2
	{
		name = "Drone_2";
		sound[] = {"sounds\fx_drone2.ogg",1.0,1.0};
		titles[] = {};
	};
	
	class stinger_0
	{
		name = "stinger_0";
		sound[] = {"sounds\stinger_0.ogg",1.0,1.0};
		titles[] = {};
	};
	
	class stinger_1
	{
		name = "stinger_1";
		sound[] = {"sounds\stinger_1.ogg",1.0,1.0};
		titles[] = {};
	};
		class suspense_0
	{
		name = "suspense_0";
		sound[] = {"sounds\suspense_0.ogg",1.0,1.0};
		titles[] = {};
	};
		class suspense_1
	{
		name = "suspense_1";
		sound[] = {"sounds\suspense_1.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_2
	{
		name = "suspense_2";
		sound[] = {"sounds\suspense_2.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_3
	{
		name = "suspense_3";
		sound[] = {"sounds\suspense_3.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_4
	{
		name = "suspense_4";
		sound[] = {"sounds\suspense_4.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_5
	{
		name = "suspense_5";
		sound[] = {"sounds\suspense_5.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_6
	{
		name = "suspense_6";
		sound[] = {"sounds\suspense_6.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_7
	{
		name = "suspense_7";
		sound[] = {"sounds\suspense_7.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_8
	{
		name = "suspense_8";
		sound[] = {"sounds\suspense_8.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_9
	{
		name = "suspense_9";
		sound[] = {"sounds\suspense_9.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_10
	{
		name = "suspense_10";
		sound[] = {"sounds\suspense_10.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_11
	{
		name = "suspense_11";
		sound[] = {"sounds\suspense_11.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_12
	{
		name = "suspense_12";
		sound[] = {"sounds\suspense_12.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_13
	{
		name = "suspense_13";
		sound[] = {"sounds\suspense_13.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_14
	{
		name = "suspense_14";
		sound[] = {"sounds\suspense_14.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_15
	{
		name = "suspense_15";
		sound[] = {"sounds\suspense_15.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_16
	{
		name = "suspense_16";
		sound[] = {"sounds\suspense_16.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_17
	{
		name = "suspense_17";
		sound[] = {"sounds\suspense_17.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_18
	{
		name = "suspense_18";
		sound[] = {"sounds\suspense_18.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_19
	{
		name = "suspense_19";
		sound[] = {"sounds\suspense_19.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_20
	{
		name = "suspense_20";
		sound[] = {"sounds\suspense_20.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_21
	{
		name = "suspense_21";
		sound[] = {"sounds\suspense_21.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_22
	{
		name = "suspense_22";
		sound[] = {"sounds\suspense_22.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_23
	{
		name = "suspense_23";
		sound[] = {"sounds\suspense_23.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_24
	{
		name = "suspense_24";
		sound[] = {"sounds\suspense_24.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_25
	{
		name = "suspense_25";
		sound[] = {"sounds\suspense_25.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_26
	{
		name = "suspense_26";
		sound[] = {"sounds\suspense_26.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_27
	{
		name = "suspense_27";
		sound[] = {"sounds\suspense_27.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_28
	{
		name = "suspense_28";
		sound[] = {"sounds\suspense_28.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_29
	{
		name = "suspense_29";
		sound[] = {"sounds\suspense_29.ogg",1.0,1.0};
		titles[] = {};
	};
	
			class suspense_30
	{
		name = "suspense_30";
		sound[] = {"sounds\suspense_30.ogg",1.0,1.0};
		titles[] = {};
	};
	
				class suspense_31
	{
		name = "suspense_31";
		sound[] = {"sounds\suspense_31.ogg",1.0,1.0};
		titles[] = {};
	};
	
				class suspense_32
	{
		name = "suspense_32";
		sound[] = {"sounds\suspense_32.ogg",1.0,1.0};
		titles[] = {};
	};
	
				class suspense_33
	{
		name = "suspense_33";
		sound[] = {"sounds\suspense_33.ogg",1.0,1.0};
		titles[] = {};
	};
	
				class suspense_34
	{
		name = "suspense_34";
		sound[] = {"sounds\suspense_34.ogg",1.0,1.0};
		titles[] = {};
	};
	
				class suspense_35
	{
		name = "suspense_35";
		sound[] = {"sounds\suspense_35.ogg",1.0,1.0};
		titles[] = {};
	};
  
};

Link to comment
Share on other sites

here is my ras settings file

private["_rasStyle","_tracks","_minGap","_maxGap","_addT","_secGap"];

//Recommended is to use CfgMusic (_rasStyle = true;)
//but it´s your choice :)

_rasStyle = true;	//choose which way you want to run the script -> true = CfgMusic | false = CfgSounds
					//CfgSound = every player is forced to hear the sound with your volume configuration in description.ext
					//CfgMusic = the player can decide about music-volume, also he can deactivate it

_tracks = [		//insert the "names" of your soundfiles you described in description.ext "without" file-extension here /a.E: track1.ogg then type here "track1" / no comma after the last entry!
	"Misc_strange_wind",
	"Drone_1",
	"Drone_2",
	"stinger_0",
	"stinger_1",
	"suspense_0",	
	"suspense_1",	
	"suspense_2",	
	"suspense_3",	
	"suspense_4",	
	"suspense_5",	
	"suspense_6",	
	"suspense_7",	
	"suspense_8",	
	"suspense_9",	
	"suspense_10",	
	"suspense_11",	
	"suspense_12",	
	"suspense_13",	
	"suspense_14",	
	"suspense_15",	
	"suspense_16",	
	"suspense_17",	
	"suspense_18",	
	"suspense_19",	
	"suspense_20",	
	"suspense_21",	
	"suspense_22",	
	"suspense_23",	
	"suspense_24",	
	"suspense_25",	
	"suspense_26",	
	"suspense_27",	
	"suspense_28",	
	"suspense_29",	
	"suspense_30",	
	"suspense_31",		
	"suspense_32",		
	"suspense_33",		
	"suspense_34",	
	"suspense_35"		
];

_minGap = 	2; 		//(number in minutes) Minimum gap between the tracks
_maxGap = 	5; 	//(number in minutes) Maximum gap between the tracks
_addT	=   1;   	//(number in minutes) Maximum random added time to the gap

//Triggers only if _rasStyle = false; is used
_secGap =	2;		//(number in minutes) Security time between tracks

ras init file

/*    *    *    *    *    *    *    *    *    *    *    *    *    */
/*	Title:			SPK_RAS										  */
/*	Author: 		Sp4rkY										  */
/*	Description:	Random Ambient Sounds						  */
/*					for Arma 3 Epoch		  					  */
/*	Version:		0.2											  */
/*    *    *    *    *    *    *    *    *    *    *    *    *    */


rasIsPlaying = false;
call compile preprocessFileLineNumbers "addons\SPK_RAS\RAS_play.sqf";
if(alive player)then{
	while{true}do{
		if(isNil "rasNext")then[{
			rasNext = true;
			call fnc_rasPlay
		},{
			waitUntil{rasNext};
			removeMusicEventHandler ["MusicStop",rasActive];
			call fnc_rasPlay;
		}]
	}
};

and ras play

fnc_rasPlay = {
	#include "RAS_settings.sqf";
	private["_minT","_maxT","_rndT","_rndAT","_rndTrck","_cfgSndRndT","_secT"];
	_rndAT = (_addT *60);
	_minT = (_minGap *60 + (random _rndAT));
	_maxT = (_maxGap *60);
	_rndT = (_minT + _maxT);
	_secT = (_secGap *60);
	_cfgSndRndT = (_rndT + _secT);
	if(_rasStyle)then[{
		if(rasIsPlaying)exitWith{};
		rasIsPlaying = true;
		rasNext = false;
		uiSleep _rndT;
		_rndTrck = _tracks call BIS_fnc_selectRandom;
		playMusic _rndTrck;	
		rasActive = addMusicEventHandler ["MusicStop",{rasIsPlaying = false; rasNext = true}]	
	},{
		if(rasIsPlaying)exitWith{};
		rasIsPlaying = true;
		rasNext = false;
		uiSleep _cfgSndRndT;
		_cfgSndTdone = true;
		_rndTrck = _tracks call BIS_fnc_selectRandom;
		playSound _rndTrck;
		if(_cfgSndTdone)then[{
			rasIsPlaying = false;
			rasNext = true;
			_cfgSndTdone = false;
		},{
			waitUntil{_cfgSndTdone};
			rasIsPlaying = false;
			rasNext = true;
			_cfgSndTdone = false;
		}]
	}]
};

Link to comment
Share on other sites

First of all, i know how my files look like, no need to show me ;)

Second is, i don´t know if you got any rpt errors, you only say, i doesnt work and thats all.

Maybe you did anything wrong with installing this. It works, if you follow the steps i´ve posted.

But one little error i was able to see:

In your description.ext at the class CfgSounds:

It have to be

class CfgSounds
{
	sounds[] = {};
[/code]

...not tracks[] = {}; //this is only for CfgMusic.

[url]https://community.bistudio.com/wiki/Description.ext#CfgSounds[/url]

 

I don´t think its a problem, but for going sure you can also try to don´t define the same .ogg files in both classes. For example: You use CfgMusic for this and defined

suspense_1 in CfgSounds too. Like i said, i dont think its a problem, but try to define the sounds only in one class for testing.

 

cheers

 

Link to comment
Share on other sites

so i deleted alll the cfg sounds related to this and just have music.

still nothing, yet my other music is working fine ( intro credits and sound)

1 thing i noticed in the script is 

_tracks is in ras_settings.sqf under private

yet i see this no where else in any file

what is _tracks for in the scripts, its only called in the 1 file.

 

 

Link to comment
Share on other sites

 
fnc_rasPlay = {
	#include "RAS_settings.sqf";
	private["_minT","_maxT","_rndT","_rndAT","_rndTrck","_cfgSndRndT","_secT"];
	_rndAT = (_addT *60);
	_minT = (_minGap *60 + (random _rndAT));
	_maxT = (_maxGap *60);
	_rndT = (_minT + _maxT);
	_secT = (_secGap *60);
	_cfgSndRndT = (_rndT + _secT);
	if(_rasStyle)then[{
		if(rasIsPlaying)exitWith{};
		rasIsPlaying = true;
		rasNext = false;
		uiSleep _rndT;
		_rndTrck = _tracks call BIS_fnc_selectRandom;

ok? :)

Link to comment
Share on other sites

thanks thats what i thought, so i changed all that. 

and it did play 1 track but then nothing.

 

_minGap =     0.5;         //(number in minutes) Minimum gap between the tracks
_maxGap =     1;     //(number in minutes) Maximum gap between the tracks
_addT    =   0.5;       //(number in minutes) Maximum random added time to the gap

are the settings im trying.

 

Link to comment
Share on other sites

ok so i have this playing the ambients, just need to adj it so it plays the full track, it seems to only play about 3 seconds and then cuts out. is there anyway you can add duration into your script?

i have seen in the past something with a duration= 40;

where 40 is the length of the track.

when ambients play on my server it lasts maybe 5 seconds or less.

Link to comment
Share on other sites

I have no clue what u are talking from.... Try to understand how my script is working and then search the reason which does the conflict in your own files. A duration is already integrated, check the "addMusicEventHandler".

 

Iam running out of ideas and i dont get it why you have such problems. Setup a vanilla server for test purposes and you will see its working, furthermore you are using CfgMusic. I think your mistake is the code running order in your init.sqf (which i noticed in the other thread), an antihack problem, battleye or simply another script which does the conflict.

 

I hope you don´t misunderstand me, but as i said some time ago, actually i have no time to update the script. I released it because it works. Sure there a better way to code it, but for now it does the job. When i find more time, i will do some upgrading to the code. I only can repeat myself and tell you: check your files, correct your code running order (init.sqf) and understand the functionality of RAS.

Thank you, cheers!

Link to comment
Share on other sites

how does your duration work? so it knows to play the whole ogg file?

it plays the ogg files fine, but only like 3-5 seconds, when everyone of my ogg files are at least 12 seconds, some are 2-3 minutes.

I do appreciate your time. once i can make this work fully, i will be trying to make it work server side.

i have always wondered  how 1 can tell what order to place things in the init.sqf file

whether to put

if(isDedicated)

if (isServer)

if(hasInterface)

if(!isDedicated && hasInterface) etc which to place first in the init.

only ah i use is the infistar

not using epochah at all.

as of right now in not getting any errors indicating any conflicts. but i will try a fresh mission file with just ras and the music files and see what happens

 

thanks again.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...