[Trigger] Music List?

Status
Not open for further replies.
Level 3
Joined
Oct 12, 2004
Messages
66
Hey guys, i'm just wondering if its possible ( I think so anyways, seen it on other maps) to make a music list with imported musics, playing radomly, while you play the game normally (3D)? (with this I mean, for example like after a cin intro you build a base and custom music's on etc)

Hope you got what I meant to say. Thanks :)
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Well, first, have an array with the playtimes in seconds of each song (don't think you can get the expiration/time of a sound). Then, in the trigger, you'll list the songs with an If-statement (sadly there's no Music type variable)

  • Initialization
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Set myMusicLength[0] = 310
      • Set myMusicLength[1] = 352
and so on.

Then, run the trigger on Map Init or when Timer (New Music) expires.

Then, every time you play a song, do it like this

  • Playlist
    • Events
      • Time - <your timer here> expires
      • Time - Elapsed Game Time is 1.00 seconds
    • Conditions
    • Actions
      • Set tempInt = (Random Number between 0 and <playlist size - 1>)
      • Countdown Timer - Start <your timer here> as a One-shot timer that will expire in myMusicLength[tempInt] seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • tempInt Equal to 1
        • Then - Actions
          • Sound - Play <Music>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempInt Equal to 2
            • Then - Actions
              • Sound - Play <Music2>
            • Else - Actions
              • (so on...)
Where tempInt is a global integer and <your timer here> is a global timer
 
Level 3
Joined
Oct 12, 2004
Messages
66
Hmm, thanks, but got abit confused with the 'your timer here', with this you mean the seconds to wait for the music to start? Can't I use /trigger off /trigger on stuff? (as I have a cinematic first)

Edit:

Also I can't seem to find the part from Countdown timer, 'timer that will expire in xxx', I cannot put the variable I used on the first trigger, or do I make a new one? (searched every option..) Sorry for being new at this :( but just trying to learn

Heres what I exactly did:

Make a trigger with map Initiation

Use Set Variable trigger, and made an Interger with Array on (I think here's the mistake, but i'm not sure.)
And use the variable 3 times (got 3 musics) changing the values 0, 1, 2 (accordingly).

Next I made a variable with 'Timer' section whitouth array checked and used it as 'Time - MyTimer expires'

Next I made Elapsed time trigger.

After I made a variable 'Interger' whitouth Array checked called 'TempInit' (names are similar just to make it easier to follow the guide)

Set 'Tempinit' = Random Nr between 0 and 2

And that's it.

Just to make it easier for ppl to spot the problem if they want to help me.

Thank you once again =|
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
No, you would have a global Timer variable

And as for the timer, let "t" be your timer

  • Countdown Timer - Start t as a One-shot timer that will expire in 30.00 seconds
Also, what the timer is doing is re-running the trigger when it hits the length of your song (so when your song ends)

EDIT: Whaddya know!

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Sound - Set the music list to Music, starting with song 0
Try playing with that action
 
Level 3
Joined
Oct 12, 2004
Messages
66
What do you mean with global? =.=

Bah sorry to mock you with simple stuff :(

I'll try to mess with that 'new' trigger meanwhile :p
 
Level 3
Joined
Oct 12, 2004
Messages
66
if it doesn't work, for future reference

Global = a variable accessible from anywhere, usually defined in the Variable Manager

You mean Object manager? Can't do anithing from there :s

Btw, i've tried the other option, however when I tested the map it disabled me every trigger no idea why :s

I'll try to paste the triggers as soon as I can, glad I didn't save before testing for once =.=
 
Level 3
Joined
Oct 12, 2004
Messages
66
Hmm k that I knew :| Simply not clicking array will make it global? If not what should I do to make it *Global*? And its suposed to be on list something like 'Global', then there's probably something wrong with my WE or just miself. >_>

Really I know I sound like a slow minded nabcake, but I don't care in this case =.=

And Purple, thanks for your patience with me ;p
 
Level 3
Joined
Oct 12, 2004
Messages
66
Now I get it... sorry for being stupid :/

1 last question:

What type of variable is "myMusicLength" part? Because I cannot seem to be able to add it on:
Countdown Timer - Start <your timer here> as a One-shot timer that will expire in myMusicLength[tempInt] seconds


Thanks once again...
 
Status
Not open for further replies.
Top