Forum Jump :

Author Message


Posts: 12
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2013-04-15 14:21        
     
So the "On Act." field of a trigger has this in it:
PlayMusic "bs";
problem is, I want the song to play regardless of what happens. Whenever radio chatter occurs (i.e. "enemy spotted") the music cuts out and stops completely. Needless to say, this kills the drama. I've searched around to the best of my ability for the past 1-2 hours, but haven't been able to find out how to have music play without interruption. Please help!


Author Message

O.K  



Posts: 27
Rank:


Level: Member

Country: se
Location:
Occupation:
Age:
In-game name:

 
#2 Posted at 2013-04-15 17:24        
     
Use sounds instead of music.

Create the files you want to play into 16-bit, 44100 hz, mono, .ogg files and place them in your mission folder. For less cluttering make a new folder inside the mission folder in this case it's \sounds\

Add this to your description.ext

class CfgSounds
{

sounds[] = {sound1,sound2,sound3};

class sound1
{
name = "name1";
sound[] = {"\sounds\filename1.ogg", db -0.2, 1.0};
titles[] = {};
};

class sound2
{
name = "name2";
sound[] = {"\sounds\filename2.ogg", db -0.1, 0.8};
titles[] = {};
}; 

class sound3
{
name = "name3";
sound[] = {"\sounds\filename3", db +1, 1.0};
titles[] = {};
};

class sound3 //this is the name used in the editor
{
name = "name3"; //name of the sound
sound[] = {"\sounds\filename3", db +1, 1.0}; // "soundfile location", volume, speed
titles[] = {};

In the On Act of the trigger or object (there's more arrays for the playsound, check the BIS Wiki):
playsound "sound2"; 

This post was edited by O.K (2013-04-15 17:42, ago)


Advertisement


Author Message


Posts: 12
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2013-04-16 03:56        
     
# O.K : Use sounds instead of music.
Thank you O.K.
I actually did try using sounds instead of music, you're right, they don't stop playing... but I should have added that I have one song playing, which I then want to stop when the next song is triggered. With music, this happens automatically, but with sounds they seem to just overlap. I tried messing with soundVolume and fadeMusic, which I found out just mutes everything.

Is there a way to manually stop a sound once it is started? For that matter, is it possible to detect when a sound is playing and when it is not (a little off topic but may be handy to know down the road)?


Author Message

O.K  



Posts: 27
Rank:


Level: Member

Country: se
Location:
Occupation:
Age:
In-game name:

 
#4 Posted at 2013-04-16 14:22        
     
That's harder to do. I can't help you I'm afraid.

http://www.armaholic.com/forums.php?m=posts&q=12931
Read that thread for more information.


Author Message


Posts: 12
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#5 Posted at 2013-04-17 04:34        
     
# O.K : That's harder to do. I can't help you I'm afraid.

http://www.armaholic.com/forums.php?m=posts&q=12931
Read that thread for more information.
Thanks! Here is what I did with the suggestions of that link:
  • I made a trigger named "playfortunateson" with activation BLUFOR and Present. It seems to require all lowercase, as "PlayFortunateSon" did not work.
  • in the trigger's condition field, I put this:
    player in thisList;
    and in the On Act field, this:
    playfortunateson say ["fortunateson", 0];
  • Then in another trigger, I made the activation BLUFOR and Present again, with this in the condition field:
    player in thisList;
    and this in the On Act field:
    deleteVehicle playfortunateson;
  • In the description.ext file, here's the bit for the sound:
    class CfgSounds
         {
         sounds[] = {fortunateson};
    
         class fortunateson
         {
    		// how the sound is referred to in the editor (e.g. trigger effects)
              name = "fortunateson";
    		  // filename, volume, pitch
              sound[] = {\sound\fortunateson.ogg, db+500, 1.0};
              titles[] = 
              {
                   0, $STRM_fortunateson
              };
         };
    
    note that I made the volume really high - "db+500" - because when using the "say" command I read somewhere that it increases range rather than volume. Before I did this, the positional audio would change depending an where the trigger was located in relation to the player. Now the sound is the same wherever the player is facing.
so when the player enters the first trigger the music begins, and when they enter the second it cuts off... and it works!

This post was edited by Rickswan (2013-04-17 05:15, ago)