• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Random playing music

Status
Not open for further replies.
Level 7
Joined
Aug 17, 2012
Messages
256
Is there a way to make a trigger like:

You got two or three music theme. Each time you go in and then out an inn (with the help of triggers :ogre_datass:) or enter battle, the trigger plays a music theme randomly from the three (or two).


Thanks for help :ogre_datass:
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
If you use a sound variable with array, it becomes quite easy.
Something like this:
Setup:
  • Set Music[1] = Undead2 <gen>
  • Set Music[2] = UndeadX1 <gen>
  • Set Music[3] = War3XMainScreen <gen>
Play music:
  • Sound - Play Music[(Random integer number between 1 and 3)]
However, now it's classified as a sound (not music).

If you would really like it to be classified as "music", then something like this should work:
  • Actions
    • Set randInt = (Random integer number between 1 and 3)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • randInt Equal to 1
      • Then - Actions
        • Sound - Play Tension <gen>
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • randInt Equal to 2
          • Then - Actions
            • Sound - Play TragicConfrontation <gen>
          • Else - Actions
            • Sound - Play War2IntroMusic <gen>
 
Status
Not open for further replies.
Top