Background Music
by Lisa Holden · in Technical Issues · 07/18/2008 (6:36 pm) · 3 replies
I have created a game in Torque and I am trying to get background music to play once the mission starts. I have created music to play when the main menu starts but then that music stops once the mission begins. I read an article on here on how to create the background music in the mission but it was unsucessful. Does anyone know how the background music can be created?
Thanks :)
Thanks :)
#2
07/21/2008 (3:03 pm)
I can't access that website. Does anyone else have any ideas?
#3
You would need to set up the audio description and audio profile much like the music in the main menu resource - I'm assuming that's how you got the menu music working. Make sure that you are using .ogg or .wav files (.mp3 isn't supported), and for simplicity I'm using a simple naming scheme for the music tracks.
AudioDescription(AudioMusic)
AudioProfile(track1), AudioProfile(track2), AudioProfile(track3), AudioProfile(trackX),... and do that for each music track that you wont to have. This setup will make use of one background track per map.
In the function onMissionDownloadComplete() in the file "client/scripts/missionDownload.cs" you'll want to tell it play your music:
In the same file You'll also need to change the function onMissionDownloadPhase1 (change the '%musicTrack' to '$musicTrack')
Edit your mission file and insert a line with musictrack into the .mis file
There was basic music manager for TGE called VMplayer (I think) that may be more suitable if you are wanting to have multiple tracks per map and/or some sort of dynamic music system. But this should get you started.
07/21/2008 (7:14 pm)
It only takes script code to enable background music so I don't see any reason why the code posted in that thread couldn't be shown here. There was no source code displayed or changed.You would need to set up the audio description and audio profile much like the music in the main menu resource - I'm assuming that's how you got the menu music working. Make sure that you are using .ogg or .wav files (.mp3 isn't supported), and for simplicity I'm using a simple naming scheme for the music tracks.
AudioDescription(AudioMusic)
new AudioDescription(AudioMusic)
{
volume = 1.0;
isStreaming = true;
isLooping = true;
is3D = false;
type = $SimAudioType;
};AudioProfile(track1), AudioProfile(track2), AudioProfile(track3), AudioProfile(trackX),... and do that for each music track that you wont to have. This setup will make use of one background track per map.
new AudioProfile(track1)
{
filename = "~/data/sound/track1.ogg";
description = "AudioMusic";
preload = false;
};In the function onMissionDownloadComplete() in the file "client/scripts/missionDownload.cs" you'll want to tell it play your music:
alxPlay($musicTrack);
In the same file You'll also need to change the function onMissionDownloadPhase1 (change the '%musicTrack' to '$musicTrack')
function onMissionDownloadPhase1(%missionName, $musicTrack)This is necessary in order for the next part to work.
Edit your mission file and insert a line with musictrack into the .mis file
new SimGroup(MissionGroup) {
musicTrack = "track1";
new ScriptObject(MissionInfo) {
...That way for every map you can designate a specific background track.There was basic music manager for TGE called VMplayer (I think) that may be more suitable if you are wanting to have multiple tracks per map and/or some sort of dynamic music system. But this should get you started.
Torque Owner Taylor Petrick
www.garagegames.com/mg/forums/result.thread.php?qt=21509