| Home Page | Recent Changes | Preferences

MusicEvent

Actor >> Triggers (UT) >> MusicEvent

A MusicEvent actor is designed to change the music that players in the game hear when it's triggered. There are a number of configurable variables that can affect this change.

Properties

bool bAffectAllPlayers
If set to True, then every player in the level will hear the transition. If set to False, then only the player that triggered the actor will hear it.
bool bOnceOnly
If set to True, then after the MusicEvent has been triggered once, it cannot be triggered again.
bool bSilence
If set to True, then the MusicEvent actor override its settings for song and CD Track and simply bring the music to a halt. The various Transition types still apply.
byte CdTrack
This integer value specifies the track of an audio CD in the computer's CD-ROM drive. When triggered, the MusicEvent will cause this track on an audio CD to begin playing. The default value of 255 means that it will ignore this statement and default to the listed Song.
Music Song
This specifies the location of the music resource to access and begin playing (package and resource name).
byte SongSection
This number specifies the pattern to begin at when the Song starts to play. (Look further down the page for more information.)
EMusicTransition Transition
This value determines how the music should change between the current music to the piece of music defined in this actor.
The EMusicTransition enum is declared in the Actor class and can be set to one of these values:
MTRAN_None
the music will not make a successful transition.
MTRAN_Instant
the music will change instantly.
MTRAN_Segue
the two pieces of music will almost seem to overlap due to the quickness of the change.
MTRAN_Fade
the first piece of music will fade out before the second one begins.
MTRAN_FastFade
like MTRAN_Fade, but the first piece of music takes less time to fade out.
MTRAN_SlowFade
like MTRAN_Fade, but the first piece of music takes longer to fade out.

Tutorial

To test this actor, all you need is a basic room with a Trigger and a MusicEvent in it. The room needs to be large enough that the player can move around freely without inadvertently touching the trigger. Set the Trigger's Event to the Tag of the MusicEvent, and put the Trigger in a place where you'll be able to both find it and avoid it (give it light properties, for example). You can put the MusicEvent actor anywhere you want because its location is entirely irrelevant. However, most mappers put such actors in an area that is relevant to the actor's function, such as near the Trigger that causes it to work.

Once you have set up the room with all of the necessities, and the Trigger and MusicEvent properties are set up as you would like them, test this mini-map in Unreal or UT. You will notice that when you set off the Trigger, the music starts to play. Also, if you left bOnceOnly to false, then you can set off the Trigger again and the music will start over when you do.

Troubleshooting Questions

There are some music files in the original Unreal that don't play the tempo of some of their songs properly at times. I am not sure of the actual mechanics of the problem, but I do know both the cause of the problem and a viable solution. To more easily understand this fix, I suggest that you look up the Dispatcher tutorial in this guide.

To hear the problem more plainly for yourself, start by choosing a certain music package from Unreal. A few of the music packages that I have found this problem in are Nali.umx, UTemple.umx, and WarGate.umx. (Nali and UTemple have 2 songs each, while WarGate has 3 songs.) Choose one of these music packages for your MusicEvent actor, and choose SongSection 1 for it. When you test it, you will hear a noticeable drag in the tempo. Now, I'll introduce a method to correct it.

Leave the room set up as before, but remove the Event and Tag names on the Trigger and MusicEvent. Now, add a Dispatcher and a second MusicEvent actor to the world. In the second MusicEvent, use the same song as before, but choose SongSection 0 for it. Set the Transition property of this "Section 0" actor to whatever it was in your other one, and then change the Transition type for the "Section 1" actor to MTRAN_Instant or MTRAN_Segue.

Now enter the Dispatcher's properties and set up the first two OutEvents names to your "Section 0" tag and "Section 1" tags, whatever they are. Then go into OutDelays, and in the same place as the "Section 1" tag, change the number to 0.01 seconds. Before you leave, give the Dispatcher a unique Tag name. Close the Dispatcher's properties, and open your ordinary Trigger's properties. All you need to do here is make the Trigger's Event name the same as the Dispatcher's Tag name, so that the Trigger will go to the Dispatcher instead of the MusicEvent when it's triggered.

When you test the map and set off the Trigger, you might hear a small glitch at the beginning, but it's better than having the whole song ruined. Now I'll answer your question: "What did we do and why did it work?" The game won't play section 1 of these files incorrectly if section 0 is playing beforehand, so we make it do so. When the Trigger is set off, it goes to the Dispatcher. The first thing it does is trigger the MusicEvent set up to play section 0, but 1/100th of a second later, the Dispatcher triggers the MusicEvent set up to play section 1. The result is that the music at section 1 recieves the benefit of a proper tempo, since section 0 was playing beforehand.

Ike Bart: I tried using the CD track with the music event with one of my music CDs in Unreal Tournament and all I got was the default song in the level properties to play.

Ike Bart: After browsing through the advanced options, I found something under the audio section called "UseCDMusic." I enabled that and got the CD audio to work. The only problem is that the default song in the level properties plays at the same time.

About SongSection

Music files that are tracked for the Unreal engine will sometimes contain more than one song. This setting is used to determine where in the file the actor should begin playing the music. In the music file, the patterns (phrases of music) from one song are kept separate from the others by using loop points. Usually, the patterns will be arranged so that the first patter of each song in the file is one of the first patterns in the file (i.e. patterns 0, 1, and 2, if there are three songs). Something to remember: the first pattern in any music file is always pattern 0.

Here's an example of SongSection that you should be familiar with if you've played any part of the Unreal SinglePlayer game. In the first Rrajigar Mines level, the first song you hear is SongSection 2 of DigSh.umx. After you cut the power to the force field, the music fades out into silence. A MusicEvent actor was used for this effect. When you face the first Skaarj Warrior in the game, the music instantly begins playing SongSection 1 of DigSh.umx. The music then continues through most of the level until it changes again to a quieter song, which would be SongSection 0 of DigSh.umx.

Also, there is currently no way to listen to all songs in a music package from within UnrealEd. To hear the entire contents of a music package, I suggest downloading a copy of ModPlug Player from [ModPlug's site]. If you have any interest in tracking music yourself, I would also suggest downloading ModPlug Tracker from the same location.

Related Topics

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In