Uledus Posted March 20, 2019 Share Posted March 20, 2019 (edited) Today I tested a script to play my short music tracks(simply: player ontriggerenter, add my musicRef, wait 5 seconds, remove musicRef).One thing is problematic though - current music tracks don't fade(sometimes at least) before my own music track plays and I can't find a setting in CK or script function for volume fade control.In the CK for the Music Type I set 'Ducks Current Track' with a high Ducking dB value, so that the current music track will play silently in the background while my own music track plays(I want this behaviour).This works properly, but sometimes the current track continues without fading.Any way to prevent this/force volume fade in the script?Thanks in advance! Edited March 20, 2019 by Uledus Link to comment Share on other sites More sharing options...
maxarturo Posted March 20, 2019 Share Posted March 20, 2019 What i have found out is that sometimes the positioning of an activator or trigger box might glitch in CK, this has happened to me with the "magic tablet", i had 5 with the same script and configuration and one tablet 2 out of 8 times wasn't working correctly. After deleting and rebuilding the problematic tablet in a different position (with same script and configuration) everything worked fine after that. If this isn't your case, then posting your script might help somebody in helping you. Link to comment Share on other sites More sharing options...
Uledus Posted March 20, 2019 Author Share Posted March 20, 2019 I didn't use anything special in the script yet - only myMusicRef.add() and myMusicRef.remove().A simple music trigger script can look like this for example: Musictype Property MusicRef Auto Auto State Listening Event OnTriggerEnter (objectReference akActionRef) Debug.Notification("Ouch!") gotoState ("done") MusicRef.Add() Utility.wait(5.0) MusicRef.Remove() endEvent endState State done ; nothing endState In my case the new music is only a single track and in the CK Music Type settings I set the 'Ducks Current Track' option with a high Ducking dB value. The overall priority for my sound is significantly high.In game the "current track" sometimes doesn't fade before my music track starts and I'm not sure what I can do to prevent this behaviour. Link to comment Share on other sites More sharing options...
maxarturo Posted March 20, 2019 Share Posted March 20, 2019 I think your script need to force remove - fade vanilla music before or while your music starts. - If your trigger box is placed in a custom made dungeon (something that you build) then remove the music from the cells properties (set it to none), not the best solution. - Or create a Sound box around the palce your trigger box - music will play. * i can't think something else, haven't experimented too much with sound so that i can provide a script solution. Have some patience until a more experience scripter post the solution. Link to comment Share on other sites More sharing options...
NexusComa Posted March 21, 2019 Share Posted March 21, 2019 (edited) First off make your own Music Type (form type MUSC). [Edit an existing Music Type, rename, yes to new] ...You will now need to make a .bsa with your .esp file. [File/Create Archive ... same name as mod with extension .bsa](well, not right now but when you're done ... :tongue:) (guess you are using scripts so you already knew that ... :tongue:)Edit newly made MUSC form.Priority 47 ... Will do.Fade Duration 3.0 ... About the lowest you can go and hear a smooth fade effect ... (debatable).Ducking 3.0 ... To match the fade.Check-mark in Plays One Selection.Check-mark in Ducks Current Track.No check-mark in Abrupt Transition.Now for the script. Your use of the "state done" is actually creating a redundant loop as is.3 ways to do this ... Scriptname Test_PopMusic extends ObjectReference;* Pop Music * By: NexusComa * ; nexusmods.comMusicType Property TriggerMusic AutoActor Property PlayerRef Auto ; auto fill thisEvent OnInit() GoToState("Done")EndEvent;------------------------Event OnTriggerEnter(objectReference akActionRef) If(akActionRef == PlayerRef) Debug.Notification("Ouch!") TriggerMusic.Add() Utility.wait(5.0) TriggerMusic.Remove() EndIf GotoState("Done") <- not really sure if you even need this. Starting to think you don't. Seen it in the Creation Kit scripts done both ways.EndEvent;------------------------State Done ;do nothingendStateScriptname Test_PopMusic extends ObjectReference;* Pop Music * By: NexusComa * ; nexusmods.comMusicType Property TriggerMusic AutoActor Property PlayerRef Auto ; auto fill thisEvent OnInit() GoToState("TriggerBox")EndEvent;------------------------State TriggerBox Event OnTriggerEnter(objectReference akActionRef) If(akActionRef == PlayerRef) Debug.Notification("Ouch!") TriggerMusic.Add() Utility.wait(5.0) TriggerMusic.Remove() EndIf EndEventEndStateScriptname Test_PopMusic extends ObjectReference;* Pop Music * By: NexusComa * ; nexusmods.comMusicType Property TriggerMusic AutoActor Property PlayerRef Auto ; auto fill this;------------------------Auto State TriggerBox Event OnTriggerEnter(objectReference akActionRef) If(akActionRef == PlayerRef) Debug.Notification("Ouch!") TriggerMusic.Add() Utility.wait(5.0) TriggerMusic.Remove() EndIf EndEventEndState With a sound:Scriptname Test_PopSound extends ObjectReference;* Pop Sound * By: NexusComa * ; nexusmods.comSound Property TriggerSound AutoMusicType property _NONE Auto ; auto fill thisActor Property PlayerRef Auto ; auto fill thisInt TriggerSoundID ; (if used)Auto State TriggerBox Event OnTriggerEnter(objectReference akActionRef) If(akActionRef == PlayerRef) Debug.Notification("Ouch!") _NONE.Add() TriggerSound.PlayAndWait(PlayerRef) ; remove if you use lower rem version ;TriggerSoundID = TriggerSound.Play(PlayerRef) ;Utility.wait(5.0) ;Sound.StopInstance(TriggerSoundID) _NONE.Remove() EndIf EndEventEndStateGuess I added in a PlayerRef not sure if you wanted that ... :tongue:I tested all this and it is a sweet effect. Has a nice flow to it too ... Edited March 22, 2019 by NexusComa Link to comment Share on other sites More sharing options...
NexusComa Posted March 21, 2019 Share Posted March 21, 2019 (edited) I use that "State Done" a lot myself ... for no other reason than that's what I see in the Creation Kit scripts.It may have something to do with how Skyrim calls/sets-up it's interrupt system. Or possibly a side step on game start to initializethe script but not set up all the triggers right at that moment, waiting until the cell is entered instead.The fact it could be for ether of them reasons and really isn't a hassle I tend to use that format a lot.It would be interesting to know if that was just programmer choice or for a real reason ... Edited March 21, 2019 by NexusComa Link to comment Share on other sites More sharing options...
Uledus Posted March 22, 2019 Author Share Posted March 22, 2019 Hm, it seems that current music tracks don't fade with 100% safety. I placed the trigger box at a small free area behind Whiterun Stables building. At this location there is always a chance that a specific vanilla music track never fades when my custom music plays. Any other ideas? Can I actually script the "enemy chases player / end player chase" situation without enemies, force my music as combat music to always fade current music quickly? Link to comment Share on other sites More sharing options...
NexusComa Posted March 22, 2019 Share Posted March 22, 2019 Hmm, worked perfectly for me and I also tested each script,Did you copy the script word for word and make your own MUSC form.Music is a bit tricky to work with. Did you see the _NONE in the sound version.Sometimes that can be the trick to getting things to work out. Idk, like I said they worked well for me. You could play with the Priority setting that is the defining number on who plays over who ... Link to comment Share on other sites More sharing options...
NexusComa Posted March 22, 2019 Share Posted March 22, 2019 Two thing that may have killed my testing ... (in your case)I was in a cell and the music playing had the setting the same as I posted above.If the MUSC form playing is set up differently (I'm sure they are) that may/will play a role.Possibly you could turn down the music volume and play your tune as a sound ... Link to comment Share on other sites More sharing options...
NexusComa Posted March 22, 2019 Share Posted March 22, 2019 I'm not even sure, I'm sure you need the GotoState("Done") at all after it has been called from the Event Oninit() the first time.Looking back I see it both ways and even on some Creation Kit scripts done both ways. It works without the second call so that too is probably a redundant loop.As in the scripts returns to the last known State after breaking from the Event. Please enlighten me if anyone knows for sure! Link to comment Share on other sites More sharing options...
Recommended Posts