Jump to content
  • 0

A3 Server Side Music


tinboye

Question

So im trying to get music to play at random on my server. I can somewhat get it to play via client side, but the music files make the mission like 20+ mb

So i want to make it server side.

here is the code I have so far, but being that ive gotten it from other forums and originally was for arma 2, 2 functions are not working.

under @epochhive\addons I have my pbo file

ambients.pbo

in that pbo i have samples folder with my music ogg files

in the root of the pbo i have my init.sqf with the code

[spoiler]
if (!isDedicated) then {

private ["_sound","_length","_pause","_enableAmbient","_minWaitTime","_maxWaitTime","_musicArray","_waitTimeDifference","_randomWait"];

// Enable Ambient music? true/false
_enableAmbient = true;

	waitUntil {alive vehicle player};	
	waitUntil {typeOF player != "VirtualMan_EPOCH"};
	
 if (_enableAmbient) then {
        // Minimum amount of time before running the next track (in seconds)
        // Default for my script is 10 minutes. (600 seconds)
        // Must be less than the maximum wait time.
        _minWaitTime = 120;
 
        // Maximum amount of time before running the next track (in seconds)
        // Default for my script is 30 minutes. (1800 seconds)
        // Must be more than the maximum wait time.
        _maxWaitTime = 900;
 
        // The array of your ambient tracks. These must match the class of a
        // cfgMusic entry either in the default DayZ cfgMusic or Description.ext
        // In your Mission.pbo. (Example: class bombs)
        // It will choose a random track from this array.
		_musicArray = ["Misc_strange_wind","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"];
        
        // Pick a sound
        _sound = _musicArray select floor random count _musicArray;
   
        // Get it's length from the cfgMusic/Description.ext
        _length = getNumber(configFile >> "cfgMusic" >> _sound >> "Duration");
   
        // Lets figure out the random wait time
        _waitTimeDifference = ((_maxWaitTime) - (_minWaitTime));
        _randomWait = (random (_waitTimeDifference));
        _pause = (_randomWait) + (_length);
		
		// Play the song
        if (!r_player_unconscious and !r_pitchWhine) then {
            playMusic _sound;
        };   
   
        // Let the script sleep the song length and the random amount of time
        sleep _pause;

		};
		};

 

in my pbo file i also have my config.cpp with

 

 

class cfgMusic {
	tracks [] = {"Misc_strange_wind", "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"};

	class Misc_strange_wind {
		name = "Misc_strange_wind";
		sound [] = {"\ambients\samples\fx_misc4.ogg", 1.000000, 1.000000};
		duration = 25;
	};

	class stinger_0 {
		name = "stinger_0";
		sound [] = {"\ambients\samples\stinger_0.ogg", 1.000000, 1.000000};
		duration = 27;
	};

	class stinger_1 {
		name = "stinger_1";
		sound [] = {"\ambients\samples\stinger_1.ogg", 1.000000, 1.000000};
		duration = 19;
	};

	class suspense_0 {
		name = "suspense_0";
		sound [] = {"\ambients\samples\suspense_0.ogg", 1.000000, 1.000000};
		duration = 17;
	};

	class suspense_1 {
		name = "suspense_1";
		sound [] = {"\ambients\samples\suspense_1.ogg", 1.000000, 1.000000};
		duration = 13;
	};

	class suspense_2 {
		name = "suspense_2";
		sound [] = {"\ambients\samples\suspense_2.ogg", 1.000000, 1.000000};
		duration = 14;
	};

	class suspense_3 {
		name = "suspense_3";
		sound [] = {"\ambients\samples\suspense_3.ogg", 1.000000, 1.000000};
		duration = 16;
	};

	class suspense_4 {
		name = "suspense_4";
		sound [] = {"\ambients\samples\suspense_4.ogg", 1.000000, 1.000000};
		duration = 13;
	};

	class suspense_5 {
		name = "suspense_5";
		sound [] = {"\ambients\samples\suspense_5.ogg", 1.000000, 1.000000};
		duration = 15;
	};

	class suspense_6 {
		name = "suspense_6";
		sound [] = {"\ambients\samples\suspense_6.ogg", 1.000000, 1.000000};
		duration = 22;
	};

	class suspense_7 {
		name = "suspense_7";
		sound [] = {"\ambients\samples\suspense_7.ogg", 1.000000, 1.000000};
		duration = 17;
	};

	class suspense_8 {
		name = "suspense_8";
		sound [] = {"\ambients\samples\suspense_8.ogg", 1.000000, 1.000000};
		duration = 24;
	};

	class suspense_9 {
		name = "suspense_9";
		sound [] = {"\ambients\samples\suspense_9.ogg", 1.000000, 1.000000};
		duration = 18;
	};

	class suspense_10 {
		name = "suspense_10";
		sound [] = {"\ambients\samples\suspense_10.ogg", 1.000000, 1.000000};
		duration = 14;
	};

	class suspense_11 {
		name = "suspense_11";
		sound [] = {"\ambients\samples\suspense_11.ogg", 1.000000, 1.000000};
		duration = 15;
	};

	class suspense_12 {
		name = "suspense_12";
		sound [] = {"\ambients\samples\suspense_12.ogg", 1.000000, 1.000000};
		duration = 15;
	};

	class suspense_13 {
		name = "suspense_13";
		sound [] = {"\ambients\samples\suspense_13.ogg", 1.000000, 1.000000};
		duration = 12;
	};

	class suspense_14 {
		name = "suspense_14";
		sound [] = {"\ambients\samples\suspense_14.ogg", 1.000000, 1.000000};
		duration = 6;
	};

	class suspense_15 {
		name = "suspense_15";
		sound [] = {"\ambients\samples\suspense_15.ogg", 1.000000, 1.000000};
		duration = 23;
	};

	class suspense_16 {
		name = "suspense_16";
		sound [] = {"\ambients\samples\suspense_16.ogg", 1.000000, 1.000000};
		duration = 17;
	};

	class suspense_17 {
		name = "suspense_17";
		sound [] = {"\ambients\samples\suspense_17.ogg", 1.000000, 1.000000};
		duration = 28;
	};

	class suspense_18 {
		name = "suspense_18";
		sound [] = {"\ambients\samples\suspense_18.ogg", 1.000000, 1.000000};
		duration = 13;
	};

	class suspense_19 {
		name = "suspense_19";
		sound [] = {"\ambients\samples\suspense_19.ogg", 1.000000, 1.000000};
		duration = 17;
	};

	class suspense_20 {
		name = "suspense_20";
		sound [] = {"\ambients\samples\suspense_20.ogg", 1.000000, 1.000000};
		duration = 65;
	};

	class suspense_21 {
		name = "suspense_21";
		sound [] = {"\ambients\samples\suspense_21.ogg", 1.000000, 1.000000};
		duration = 89;
	};

	class suspense_22 {
		name = "suspense_22";
		sound [] = {"\ambients\samples\suspense_22.ogg", 1.000000, 1.000000};
		duration = 44;
	};

	class suspense_23 {
		name = "suspense_23";
		sound [] = {"\ambients\samples\suspense_23.ogg", 1.000000, 1.000000};
		duration = 59;
	};

	class suspense_24 {
		name = "suspense_24";
		sound [] = {"\ambients\samples\suspense_24.ogg", 1.000000, 1.000000};
		duration = 52;
	};

	class suspense_25 {
		name = "suspense_25";
		sound [] = {"\ambients\samples\suspense_25.ogg", 1.000000, 1.000000};
		duration = 52;
	};

	class suspense_26 {
		name = "suspense_26";
		sound [] = {"\ambients\samples\suspense_26.ogg", 1.000000, 1.000000};
		duration = 158;
	};

	class suspense_27 {
		name = "suspense_27";
		sound [] = {"\ambients\samples\suspense_27.ogg", 1.000000, 1.000000};
		duration = 130;
	};

	class suspense_28 {
		name = "suspense_28";
		sound [] = {"\ambients\samples\suspense_28.ogg", 1.000000, 1.000000};
		duration = 116;
	};

	class suspense_29 {
		name = "suspense_29";
		sound [] = {"\ambients\samples\suspense_29.ogg", 1.000000, 1.000000};
		duration = 129;
	};

	class suspense_30 {
		name = "suspense_30";
		sound [] = {"\ambients\samples\suspense_30.ogg", 1.000000, 1.000000};
		duration = 117;
	};

	class suspense_31 {
		name = "suspense_31";
		sound [] = {"\ambients\samples\suspense_31.ogg", 1.000000, 1.000000};
		duration = 33;
	};

	class suspense_32 {
		name = "suspense_32";
		sound [] = {"\ambients\samples\suspense_32.ogg", 1.000000, 1.000000};
		duration = 29;
	};

	class suspense_33 {
		name = "suspense_33";
		sound [] = {"\ambients\samples\suspense_33.ogg", 1.000000, 1.000000};
		duration = 14;
	};

	class suspense_34 {
		name = "suspense_34";
		sound [] = {"\ambients\samples\suspense_34.ogg", 1.000000, 1.000000};
		duration = 15;
	};

	class suspense_35 {
		name = "suspense_35";
		sound [] = {"\ambients\samples\suspense_35.ogg", 1.000000, 1.000000};
		duration = 20;
	};
};

 

in my mission init.sqf i call on the pbo's init.sqf

    execVM "\q\addons\ambients\init.sqf";

am I forgetting anything?

and finally 

	// Play the song
        if (!r_player_unconscious and !r_pitchWhine) then {
            playMusic _sound;
        }; 

instead of 

(!r_player_unconscious and !r_pitchWhine)  what would you recommend i use as a trigger? this is what is used in arma 2, but could not find these in arma 3 epoch code anywhere.
Edited by tinboye
Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 1

You realize that you now use my original way of work at this?

I don´t know why u dont get my script running, but what bugs me is the fact why the "nice" community is going down.

No thank-you, only take take take.

What im trying to say is, i have no problem with this and maybe you bring it a way better as mine, but then you should at least name/credit the creator of the original idea, in this case me.

I hope you understand what i want to say.

cheers

 

btw: u dont can do that fully serverside. Every client needs the soundfiles. You could just do it with eventhandlers or something, but the soundfiles has to be in the missionfile.

Link to comment
Share on other sites

  • 0

the code above is actually from the arma 2 dayz code, source is from

http://opendayz.net/threads/tutorial-custom-ambient-music-serverside.15208/

Vampire's Better Ambient Music v1

so if this is you, i apologize. 

I appreciate you helping me with your script, i just cannot get it to work, maybe another script is conflicting, i do not know. I hear 1 sound file, then nothing. 

I run a private server which i run off my own rig. couple friends play on it, thats it.

Im not taking credit for anything, i just want my server to have music whille we play. not just listen to the birds chirp and all that.

I made a pbo with the sound files, then all players include that pbo in their launch

that way it should call for the sound files.

or am i wrong?

i just do not want a player to have to sit there for 1-2 min to load a 20mb mission file.

the problem i am having now is i'm getting an error when i run the server:

Error context ] = {"\x\addons\samples\fx_misc4.ogg", db+0, 1.0};
Warning Message: File mpmissions\epoch.Altis\addons\music.hpp, line 5: '/cfgMusic/CfgMusic/Misc_strange_wind.sound': '[' encountered instead of '='
Warning Message: Config : some input after EndOfFile.

class CfgMusic 
{ 
	class Misc_strange_wind {
		name = "Misc_strange_wind";
		sound [] = {"\x\addons\samples\fx_misc4.ogg", db+0, 1.0};
		duration = 25;
		titles[] = {};
	};

	class stinger_0 {
		name = "stinger_0";
		sound [] = {"\x\addons\ambients\samples\stinger_0.ogg", db+0, 1.0};
		duration = 27;
		titles[] = {};
	};

	class stinger_1 {
		name = "stinger_1";
		sound [] = {"\x\addons\samples\stinger_1.ogg", db+0, 1.0};
		duration = 19;
		titles[] = {};
	};

	class suspense_0 {
		name = "suspense_0";
		sound [] = {"\x\addons\samples\suspense_0.ogg", db+0, 1.0};
		duration = 17;
		titles[] = {};
	};

	class suspense_1 {
		name = "suspense_1";
		sound [] = {"\x\addons\samples\suspense_1.ogg", db+0, 1.0};
		duration = 13;
		titles[] = {};
	};

	class suspense_2 {
		name = "suspense_2";
		sound [] = {"\x\addons\samples\suspense_2.ogg", db+0, 1.0};
		duration = 14;
		titles[] = {};
	};

	class suspense_3 {
		name = "suspense_3";
		sound [] = {"\x\addons\samples\suspense_3.ogg", db+0, 1.0};
		duration = 16;
		titles[] = {};
	};

	class suspense_4 {
		name = "suspense_4";
		sound [] = {"\x\addons\samples\suspense_4.ogg", db+0, 1.0};
		duration = 13;
		titles[] = {};
	};

	class suspense_5 {
		name = "suspense_5";
		sound [] = {"\x\addons\samples\suspense_5.ogg", db+0, 1.0};
		duration = 15;
		titles[] = {};
	};

	class suspense_6 {
		name = "suspense_6";
		sound [] = {"\x\addons\samples\suspense_6.ogg", db+0, 1.0};
		duration = 22;
		titles[] = {};
	};

	class suspense_7 {
		name = "suspense_7";
		sound [] = {"\x\addons\samples\suspense_7.ogg", db+0, 1.0};
		duration = 17;
		titles[] = {};
	};

	class suspense_8 {
		name = "suspense_8";
		sound [] = {"\x\addons\samples\suspense_8.ogg", db+0, 1.0};
		duration = 24;
		titles[] = {};
	};

	class suspense_9 {
		name = "suspense_9";
		sound [] = {"\x\addons\samples\suspense_9.ogg", db+0, 1.0};
		duration = 18;
		titles[] = {};
	};

	class suspense_10 {
		name = "suspense_10";
		sound [] = {"\x\addons\samples\suspense_10.ogg", db+0, 1.0};
		duration = 14;
		titles[] = {};
	};

	class suspense_11 {
		name = "suspense_11";
		sound [] = {"\x\addons\samples\suspense_11.ogg", db+0, 1.0};
		duration = 15;
		titles[] = {};
	};

	class suspense_12 {
		name = "suspense_12";
		sound [] = {"\x\addons\samples\suspense_12.ogg", db+0, 1.0};
		duration = 15;
		titles[] = {};
	};

	class suspense_13 {
		name = "suspense_13";
		sound [] = {"\x\addons\samples\suspense_13.ogg", db+0, 1.0};
		duration = 12;
		titles[] = {};
	};

	class suspense_14 {
		name = "suspense_14";
		sound [] = {"\x\addons\samples\suspense_14.ogg", db+0, 1.0};
		duration = 6;
		titles[] = {};
	};

	class suspense_15 {
		name = "suspense_15";
		sound [] = {"\x\addons\samples\suspense_15.ogg", db+0, 1.0};
		duration = 23;
		titles[] = {};
	};

	class suspense_16 {
		name = "suspense_16";
		sound [] = {"\x\addons\samples\suspense_16.ogg", db+0, 1.0};
		duration = 17;
		titles[] = {};
	};

	class suspense_17 {
		name = "suspense_17";
		sound [] = {"\x\addons\samples\suspense_17.ogg", db+0, 1.0};
		duration = 28;
		titles[] = {};
	};

	class suspense_18 {
		name = "suspense_18";
		sound [] = {"\x\addons\samples\suspense_18.ogg", db+0, 1.0};
		duration = 13;
		titles[] = {};
	};

	class suspense_19 {
		name = "suspense_19";
		sound [] = {"\x\addons\samples\suspense_19.ogg", db+0, 1.0};
		duration = 17;
		titles[] = {};
	};

	class suspense_20 {
		name = "suspense_20";
		sound [] = {"\x\addons\samples\suspense_20.ogg", db+0, 1.0};
		duration = 65;
		titles[] = {};
	};

	class suspense_21 {
		name = "suspense_21";
		sound [] = {"\x\addons\samples\suspense_21.ogg", db+0, 1.0};
		duration = 89;
		titles[] = {};
	};

	class suspense_22 {
		name = "suspense_22";
		sound [] = {"\x\addons\samples\suspense_22.ogg", db+0, 1.0};
		duration = 44;
		titles[] = {};
	};

	class suspense_23 {
		name = "suspense_23";
		sound [] = {"\x\addons\samples\suspense_23.ogg", db+0, 1.0};
		duration = 59;
		titles[] = {};
	};

	class suspense_24 {
		name = "suspense_24";
		sound [] = {"\x\addons\samples\suspense_24.ogg", db+0, 1.0};
		duration = 52;
		titles[] = {};
	};

	class suspense_25 {
		name = "suspense_25";
		sound [] = {"\x\addons\samples\suspense_25.ogg", db+0, 1.0};
		duration = 52;
		titles[] = {};
	};

	class suspense_26 {
		name = "suspense_26";
		sound [] = {"\x\addons\samples\suspense_26.ogg", db+0, 1.0};
		duration = 158;
		titles[] = {};
	};

	class suspense_27 {
		name = "suspense_27";
		sound [] = {"\x\addons\samples\suspense_27.ogg", db+0, 1.0};
		duration = 130;
		titles[] = {};
	};

	class suspense_28 {
		name = "suspense_28";
		sound [] = {"\x\addons\samples\suspense_28.ogg", db+0, 1.0};
		duration = 116;
		titles[] = {};
	};

	class suspense_29 {
		name = "suspense_29";
		sound [] = {"\x\addons\samples\suspense_29.ogg", db+0, 1.0};
		duration = 129;
		titles[] = {};
	};

	class suspense_30 {
		name = "suspense_30";
		sound [] = {"\x\addons\samples\suspense_30.ogg", db+0, 1.0};
		duration = 117;
		titles[] = {};
	};

	class suspense_31 {
		name = "suspense_31";
		sound [] = {"\x\addons\samples\suspense_31.ogg", db+0, 1.0};
		duration = 33;
		titles[] = {};
	};

	class suspense_32 {
		name = "suspense_32";
		sound [] = {"\x\addons\samples\suspense_32.ogg", db+0, 1.0};
		duration = 29;
		titles[] = {};
	};

	class suspense_33 {
		name = "suspense_33";
		sound [] = {"\x\addons\samples\suspense_33.ogg", db+0, 1.0};
		duration = 14;
		titles[] = {};
	};

	class suspense_34 {
		name = "suspense_34";
		sound [] = {"\x\addons\samples\suspense_34.ogg", db+0, 1.0};
		duration = 15;
		titles[] = {};
	};

	class suspense_35 {
		name = "suspense_35";
		sound [] = {"\x\addons\samples\suspense_35.ogg", db+0, 1.0};
		duration = 20;
		titles[] = {};
	};
};

according to bohemia description.ext

this is the proper format:

class CfgMusic
{
	tracks[]={};

	class MarsIntro
	{
		name = "";
		sound[] = {"\music\filename.ogg", db+0, 1.0};
	};
	class Ludwig9
	{
		name = "";
		sound[] = {"\music\filename.ogg", db+10, 1.0};
	};
};

 

in my description.ext i have

class cfgMusic{ 

 tracks[]={};

#include "addons\music.hpp"   
    class intro 
    {  
        name = "intro";
        sound[] = {"music\IntroSong.ogg",1.0,1.0}; 
  };
      };

 

Link to comment
Share on other sites

  • 0

So, if this is from Arma 2 then i didnt say anything, sorry.

Like i said, i dont understand why this isnt running at your server, i tested it many times and it works great. Surely the code could be better, but i have no time for this atm.

 

To your problem now:

If you put the soundfiles in a pbo which all players have, it "should" working but i dont can say it for sure. What i know is that the soundfiles have to be in the missionfile because a serverside sync of music to every client isnt possible as far as i know.

 

You include a .hpp file at this point:

class cfgMusic{ 
 tracks[]={};
#include "addons\music.hpp"   
    class intro 
    {  
        name = "intro";
        sound[] = {"music\IntroSong.ogg",1.0,1.0}; 
  };
      };
[/code]

Thats no problem at all, but from what i understand of your post is that you have defined in this .hpp file (music.hpp) another class CfgMusic.

Remove the CfgMusic line and the last bracket from the music.hpp.

 

cheers

Link to comment
Share on other sites

  • 0

i figured out the error, 

i had

sound [] =

not 

sound[] =

game loads now. the music does not have to sync the same for every player. I just want the music to play randomly.

if you look at the original dayz.sfx.pbo, it contains the ambient sounds and a config.bin with class files of each ogg file 

in the mission file it has a compiles.sqf with

player_music =  compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_music.sqf";            //Used to generate ambient music

so i do not see why a person could not have the player within a pbo with the sound files

that every player would enable via -mods=@ambients;

then within the mission file it would call via compile preprocessFileLineNumbers "\z\addons\ambients\player_music.sqf";

there is a players_monitor.fsm which has a code of [] spawn player_music; which i would guess this calls for the compile.

there is also a music.fsm 

Link to comment
Share on other sites

  • 0

so maybe you can spot what the issue is:

here is my init.sqf  i get no errors regarding this scrip, or my hpp file, nothing in infistar logs either that i can spot.

//////////////////////////////////////////////////
//[] execVM "andre_safezone.sqf";
[] execVM "trader\init.sqf";
[] execVM "trader\HALV_takegive_crypto_init.sqf";
[] execVM "trader\resetvehicleammo.sqf";
[] execVM "addons\messages\init.sqf";
[] execVM "onPlayerRespawn.sqf";
[] execVM "addons\safezone.sqf";
[] execVM "addons\welcome.sqf";
[] execVM "addons\OX3_Heli_Protect_FloorSpawn.sqf";
[] execVM "addons\OX3_GetInProtect.sqf";
[] execVM "addons\Drain.sqf";
[] execVM "R3F_LOG\init.sqf";
call compile preProcessFileLineNumbers "addons\cmEarplugs\config.sqf";
call compile preProcessFileLineNumbers "addons\DPRealHealth\DP_Real_Health.sqf";
//////////////////////////////////////////////////
//Missions
#include "start_blck.sqf";
[] execVM "andre_convoy.sqf";
#include "A3EAI_Client\A3EAI_initclient.sqf";
[] execVM "wai\remote.sqf";
//////////////////////////////////////////////////
// Control the epoch ai limit per player
// 1. Epoch_Cloak_F = Cultist
// 2. GreatWhite_F = Great White Shark
// 3. Epoch_Sapper_F = Regular Sapper
// 4. Epoch_SapperB_F = Super Sapper (dark)
// 5. I_UAV_01_F = UAV (that spawns the AI)
// 6. PHANTOM = Invisible phantom 
// 7. B_Heli_Transport_01_F = Transport helicopter for the mission system

EPOCH_spawnLimits = [3, 1, 2, 1, 0, 0, 0];
//////////////////////////////////////////////////
if(isDedicated)exitWith{};
cabcost = 50; //change this to change to cost of the cab
[] execVM "Taxis\player_cab.sqf";
//////////////////////////////////////////////////
if (isServer) then {
[] execVM "addons\SPK_RAS\RAS_init.sqf";
[] execVM "\q\addons\traderATMs\init.sqf";
};

//////////////////////////////////////////////////
if(hasInterface) then{
[] execVM "addons\service_point\service_point.sqf";
[] execVM "addons\paintshop\paintshop.sqf";
[] execVM "addons\briefing.sqf";
[] execVM "addons\sdropClient.sqf";
[] execVM "addons\InventoryOpened.sqf";
[] execVM "addons\actual.sqf";
};
//////////////////////////////////////////////////
if(!isDedicated && hasInterface)then{
[] execVM "addons\SPK_RAS\RAS_init.sqf";
};
//////////////////////////////////////////////////
if (isNil "creation_Factory_Container") then {
    creation_Factory_Container = createVehicle ["Box_IND_AmmoVeh_F", [13326.247,2.2928343,14546.686], [6181.6841,83.907509,16876.732], [18461.789,24.769226,14300.033] 0, "CAN_COLLIDE"];
    publicVariable "creation_Factory_Container";
};
[creation_Factory_Container] execVM "R3F_LOG\USER_FUNCT\init_creation_factory.sqf";

my description.ext

////////////////////////////////////////////////
class CfgMusic /////////////////////////////////
////////////////////////////////////////////////
{
#include "addons\music.hpp"
	class intro 
	{  
		name = "intro";
		sound[] = {"music\IntroSong.ogg",1.0,1.0}; 
    };
};

 

my music.hpp

class CfgMusic 
{
	class fxmisc
	{
		name = "fxmisc";
		sound[] = {"music\fxmisc4.ogg", db+0, 1.0};
		duration = 25;
		titles[] = {};
	};

	class stinger0 
	{
		name = "stinger0";
		sound[] = {"music\stinger0.ogg", db+0, 1.0};
		duration = 27;
		titles[] = {};
	};

	class stinger1 
	{
		name = "stinger1";
		sound[] = {"music\stinger1.ogg", db+0, 1.0};
		duration = 19;
		titles[] = {};
	};

	class suspense0 
	{
		name = "suspense0";
		sound[] = {"music\suspense0.ogg", db+0, 1.0};
		duration = 17;
		titles[] = {};
	};

	class suspense1 
	{
		name = "suspense1";
		sound[] = {"music\suspense1.ogg", db+0, 1.0};
		duration = 13;
		titles[] = {};
	};

	class suspense2 
	{
		name = "suspense2";
		sound[] = {"music\suspense2.ogg", db+0, 1.0};
		duration = 14;
		titles[] = {};
	};

	class suspense3 
	{
		name = "suspense3";
		sound[] = {"music\suspense3.ogg", db+0, 1.0};
		duration = 16;
		titles[] = {};
	};

	class suspense4 
	{
		name = "suspense4";
		sound[] = {"music\suspense4.ogg", db+0, 1.0};
		duration = 13;
		titles[] = {};
	};

	class suspense5 
	{
		name = "suspense5";
		sound[] = {"music\suspense5.ogg", db+0, 1.0};
		duration = 15;
		titles[] = {};
	};

	class suspense6 
	{
		name = "suspense6";
		sound[] = {"music\suspense6.ogg", db+0, 1.0};
		duration = 22;
		titles[] = {};
	};

	class suspense7 
	{
		name = "suspense7";
		sound[] = {"music\suspense7.ogg", db+0, 1.0};
		duration = 17;
		titles[] = {};
	};

	class suspense8 
	{
		name = "suspense8";
		sound[] = {"music\suspense8.ogg", db+0, 1.0};
		duration = 24;
		titles[] = {};
	};

	class suspense9 
	{
		name = "suspense9";
		sound[] = {"music\suspense9.ogg", db+0, 1.0};
		duration = 18;
		titles[] = {};
	};

	class suspense10 {
		name = "suspense10";
		sound[] = {"music\suspense10.ogg", db+0, 1.0};
		duration = 14;
		titles[] = {};
	};

	class suspense11 
	{
		name = "suspense11";
		sound[] = {"music\suspense11.ogg", db+0, 1.0};
		duration = 15;
		titles[] = {};
	};

	class suspense12 
	{
		name = "suspense12";
		sound[] = {"music\suspense12.ogg", db+0, 1.0};
		duration = 15;
		titles[] = {};
	};

	class suspense13 
	{
		name = "suspense13";
		sound[] = {"music\suspense13.ogg", db+0, 1.0};
		duration = 12;
		titles[] = {};
	};

	class suspense14 
	{
		name = "suspense14";
		sound[] = {"music\suspense14.ogg", db+0, 1.0};
		duration = 6;
		titles[] = {};
	};

	class suspense15 
	{
		name = "suspense15";
		sound[] = {"music\suspense15.ogg", db+0, 1.0};
		duration = 23;
		titles[] = {};
	};

	class suspense16 
	{
		name = "suspense16";
		sound[] = {"music\suspense16.ogg", db+0, 1.0};
		duration = 17;
		titles[] = {};
	};

	class suspense17 
	{
		name = "suspense17";
		sound[] = {"music\suspense17.ogg", db+0, 1.0};
		duration = 28;
		titles[] = {};
	};

	class suspense18 
	{
		name = "suspense18";
		sound[] = {"music\suspense18.ogg", db+0, 1.0};
		duration = 13;
		titles[] = {};
	};

	class suspense19 
	{
		name = "suspense19";
		sound[] = {"music\suspense19.ogg", db+0, 1.0};
		duration = 17;
		titles[] = {};
	};

	class suspense20 
	{
		name = "suspense20";
		sound[] = {"music\suspense20.ogg", db+0, 1.0};
		duration = 65;
		titles[] = {};
	};

	class suspense21 
	{
		name = "suspense21";
		sound[] = {"music\suspense21.ogg", db+0, 1.0};
		duration = 89;
		titles[] = {};
	};

	class suspense22 
	{
		name = "suspense22";
		sound[] = {"music\suspense22.ogg", db+0, 1.0};
		duration = 44;
		titles[] = {};
	};

	class suspense23 
	{
		name = "suspense23";
		sound[] = {"music\suspense23.ogg", db+0, 1.0};
		duration = 59;
		titles[] = {};
	};

	class suspense24 
	{
		name = "suspense24";
		sound[] = {"music\suspense24.ogg", db+0, 1.0};
		duration = 52;
		titles[] = {};
	};

	class suspense25 
	{
		name = "suspense25";
		sound[] = {"music\suspense25.ogg", db+0, 1.0};
		duration = 52;
		titles[] = {};
	};

	class suspense26 
	{
		name = "suspense26";
		sound[] = {"music\suspense26.ogg", db+0, 1.0};
		duration = 158;
		titles[] = {};
	};

	class suspense27 
	{
		name = "suspense27";
		sound[] = {"music\suspense27.ogg", db+0, 1.0};
		duration = 130;
		titles[] = {};
	};

	class suspense28 
	{
		name = "suspense28";
		sound[] = {"music\suspense28.ogg", db+0, 1.0};
		duration = 116;
		titles[] = {};
	};

	class suspense29 
	{
		name = "suspense29";
		sound[] = {"music\suspense29.ogg", db+0, 1.0};
		duration = 129;
		titles[] = {};
	};

	class suspense30 
	{
		name = "suspense30";
		sound[] = {"music\suspense30.ogg", db+0, 1.0};
		duration = 117;
		titles[] = {};
	};

	class suspense31 
	{
		name = "suspense31";
		sound[] = {"music\suspense31.ogg", db+0, 1.0};
		duration = 33;
		titles[] = {};
	};

	class suspense32 
	{
		name = "suspense32";
		sound[] = {"music\suspense32.ogg", db+0, 1.0};
		duration = 29;
		titles[] = {};
	};

	class suspense33 
	{
		name = "suspense33";
		sound[] = {"music\suspense33.ogg", db+0, 1.0};
		duration = 14;
		titles[] = {};
	};

	class suspense34 
	{
		name = "suspense34";
		sound[] = {"music\suspense34.ogg", db+0, 1.0};
		duration = 15;
		titles[] = {};
	};

	class suspense35 
	{
		name = "suspense35";
		sound[] = {"music\suspense35.ogg", db+0, 1.0};
		duration = 20;
		titles[] = {};
	};
};

my ras_init.sqf

/*    *    *    *    *    *    *    *    *    *    *    *    *    */
/*	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;
		}]
	}
};

my ras_play.sqf

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 = rasTracks 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 = rasTracks call BIS_fnc_selectRandom;
		playSound _rndTrck;
		if(_cfgSndTdone)then[{
			rasIsPlaying = false;
			rasNext = true;
			_cfgSndTdone = false;
		},{
			waitUntil{_cfgSndTdone};
			rasIsPlaying = false;
			rasNext = true;
			_cfgSndTdone = false;
		}]
	}]
};

my RAS_settings.sqf

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

rasTracks = ["Miscstrangewind","stinger0","stinger1","suspense0","suspense1","suspense2","suspense3","suspense4","suspense5","suspense6","suspense7","suspense8","suspense9","suspense10","suspense11","suspense12","suspense13","suspense14","suspense15","suspense16","suspense17","suspense18","suspense19","suspense20","suspense21","suspense22","suspense23","suspense24","suspense25","suspense26","suspense27","suspense28","suspense29","suspense30","suspense31","suspense32","suspense33","suspense34","suspense35"];

_minGap = 	1; 		//(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

thanks again

Link to comment
Share on other sites

  • 0

I repeat myself again:

 

description.ext:

tracks[] = {}; is missing...

music.hpp:

Remove "CfgMusic" line and last bracket...

 

init.sqf:

I cant remember that i did a install instruction for set this serverside...

 

//wrong
if (isServer) then {
[] execVM "addons\SPK_RAS\RAS_init.sqf";

 

  //right
if(!isDedicated && hasInterface)then{
execVM "addons\SPK_RAS\RAS_init.sqf"; 
};

 

Incidentally you call it twice, one time serverside and one time client side... Remove the serverside part of RAS.

 

Btw: The code-order in your init.sqf is a doom.

if (isDedicated) then { //run on dedicated server only };

if (isServer) then { //run on dedicated server or player host };

if (hasInterface) then { //run on all player clients incl. player host };

if (!isDedicated) then { //run on all player clients incl. player host and headless clients };

if (!isServer) then { //run on all player clients incl. headless clients but not player host };

if (!hasInterface) then { //run on headless clients and dedicated server };

if (!hasInterface && !isDedicated) then { //run on headless clients only };

 

Hope this helps...

cheers

Link to comment
Share on other sites

  • 0

im not running a headless client. so i do not see how the last 1 would work.

 

description.ext:

tracks[] = {}; is missing...

music.hpp:

Remove "CfgMusic" line and last bracket...

i will check this out, it use to not matter, i do not get any errors.

but i will try this out.

thank you

 

 

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...