Would this work?
by Dustin Mullen · in Technical Issues · 09/26/2007 (12:32 pm) · 4 replies
I'm trying to get music to play when I get into my mission. I already have gone through the in game music tutorial.
Now, I added this to my mission file:
$musicHandle2 = alxPlay(Mission_Music); <--- This doesn't work. What am I doing wrong?
alxStop($musicHandle2); <--- where would I put this to make the music stop when I leave the mission?
Now, I added this to my mission file:
$musicHandle2 = alxPlay(Mission_Music); <--- This doesn't work. What am I doing wrong?
alxStop($musicHandle2); <--- where would I put this to make the music stop when I leave the mission?
#2
09/26/2007 (1:09 pm)
Did you put it in the "onMissionLoaded" function in game.cs? That would load it up when the mission gets loaded.
#3
Tyler: Yea, I did that.
09/27/2007 (9:09 am)
Sean: Yes, It's predefined. It works, but it won't turn off. I'll mess around with the scripts and see what I can. Thanks.Tyler: Yea, I did that.
#4
09/28/2007 (7:44 am)
If your leaving a mission, you might want to try this anyways. alxStopAll();
Torque 3D Owner Sean H.
for your first question, what you have there looks correct as long as Mission_Music is either a predefined sound profile object name, or a sound source id returned from alxcreatesource(). if you post the code you're using to create Mission_Music it'll be easier to troubleshoot the problem.
for your second question, it really depends on what you want to have happen. in general, there's 3 occasions in which youd want to make the music stop; when you go to a new level, when the current level is restarted, and when the player quits the game. You need to fish through the scripts and find the point in code where mission exiting takes place and find the right spot to drop it in. you should know that, by default, when a mission is ended in torque alxstopall() is called which stops all current sounds from playing. so you may not need to add it at all depending on your situation.