sornan Posted October 17, 2020 Share Posted October 17, 2020 (edited) Hello :smile: This is a combination of code derived from two scripts from Nexus posts:Script Author: LogicalDFade To Black ISM Works! But Fade-In not working?Script Author: tewlonsImproved cutscenes with cinematic camera, fades, and moreThe final code here has been heavily tested, and works great - (not ENB tested but should be compatible thanks to tewlons code). The usage is pretty simple, and relies on CrossFade so that things are 'seamless' and should be reliable under low fps conditions. Function Code: ;IMS Property ;object under ImageSpaceModifier FadeToBlackHoldImod ImageSpaceModifier Property FadeToBlackHold auto ;***************************************** ;Fade Functions Function DoFadeOut (Float Time) FadeToBlackHold.ApplyCrossFade (Time) Utility.Wait (Time) Game.FadeOutGame (False,True,50,1) EndFunction Function DoFadeIn (Float Time) Game.FadeOutGame (False,True,0.1,0.1) ImageSpaceModifier.RemoveCrossFade (Time) EndFunction ;**************************************** You can add the IMS property and function code to any "full" Papyrus script -Not a fragment- and then call the functions directly from the same script - this includes a custom made quest script.You can add the IMS property and function code to the main quest script generated by the game and then be able to call the functions from quest stage fragments.Script Example: ;Uncomment the SoundCategory property and MasterSound usage to access usage of the Mute function to remove game sound during the black time **Only use Mute if really needed** ;Uncomment the Game.DisablePlayerControls/Game.EnablePlayerControls to allow the player to be locked in place during the fade sequence ;Object under SoundCategory property _AudioCategoryMaster ;SoundCategory Property MasterSound Auto ;Game.DisablePlayerControls(true, true, true, false, true, true, true, false) Utility.Wait(1.0) DoFadeOut (4) Utility.Wait(4.0) ;MasterSound.Mute () ;Do stuff during the black screen ;Move actors, move things, change time, etc ;wait for things to be finished before allowing the fade in Utility.Wait(7.0) DoFadeIn(4) ;MasterSound.UnMute () ;Game.EnablePlayerControls() The Mute option in script added is just in case during the black screen there might be sounds of footsteps or something else undesirable. The option to use Mute in the example code should only be ran during the absolute black screen time, where the FadeOutGame function is running, which prevents the player from escaping during the Mute time. Through numerous tests I have not been able to break the Mute usage, but due to posts from others cautioning about the use of the command, I would at least suggest using it only if needed.The extra code was put into the functions from tewlons script which attempts to compensate for issues with ENB and the IMS property. With ENB enabled, the final result may vary depending on ENB settings, and could range from being fairly smooth fade transitions, to just an instant black screen and then after the duration instant end to black screen. Off-note: If desiring to use a default main quest script yet it does not exist - A main quest script is seemingly not generated by the game until code is compiled into a quest stage fragment, even just a ; (semicolon) added and then compiled will do it. Edited October 18, 2020 by sornan 1 Link to comment Share on other sites More sharing options...
PeterMartyr Posted October 17, 2020 Share Posted October 17, 2020 most users use an enb, do not bother with fade to black, it doe not work with an enb, only works with vanilla un-enhanced graphic skyrim muting FX sound is dangerous too and not good idea, think about it? how do you check if the sound is muted? YOU CAN NOT! use the above code with a grain of salt... Fade to Black is unreliable and notice the code you copied has mute commented out? Sorry to burst your bubble :smile: Link to comment Share on other sites More sharing options...
sornan Posted October 18, 2020 Author Share Posted October 18, 2020 (edited) 1: Okay, so the function here, and the work it's built upon by other members here that have had many peoples interested in their work.. is useless in your opinion? 2: The Mute function is *not* integrated at all into the functions, I put it into example code as being optional, which is why it is commented out. At the top of the example script is..: ;Uncomment the SoundCategory property and MasterSound usage to access usage of the Mute function to remove game sound during the black time;Uncomment the Game.DisablePlayerControls/Game.EnablePlayerControls to allow the player to be locked in place during the fade sequence Also, during the time of pure black in the fade sequence, it is nearly impossible to exit during the time that the Mute *may* be happening because of FadeOutGame, which does not allow using the escape function. In fact, I just spent a half an hour trying to break the code, and I could not escape the current session during the mute time. Lastly, in the nearly impossible event that Mute would remain active - in this case I don't even see how one could do it.. but just to lay it down.. - it is not persistent, and only remains for the current game session, it does not get stored in saves. Sorry to burst *your* bubble.. 4: tewlons *did* get it to work with ENB, and hence as I stated, his code is integrated. But you didn't read that either right.. 5: You didn't burst anything. While you're at it, why not go after the other members that posted their work in getting fades to function as well? 6: I thought the forum rules involved respecting other members and posting constructively, I'm not seeing that in your post at *All*. I only spent my entire afternoon today putting all of this together. I put this together from other members work to give back to the community. Thanks! Edited October 18, 2020 by sornan Link to comment Share on other sites More sharing options...
maxarturo Posted October 18, 2020 Share Posted October 18, 2020 The papyrus audio functions are so bugged, especially the 'Mute', there is great danger of all sound never playing again after the use of this function !, forcing you to start a new clean game. Do not take for granted papyrus, you need to test all functions to discover their flaws, and believe me... even some of the simplest functions have some sort of bug that none of them are documented anywhere. Link to comment Share on other sites More sharing options...
NexusComa2 Posted October 18, 2020 Share Posted October 18, 2020 Sadly Sornan some think this is a place to flex on others. Programmers tend to be arrogant. The worst kind are the delusional ones that think they are great in every way. They really don't know how to bug check and jump to wild conclusion with massive leaps in logic. Then bleed all over the forums ...Anyways ...This is cool stuff. I think I did this at one time also ... let me see if I can find it ... ;setup Imagespacemodifier Property BlackScreen Auto ;* fade setting ;fade to black BlackScreen.ApplyCrossFade(1.5) Game.DisablePlayerControls(True, True, True, False, True, True, True, True,0) Game.GetPlayer().SetDontMove(true) ;remove black fade Imagespacemodifier.RemoveCrossFade(1.5) Utility.Wait(2.0) Game.EnablePlayerControls() Game.GetPlayer().SetDontMove(false) I once made a sound fade out nicely by moving the sound source away. An odd way to do it for sure. Link to comment Share on other sites More sharing options...
sornan Posted October 18, 2020 Author Share Posted October 18, 2020 (edited) The papyrus audio functions are so bugged, especially the 'Mute', there is great danger of all sound never playing again after the use of this function !, forcing you to start a new clean game. Do not take for granted papyrus, you need to test all functions to discover their flaws, and believe me... even some of the simplest functions have some sort of bug that none of them are documented anywhere. Hey Maxarturo I appreciate the input. After a lot of testing last night, found that as long as the player is unable to 'escape' from a loaded game while the 'Mute' function is active, there seems to be no way to break things, and as long as this is for a short duration, and then it is turned off, I actually tried to break it and could not. Fortunately the FadeOutGame function disables everything during it's duration, including the system menu, so as long as the 'Mute' function runs during that time of the pure black, again I could not find a way to break it. Considering the potential ramifications of the usage of the 'Mute', I would of course only suggest such usage if needed, typically it probably would not be needed. Either way, because under certain conditions when you have a unique scene where there is a bunch of noise going on during the fade sequence, at least providing the Mute option in the example code does give a tool to deal with the issue, despite the potential issues if not used carefully, it is a tool nonetheless, and I feel it should be revealed. Sadly Sornan some think this is a place to flex on others. Programmers tend to be arrogant. The worst kind are the delusional ones that think they are great in every way. They really don't know how to bug check and jump to wild conclusion with massive leaps in logic. Then bleed all over the forums ... Anyways ...This is cool stuff. I think I did this at one time also ... let me see if I can find it ... ;setup Imagespacemodifier Property BlackScreen Auto ;* fade setting ;fade to black BlackScreen.ApplyCrossFade(1.5) Game.DisablePlayerControls(True, True, True, False, True, True, True, True,0) Game.GetPlayer().SetDontMove(true) ;remove black fade Imagespacemodifier.RemoveCrossFade(1.5) Utility.Wait(2.0) Game.EnablePlayerControls() Game.GetPlayer().SetDontMove(false) I once made a sound fade out nicely by moving the sound source away. An odd way to do it for sure. Hi NexusComa2 Yea.. I've seen it before, it's just been a long time. I did a lot of scripting in Arma 3, and worked with a number of people, strangely the community there is pretty solid despite a lot of programmers around. On the flip side, when I was working with Oblivion on BladeSong, I ran into a number of people that seemed like they just wanted to fight.. I try to shrug it off and carry on, yet sometimes you can't avoid the conflict and have to deal with things. Nice code there :smile: Heck yea, and I was thinking the same thing, why bother making the custom functions and just use the game functions directly, but it looks like tewlons found a way to get things to work with ENB as well, by putting in FadeOutGame along with the IMS, almost as a backup. It worked out well also being that FadeOutGame stops any access of all menus including system, so it seems like a pretty solid and safe place to do things like (if needed) Mute, etc. I'm relying on his work there for ENB compatibility, and I figured it sure is better than nothing even if it was just a flip to black and flip back with ENB running, rather than everything showing that should be hidden. Yea, this whole thing started with me making a 'tavern' scene in my mod, where the player goes into a pretty quiet tavern, sits down, and then a fade sequence, time passes, and then once it's late at night, the fade-in happens with the tavern packed with 10 people sitting everywhere. I almost gave up on it because I couldn't find a fade sequence that worked along with getting rid of the sound of the actors walking around. After digging around for a long time online and trying different things, I finally got it to work. I almost just carried on and said Great! .. it works.. and then started thinking about how many other people might have to go through the same mess to get their fade sequence figured out or.. give up. So, I decided to put in the combo code that comes from a few different sources here on the forums. It took three times the time I expected to get it all together in a uniform fashion and test things out (in Vanilla). Although tewlons stated that his code works with ENB, which is integrated here, I cannot test that myself with ENB. After looking at what ENB messes with in the game, and after so much effort to configure things for modding, I can't risk messing things up. I think I actually fear more of what ENB would do to my setup than dealing with the Mute function lol. But that's my decision, I know a lot of people use it, I just spent way too much time getting things right in my game setup to risk it. On an off-note - With DisablePlayerControls, I tried the parameter 'abCamSwitch' being set to false, the third element, and in game it still would not let me change from first to third person perspective.. is that option broken with the function maybe? (DisablePlayerControls Description) Edited October 18, 2020 by sornan Link to comment Share on other sites More sharing options...
NexusComa2 Posted October 19, 2020 Share Posted October 19, 2020 (edited) I'm pretty sure that will work with an ENB. It is fading in a real black screen. I myself use an ENB. Just not sure if i was when I made that. Edited October 19, 2020 by NexusComa2 Link to comment Share on other sites More sharing options...
sornan Posted October 21, 2020 Author Share Posted October 21, 2020 (edited) It does seem like most of the posts by others having issues with IMS and ENB's were either using the fade IMS's, or maybe if they were using the solid black along with crossfade they did not post their code, so it's hard to know without testing. At least the FadeOutGame can be there as a backup, and I haven't noticed any issue. I do like the fact the FadeOutGame truly disables system menu access, a nice place to use Mute if needed, when with DisablePlayerControls alone I can't get rid of the player being able to access the system menu. Edited October 21, 2020 by sornan Link to comment Share on other sites More sharing options...
PeterMartyr Posted October 22, 2020 Share Posted October 22, 2020 For opening a menu there Built in Creation Kit function that pauses the FX sound, without using Papyrus. Then the sound pick off exactly where you left it, since it does not play in background like mute. You add the option to pause sound in menu at descriptor or the sound, forget which, near where you adjust sound fade out according to distance. All done without Papyrus too, how cool is that? If you insist on using Papyrus? Ask yourself if you need the sound pause in menu too. Since if you drag your feet in Menu, the sound may be over. If it is not set to loop. BTW a bug is the user not taking everything into account, a PC just does what you tell it to do with Code. Like Mute Sound Forever)) Woow we all that with out using Papyrus, in a thread design to using Papyrus on sound)) I'll fuss up, I have played with mute in years gone by, I find pause is better than Mute for reason stated. But it is still dangerous, but i did for personal use. I support personal use with Sound Category. I in no way shape or form support publishing that code in a mod. That irresponsible. Since there is no way to debug it, and all the possible variations of things that can happen, scare the shite out me? If the Code does not run right. Here a USER CASE, it is a thing coder to avoid mistakes User open Menu, papyrus mutes sound, user save Game, then closed the game with out exiting the Menu? Muted For Ever Bug no way, just a stupid coder, user did nothing wrong Muting Sound is Dangerous!!!!! Use my Options with the Kit. Link to comment Share on other sites More sharing options...
sornan Posted October 25, 2020 Author Share Posted October 25, 2020 (edited) /Edit Just spent 15 minutes trying what you indicated causes a bug, along with a few other attempts to break things. I'm sorry, but I am not getting any issue here. The saved game is always clear of the Mute function, and once restarting the game and using the save the Mute is gone every time. I also tested leaving the Mute on, without ever turning it off in script, saving (along with the menu usage as described above), no difference, the game restart and hence new saved game was fine with no Mute on. Anyhow, I'm done worrying about the Mute, I've spent more time testing this than I ever should have, when my first test revealed it is not stored in saved games. Back to working on my mod :smile: Edited October 25, 2020 by sornan Link to comment Share on other sites More sharing options...
Recommended Posts