Jump to content
  • 0
Sign in to follow this  
bombajack

Ambient sound

Question

Anybody have an idea how to make ambient sound as A2?

Randomly selected track on the background of the game ..?

 

Must be on server side,because it would be mission files too big...

 

 

Thanks to all scripters ;)

 

 

 

Share this post


Link to post
Share on other sites

19 answers to this question

Recommended Posts

  • 0

Impossible...

At least serverside because every player needs the soundfile(s) to here it.

Sounds and Pictures have to be placed in missionfile, same as vehicle textures and so on.

Share this post


Link to post
Share on other sites
  • 0

Impossible...

At least serverside because every player needs the soundfile(s) to here it.

Sounds and Pictures have to be placed in missionfile, same as vehicle textures and so on.

 

 

Then how to do on Missionfile?

Share this post


Link to post
Share on other sites
  • 0

//description.ext:
class CfgSounds {
    sounds[] = {};
    class track1 {
        name = "track1";
        sound[] = {"track1.ogg", 1.0, 1};
        titles[] = {};
    };
    class track2 {
        name = "track2";
        sound[] = {"track2.ogg", .8, 1};
        titles[] = {};
    };
    class track3 {
        name = "track3";
        sound[] = {"track3.ogg", 1.0, 1};
        titles[] = {};
    };    
};

//or you can use CfgMusic (keep in mind, for this the player have to activate his music volume at ingame options to here anything)
class CfgMusic {
    tracks[]={};
    class track1 {
        name = "track1";
        sound[] = {"track1.ogg", db+0, 1.0};
    };
    class track2 {
        name = "track2";
        sound[] = {"track2.ogg", db+0, 1.0};
    };
    class track3 {
        name = "track3";
        sound[] = {"track3.ogg", db+0, 1.0};
    };
};

//the sqf from where to start the sounds:
private "_tracks";
_tracks = ["track1","track2","track3"] call BIS_fnc_selectRandom;
playSound _tracks;
//or
playMusic _tracks;

 

Untested, but it should works this way.

cheers

 

 

btw: no need to quote a message directly after itself. :)

Share this post


Link to post
Share on other sites
  • 0

yes from init.sqf, but best thing is, tell me, "how" you want to play this stuff ? Explain a bit excactlier...

 

In my example it would run only one track at one server period.

It should be only an example ;)

Share this post


Link to post
Share on other sites
  • 0

Sure i know it, but i don´t can remember the ambient sound stuff :) It´s a long time ago...

I could write you something like your wish but i have to say i dont can give you predictions for the performance because i should use some waitUntils or sleep commands to get this working. Perhaps i find a better way, but also then i don´t can say anything about the performance. You can only give it a try.

 

 

I would use playSound for this because this is hearable for everyone (it doesnt matter if the players music volume is activated or not), but with playSound you dont can interrupt the music playing... Only that u know.

<_<

Share this post


Link to post
Share on other sites
  • 0

Test this one, but its untested and i give no warranty if it works:

 

//the sqf from where to start the ambient:

private["_tracks","_minGap","_maxGap"];
_tracks = ["track1","track2","track3"]; //insert the "names" of the soundfiles you described in description.ext "without" file-extension
_minGap = 3; //number in minutes of the smallest gap between the tracks //DON´T USE A SMALLER NUMBER THAN THE SHORTEST SOUNDLENGTH!!!
_maxGap = 10; //number in minutes of the longest gap between the tracks

/******* dont edit below ********/
private["_minT","_maxT","_rndT"];
_minT = (_minGap *60);
_maxT = (_maxGap *60);
_rndT = round(random _maxT) _minT;

while{true}do{
    _rndTrck = _tracks call BIS_fnc_selectRandom;
    playSound _rndTrck;
    sleep _rndT; //perhaps use of uiSleep is possible
};

 

Surely anybody else have a better way to do this, but this is my attempt in a few minutes :P

 

Give response about functionality please, cheers

Share this post


Link to post
Share on other sites
  • 0

Test this one, but its untested and i give no warranty if it works:

//the sqf from where to start the ambient:

private["_tracks","_minGap","_maxGap"];
_tracks = ["track1","track2","track3"]; //insert the "names" of the soundfiles you described in description.ext "without" file-extension
_minGap = 3; //number in minutes of the smallest gap between the tracks //DON´T USE A SMALLER NUMBER THAN THE SHORTEST SOUNDLENGTH!!!
_maxGap = 10; //number in minutes of the longest gap between the tracks

/******* dont edit below ********/
private["_minT","_maxT","_rndT"];
_minT = (_minGap *60);
_maxT = (_maxGap *60);
_rndT = round(random _maxT) _minT;

while{true}do{
    _rndTrck = _tracks call BIS_fnc_selectRandom;
    playSound _rndTrck;
    sleep _rndT; //perhaps use of uiSleep is possible
};

Surely anybody else have a better way to do this, but this is my attempt in a few minutes :P

 

Give response about functionality please, cheers

doesnt work for me

i called the sounds from a custom pbo but path should be set correctly

Share this post


Link to post
Share on other sites
  • 0

custom pbo... serverside ?

If yes, then look at post #2.

 

The script itself i will test later, then i give response if it works :)

 

EDIT:

Correct, it fails...

Actually work in progress, i post the finished script if im done....

 

EDIT 2:

It´s running, i will post a tutorial in a few minutes :D

Share this post


Link to post
Share on other sites
  • 0

custom pbo... serverside ?

If yes, then look at post #2.

 

The script itself i will test later, then i give response if it works :)

 

EDIT:

Correct, it fails...

Actually work in progress, i post the finished script if im done....

 

EDIT 2:

It´s running, i will post a tutorial in a few minutes :D

 

 

You are simply the best :D

Share this post


Link to post
Share on other sites
  • 0

Use playMusic (so players have control over the volume and/or can turn it off) and work with the appropriate musicEventHandlers for it https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#addMusicEventHandler

 

@READTHESCROLL

There are better ways to get the terrain & surroundings, without triggers.

Look how it is done in mods like JSRS.

 

Greez Kilo

Share this post


Link to post
Share on other sites
  • 0

yes, playMusic would be a better way to change sounds etc... because they can forced to stop, which isnt possible with playSound until you use an attached object to the player.

 

_____________________________________________________________

Because my release threat is still in checking, i will post the github link here for now:

 

https://github.com/SPKcoding/SPK_RAS

 

Updates will come...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...