Need help creating random chance...

the king

New Member
Code:
if((random 2)>=1) then {
    playsound "introSong";
} else {
    playsound "introSong1";
};
I have this piece of code to create a random chance that either introSong or introSong1 will play when players joins the server. My question is how would i go about adding another introSong?
 
Code:
switch (random floor(3)) do {
case 0: {playsound "introSong";
};
case 1: {playsound "introSong1";
};
case 2: {playsound "introSong2";
};
};

would something like this work?
 
It would be
(floor(random 3))

I'm not sure if you can put that into the file though (is it description.ext?)
 
no its in a sqf file that creates a pan in camera and plays a short clip from a song, just dont want my players getting sick of the same song over and over, and i dont want to be changing it all the time. like im no expert scripter or anything, but i do know some of the basics of logic scripting, how would i implement that in to my code,
something like....

Code:
switch (floor(random 3)) do {
case 0: {playsound "introSong";
};
case 1: {playsound "introSong1";
};
case 2: {playsound "introSong2";
};
};
 
this is the script im using this for btw......
Code:
_welcomeMessage = format["Welcome to the Insidious Dominance server %1, follow the server rules and have some fun.",format["%1", name player]];
_camDistance = floor(random 20)+20;
_rnd0 = floor(random 50)-25;
_rnd1 = floor(random 50);
 
waitUntil {!isNil "dayz_animalCheck"};
 
playsound "introSong";
/*
if((random 2)>=1) then {
    playsound "introSong";
} else {
    playsound "introSong1";
};
*/
 
/*
//intro move
showCinemaBorder true;
camUseNVG false;
 
_camera = "camera" camCreate [(position player select 0)+_rnd0, (position player select 1)+_rnd1,(position player select 2)+_camDistance];
_camera cameraEffect ["internal","back"];
 
_camera camSetFOV 2.000;
_camera camCommit 0;
waitUntil {camCommitted _camera};
 
_camera camSetTarget vehicle player;
_camera camSetRelPos [0,0,2];
_camera camCommit 8;
*/
player switchMove "AidlPpneMstpSnonWnonDnon_SleepC_sleep";
 
sleep 2;
if !(dayzPlayerLogin2 select 2) then {
cutText [_welcomeMessage, "PLAIN DOWN"];
} else {
    [] spawn {
      cutText ["This server is a streamer friendly server No steam sniping", "PLAIN"];
      sleep 8;
      cutText ["No vehicle hoarding.", "PLAIN"];
      sleep 8;
      cutText ["Server Rules: Be polite in side chat. No Cry Babies.", "PLAIN"];
      sleep 8;
    };
};
 
sleep 5;
player switchMove "AidlPpneMstpSnonWnonDnon_SleepC_standUp";
/*
waitUntil {camCommitted _camera};
 
_camera cameraEffect ["terminate","back"];
camDestroy _camera;
*/

edit: i had to cut out the whole pan in camera thing, AI killing the players before they stand up. i also had it able to pick between to song clips. just commented it out for now will i get the new sound files ready
 
Yes then
Code:
switch (floor(random 3)) do {
case 0: {playsound "introSong";
};
case 1: {playsound "introSong1";
};
case 2: {playsound "introSong2";
};
};
Should work fine.
 
Back
Top