Remember playing Unreal for
the first time, where the dead body was thrown against the wall, and those brutes shot it
to pieces and you were greeted by the first enemy of the game? Remember how the music
changed? And remember the first time you fought a Skaarj? The music stopped, the lights
went out, then all of a sudden the flashing lights hit, the intense music started, and you
got ripped to shreds by the Skaarj? I'm talking about this because this is a great example
of dynamic music used by Epic in Unreal. The music really helped immerse you into the
moment. So you want to add dynamic music to your levels? Perhaps you want the music to
change when you walk into a different area of your level. Perhaps you want to do like they
did in Unreal... Dynamic music is done with the
class called MusicEvent, which is found in Actor -> Triggers -> MusicEvent. Using
this class requires that you know how to use triggers.
MusicEvent
Put a musicevent actor somewhere. The Musicevent actor has
its own section when you go to its properties (which is keenly named MusicEvent). Choosing
what song to play here is just like in the level properties. You've got your CdTrack,
Song, and SongSection fields. There are new fields here for you however.
bAffectAllPlayers - I am guessing that if
this is True, the music would change for everyone in a multiplayer game if anyone were to
trigger the musicevent, and if this is False, it would only change the music for the
player who set it off.
bOnceOnly - This one means, if True, then
only play the song until it reaches its end once, then no music would be playing.
bSilence - I'm guessing you would put this
to True if you wanted to halt all music from playing at once with a MusicEvent.
Transition - This is how the song playing
and the one that is to start make a transition. There are a few different options to
choose from, play around with them and see what fits your needs best. There are instant
transitions and fadeing transitions.
That is basically the only set of properties you need to
worry about for the MusicEvent, except for the Event one. You have this MusicEvent
created, and now you must have a way to actually set it off!
Triggering the MusicEvent
You should read the tutorial here about Triggers if you know
nothing about how to use them. To get your musicevent to happen, something must trigger
it. Do this by first deciding on what basis you want the music to play. Is it simply if
the player walks into a certain area? If the player pulls a switch? Figure out how you
want it to happen, then link the musicevent to the trigger. I won't go over triggers in
this tutorial, as they are explained !here!, but I will give one example of how I use
dynamic music in MY levels.
Dynamic Music Example
The Setting: I have a castle level I'm
working on. While the player is outside, I have a song called Twilight (its nice and
quaint, fits the nice scenery) that plays, and on the inside I have a song called xd3
(from some dungeon game, fits the indoor castle mood) that plays.
The player STARTS outside, so I put Twilight in the Level
Properties default song (Starting at the beginning, so songsection 0).
At the entrance of the castle there is a doorway the player
must go through. This is where I set up the musicevents and triggers for each side.
On each side of thise door I put triggers with collisions
that the player would have to go through to get through the door. The trigger on the
outside triggers the musicevent that plays twilight, the trigger on the inside triggers
the musicevent that plays xd3. Making the connection from the trigger to the musicevent is
a matter of giving the trigger the same Event as the musicevent has for a tag (like
"CastleExit"). From the shots above you can see how I have it set up. There was
a problem I hit with my setup though, which was to exit the castle, the castle music would
start AGAIN before you got outside (to the outside music), since you were already in and
had to get through the door to leave. To solve this, I used MTRAN_SlowFade which works
perfectly in this situation because of how long it takes to fade. By the time the song
that is playing has faded out, you have already passed the door and are well past the next
trigger (thus the RIGHT song is ready to start).
And that is all I have to say about that, other ways to
trigger the musicevent are matters you should be able to figure out on your own once you
have read up about triggers in the trigger tutorial. |