exneph Posted March 10, 2012 Share Posted March 10, 2012 Alright. I searched the forums, and I saw one other post about a member who couldn't get the trigger to work, but this is a little different. I can get the trigger to work and play the music (had to make sure the trigger box was large enough.), and everything is fine. But what I was wondering is how to make the music play in one area (ergo, enter room passing through the trigger box), yet when you leave the area the music will return to the normal default music. The only thing I can think of is placing another trigger box behind the first that will be set to the default music, but wouldn't that cause BOTH music, and background default, to play at the same time? Any help would be greatly appreciated. Thanks! Link to comment Share on other sites More sharing options...
fg109 Posted March 10, 2012 Share Posted March 10, 2012 Are you using the defaultAddMusicScript? Try this instead: scriptName CustomAddMusicSCRIPT extends ObjectReference {plays music when player enters trigger, stops when player leaves} MusicType property myMusic auto {Music to play when player enters trigger} Auto STATE Listening EVENT onTriggerEnter (objectReference triggerRef) Actor actorRef = triggerRef as Actor if (actorRef == game.GetPlayer()) gotoState ("done") myMusic.Add() endif endEVENT endState STATE done Event OnTriggerLeave (objectReference TriggerRef) if (TriggerRef as Actor == Game.GetPlayer()) GoToState("Listening") myMusic.Remove() endif EndEvent endSTATE Link to comment Share on other sites More sharing options...
exneph Posted March 11, 2012 Author Share Posted March 11, 2012 That script works perfectly. All it requires is to have the entire area in which you enter to be inside the triggerbox. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts