Jump to content
  • 0

How can I add multi intro song?


koreaoverpoch

Question

Currently I have 1 intro Music
 
But I want to add several music and play it as random.
 
This is my description part of the introsong
//intro script
class CfgSounds
{
    sounds[] =
    {
    introSong
    };
 
    class introSong
    {
    name="introSong";
    sound[]={introSong.ogg,0.3,1};
    titles[] = {};
    };
 
How can i fix this class?
 
 
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
class CfgSounds
{
    sounds[] =
    {
    introSong,
    introSong2
    };
 
    class introSong
    {
    name="introSong";
    sound[]={introSong.ogg,0.3,1};
    titles[] = {};
    };
    class introSong2
    {
    name="introSong2";
    sound[]={introSong2.ogg,0.3,1};
    titles[] = {};
    };
};

It would look like that, but that isn't enough to make it play more than one song, you would need to add code that would play the other songs 

 

This is how you execute the sound 

playSound "introSong2";

so you could have something like this

waitUntil { alive player };
sleep 4;
playsound "introSong";
cutText ["You are playing on *ServerName*", "PLAIN DOWN"];
sleep 4;
cutText ["Second Editable Text", "PLAIN DOWN"];
sleep 4;
cutText ["Third Editable Text", "PLAIN DOWN"];
sleep 10;
playSound "introSong2"; 
Link to comment
Share on other sites

  • 0

Why not make it random.

 

_soundArray = ["introSong","introSong2","introSong3"]; // add your sounds here in a list/array

 

_soundToPlay  = [_soundArray] call BIS_fnc_selectRandom; // select a random one from that array

 

playsound _soundToPlay; // play the random sound

Link to comment
Share on other sites

  • 0

Ah, the [ ] around _soundArray in the BIS_fnc_selectRandom line is too much.

 

This:

_soundToPlay  = [_soundArray] call BIS_fnc_selectRandom;

 

needs to be:

_soundToPlay  = _soundArray call BIS_fnc_selectRandom;

 

In your description.ext you also need other songs?? How would you randomly select if you only have 1?

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