OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: USI Rfox7 on 13 Jul 2003, 13:23:00
-
ok guys and gals here is the deal i have a intro to a map with 2 songs.
Now i want ofp to choose a random song at the start of the intro.
here is what i have
_songs = ["xl_intro1","xl_inro"]
_rndsong = random (count _songs)
_rndsong = _rndsong - (_rndsong mod 1)
_song = _songs select _rndsong
playmusic _song
now it will play the 1st song in the list when it is choosen (xl_intro1)
but when it chooses to play the 2nd song (xl_inro) i hear nothing.
yes the description.ext is right
b/c if i switch the 2 songs from
_songs = ["xl_intro1","xl_inro"]
to
_songs = ["xl_intro","xl_inro1"]
it does the same thing it will play the 1st song listed and not the 2nd when it is choosen.
hope i have explained it well enough
and plz if you can help it sure would be nice and thx
-
Here's a random music script I made and it works just fine. Maybe it'll help ?
_music = ["track3","track5","Rtrack5","track7","Rtrack9","track15","track13","Rtrack2"]
_track = _music select (random 7)
playmusic _track
-
Hey Bud,
I missed ya. U almost had it right.
---> random.sqs
#start
_songs = ["first", "second", "third", "fourth"]
_rndsong = (random (count _songs)) - 0.5
_song = _songs select _rndsong
playSound _song
#exit
-----> description.ext
class CfgSounds
{
   sounds[] =
      {
         first, second, third, fourth
      };
   class first
  ÂÂ
   {
      name = "first";
      sound[] = {"first.ogg", 1, 1.0};
      titles[] = {   };
   };
   class second
  ÂÂ
   {
      name = "second";
      sound[] = {"second.ogg", 1, 1.0};
      titles[] = {   };
   };
   class third
  ÂÂ
   {
      name = "third";
      sound[] = {"third.ogg", 10, 1.0};
      titles[] = {   };
   };
   class fourth
  ÂÂ
   {
      name = "fourth";
      sound[] = {"fourth.ogg", 10, 1.0};
      titles[] = {   };
   };
};
---> then a trigger!
a=0
b=0
trigger for ONCE only
Condition = true
Activation = this exec "random.sqs"
        ÂÂ
works great! remember sound file sizes though. lol ;D