Jump to content
  • 0

Ambient music? Like DayZ Arma2


unerground2

Question

17 answers to this question

Recommended Posts

  • 0

Music requires a special config entry called CfgMusic.  This can be defined in the Description.ext or a config.cpp / and included .hpp file.

 

This entry defines what name the music will be referenced as in the SQF code and where the music track is located (the track must be .ogg).

 

You can then use the playMusic command in SQF files to play the music defined in the CfgMusic class.

 

You could also look at the addMusicEventHandler which can be set to fire on music stop so you could have it then select another track to play.

 

The .ogg files need to be on any client that is asked to play the as ARMA does not stream the music over the network.

Link to comment
Share on other sites

  • 0

SO.

 

ive tried to make my first kinda script thing.

 

but like i expected it doesnt work.

 

what i did is.

 

Description.ext

class CfgMusic
{
	tracks[]={r1,r2};

	class sound1
	{
		name = "r1";
		sound[] = {"r1.ogg", db+5, 1.0};
	};
	class sound2
	{
		name = "r2";
		sound[] = {"r2.ogg", db+5, 1.0};
	};
};

init.sqf

execVM "music.sqf";

music.sqf

playMusic ["r1", 1];

it doesnt work so.

 

the music file r1 and r2.ogg are in the root of my mission.pbo

Link to comment
Share on other sites

  • 0

Client side report is located at C:\Users\[YOUR WINDOWS LOGIN ID]\AppData\Local\Arma 3

 

For 20 tracks, make 20 class entries like you have for sound1 etc.

 

Then put the config entry names in to an array.

_jukeBox = ["song1","song2"];  // etc for all 20 song names

To select a random song

_nextSong = _jukeBox call BIS_fnc_selectRandom; 
playMusic [_nextSong, 1];

Make sure you define the variables in a private line at the top of any scripts those variables are used in.

Private ["_jukeBox","_nextSong"]; // include all variables you are using in the script
Link to comment
Share on other sites

  • 0

Allright made some progress.

 

RPT

19:23:43 Starting mission:
19:23:43  Mission file: music%20test
19:23:43  Mission world: Stratis
19:23:43  Mission directory: D:\Eigene Dateien\Documents\Arma 3 - Other Profiles\myprofilename\missions\music%20test.Stratis\
19:23:43 EPE manager release (0|0|0)
19:23:43 EPE manager release (0|0|0)
19:23:43 EPE manager release (0|0|0)
19:23:43 EPE manager release (0|0|0)
19:23:44 Attempt to override final function - bis_functions_list
19:23:44 Attempt to override final function - bis_functions_listpreinit
19:23:44 Attempt to override final function - bis_functions_listpostinit
19:23:44 Attempt to override final function - bis_functions_listrecompile
19:23:45 Attempt to override final function - bis_fnc_missiontaskslocal
19:23:45 Attempt to override final function - bis_fnc_missionconversationslocal
19:23:45 Attempt to override final function - bis_fnc_missionflow
19:23:46 Music song2 not found
19:23:46 No owner
19:23:48 No owner
19:23:49 No owner

music.sqf

Private ["_jukeBox","_nextSong"];
_jukeBox = ["song1","song2"];
_nextSong = _jukeBox call BIS_fnc_selectRandom; 
playMusic [_nextSong, 1];

description.ext

class CfgMusic
{
	tracks[]={"song1","song2"};

	class song1
	{
		name = "";
		sound[] = {"\music\song1.ogg", db+5, 1.0};
	};
	
	class song2
	{
		name = "";
		sound[] = {"\music\song2.ogg", db+5, 1.0};
	};
};

song1.ogg and song2.ogg are located in a music folder inside the mission.pbo 

it says cant find song2 but song 1 doesnt play to.

 

Whats causing this problem?

Link to comment
Share on other sites

  • 0

 

Replace 

playMusic [_nextSong, 1];

with

playMusic _nextSong;

 

Shouldn't make a difference to the current issue.  It just controls the point in the track to start from (1 sec in in this case unless the track is only 1 sec long) :) .  It is not needed though unless the song should start 1 sec in (to cut out a long intro or somthing like that).

 

@unerground2

 

I believe the issue is that it cannot find the music tracks (as stated in the error messages).  What prefix does your pbo file have ?.  You need to use that prefix + path in the PBO file to reference the song.

 

i.e.

 

If your PBO has a prefix of '\music' and the files are in a music_file directory in the PBO then the reference would be '\music\music_files\song1.ogg'.

 

What tool are you using to create the pbo file ?.

Link to comment
Share on other sites

  • 0

isnt there an already premade script out there?

 

haha, we are trying you help u and u are asking like if there was 1000s of other people's free work . and you suppose there would be one that u want. help us help u create this simple script. 

 

only way to make this happen is to answer rimblocks question or go somewhere else to look for this premade script

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
  • Discord

×
×
  • Create New...